End the drag if the dockwidget is being hidden

When the window flags are changed for the widget then it is possible to
minimize the dockwidget via the titlebar. This will cause it to be ready
to start a drag internally but since the dockwidget never gets a mouse
release event it doesn't end it. Therefore it ends up being in an invalid
state later on when restored, so the endDrag() needs to happen in the hide
event to ensure this is not an issue later on.

Change-Id: Ia84bee96b9eed49896869e6a15d4de6d01964264
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Andy Shaw 2016-02-03 15:36:12 +01:00
parent 0026688285
commit 75b705fec8

View File

@ -1445,6 +1445,8 @@ bool QDockWidget::event(QEvent *event)
switch (event->type()) {
#ifndef QT_NO_ACTION
case QEvent::Hide:
if (d->state)
d->endDrag(true);
if (layout != 0)
layout->keepSize(this);
d->toggleViewAction->setChecked(false);