Part of !209
@ -35,10 +35,14 @@ CompositeWidgetFocusWatcher::CompositeWidgetFocusWatcher(QWidget *compositeWidge
bool CompositeWidgetFocusWatcher::eventFilter(QObject *watched, QEvent *event)
{
Q_UNUSED(watched)
auto *focusEvent = static_cast<QFocusEvent *>(event);
switch(event->type()) {
case QEvent::Close:
case QEvent::DeferredDelete:
case QEvent::Destroy:
removeEventFilter(watched);
disconnect(this, &CompositeWidgetFocusWatcher::compositeFocusChanged, watched, nullptr);
break;
case QEvent::FocusIn:
emit compositeFocusChanged(true);
@ -577,7 +577,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent)
new AutoScrollHandler(this);
// Keep this last
auto focusWatcher = new CompositeWidgetFocusWatcher(this, this);
CompositeWidgetFocusWatcher *focusWatcher = new CompositeWidgetFocusWatcher(this, this);
connect(focusWatcher, &CompositeWidgetFocusWatcher::compositeFocusChanged,
this, [this](bool focused) {_hasCompositeFocus = focused;});