Fixed escape key press detection

This commit is contained in:
Uwe Kindler 2020-02-25 09:16:21 +01:00
parent 8cc9cc25ad
commit 34cb2ae917

View File

@ -206,6 +206,11 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
SLOT(onApplicationStateChanged(Qt::ApplicationState)));
// The focused object will receive key press events and therefore we
// install the event filter on it to receive escape key press for drag
// canceling
qApp->focusObject()->installEventFilter(this);
}
@ -220,10 +225,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockWidget* Content)
d->ContenSourceContainer = Content->dockContainer();
}
setWindowTitle(Content->windowTitle());
// We need to install an event filter for the given Content
// widget to receive the escape key press
Content->dockAreaWidget()->installEventFilter(this);
}
@ -235,10 +236,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockAreaWidget* Content)
d->ContentSourceArea = Content;
d->ContenSourceContainer = Content->dockContainer();
setWindowTitle(Content->currentDockWidget()->windowTitle());
// We need to install an event filter for the given Content
// widget to receive the escape key press
Content->installEventFilter(this);
}
@ -395,7 +392,6 @@ bool CFloatingDragPreview::eventFilter(QObject *watched, QEvent *event)
} // namespace ads
//---------------------------------------------------------------------------