@@ -206,10 +206,6 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
206
206
207
207
connect (qApp, SIGNAL (applicationStateChanged (Qt::ApplicationState)),
208
208
SLOT (onApplicationStateChanged (Qt::ApplicationState)));
209
-
210
- // We need to install an event filter for the given Content
211
- // widget to receive the escape key press
212
- Content->installEventFilter (this );
213
209
}
214
210
215
211
@@ -224,6 +220,10 @@ CFloatingDragPreview::CFloatingDragPreview(CDockWidget* Content)
224
220
d->ContenSourceContainer = Content->dockContainer ();
225
221
}
226
222
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
227
}
228
228
229
229
@@ -235,6 +235,10 @@ CFloatingDragPreview::CFloatingDragPreview(CDockAreaWidget* Content)
235
235
d->ContentSourceArea = Content;
236
236
d->ContenSourceContainer = Content->dockContainer ();
237
237
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 );
238
242
}
239
243
240
244
@@ -381,7 +385,7 @@ bool CFloatingDragPreview::eventFilter(QObject *watched, QEvent *event)
381
385
QKeyEvent* e = static_cast <QKeyEvent*>(event);
382
386
if (e->key () == Qt::Key_Escape)
383
387
{
384
- d-> Content ->removeEventFilter (this );
388
+ watched ->removeEventFilter (this );
385
389
d->cancelDragging ();
386
390
}
387
391
}
0 commit comments