@@ -206,6 +206,11 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
206
206
207
207
connect (qApp, SIGNAL (applicationStateChanged (Qt::ApplicationState)),
208
208
SLOT (onApplicationStateChanged (Qt::ApplicationState)));
209
+
210
+ // The focused object will receive key press events and therefore we
211
+ // install the event filter on it to receive escape key press for drag
212
+ // canceling
213
+ qApp->focusObject ()->installEventFilter (this );
209
214
}
210
215
211
216
@@ -220,10 +225,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockWidget* Content)
220
225
d->ContenSourceContainer = Content->dockContainer ();
221
226
}
222
227
setWindowTitle (Content->windowTitle ());
223
-
224
- // We need to install an event filter for the given Content
225
- // widget to receive the escape key press
226
- Content->dockAreaWidget ()->installEventFilter (this );
227
228
}
228
229
229
230
@@ -235,10 +236,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockAreaWidget* Content)
235
236
d->ContentSourceArea = Content;
236
237
d->ContenSourceContainer = Content->dockContainer ();
237
238
setWindowTitle (Content->currentDockWidget ()->windowTitle ());
238
-
239
- // We need to install an event filter for the given Content
240
- // widget to receive the escape key press
241
- Content->installEventFilter (this );
242
239
}
243
240
244
241
@@ -395,7 +392,6 @@ bool CFloatingDragPreview::eventFilter(QObject *watched, QEvent *event)
395
392
396
393
397
394
398
-
399
395
} // namespace ads
400
396
401
397
// ---------------------------------------------------------------------------
0 commit comments