summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick D'Ademo <nickdademo@gmail.com>2018-12-07 15:12:07 +0800
committerNick D'Ademo <nickdademo@gmail.com>2018-12-13 12:45:47 +0000
commit3364be785930548bde2e6dfebe3aabed9e3f780d (patch)
tree49401195e59f6c4bd01d16b410fec3cfc55c9ea6
parente6d1071dd32d653f40c54df4141f7bd41aea7ea0 (diff)
QDockWidget: Make floating docks respect DockWidgetMovable feature
Currently, even if DockWidgetFeature::DockWidgetMovable is unset (i.e. moving docks to different dock areas is disabled), it is still possible to move a dock to a different dock area after it is made floating (i.e. the DockWidgetMovable setting is ignored). This change prevents this unexpected/inconsistent behavior. Fixes: QTBUG-71703 Change-Id: Iaecc293a5ba12dd5b53f5f0bd0cfe77ae54ab393 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--src/widgets/widgets/qdockwidget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 6c871aae2c..663225ebf3 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -922,7 +922,8 @@ bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event)
initDrag(event->pos(), false);
if (state)
- state->ctrlDrag = hasFeature(this, QDockWidget::DockWidgetFloatable) && event->modifiers() & Qt::ControlModifier;
+ state->ctrlDrag = (hasFeature(this, QDockWidget::DockWidgetFloatable) && event->modifiers() & Qt::ControlModifier) ||
+ (!hasFeature(this, QDockWidget::DockWidgetMovable) && q->isFloating());
return true;
}
@@ -1044,7 +1045,8 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event)
initDrag(event->pos(), true);
if (state == 0)
break;
- state->ctrlDrag = event->modifiers() & Qt::ControlModifier;
+ state->ctrlDrag = (event->modifiers() & Qt::ControlModifier) ||
+ (!hasFeature(this, QDockWidget::DockWidgetMovable) && q->isFloating());
startDrag();
break;
case QEvent::NonClientAreaMouseMove: