diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qdockwidget.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 548078098c..5016235755 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -970,13 +970,27 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event) && mwlayout->pluggingWidget == nullptr && (event->position().toPoint() - state->pressPos).manhattanLength() > QApplication::startDragDistance()) { - startDrag(); - q->grabMouse(); - ret = true; + +#ifdef Q_OS_MACOS + if (windowHandle()) { + // When using native widgets on mac, we have not yet been successful in + // starting a drag on an NSView that belongs to one window (QMainWindow), + // but continue the drag on another (QDockWidget). This is what happens if + // we try to make this widget floating during a drag. So as a fall back + // solution, we simply make this widget floating instead, when we would + // otherwise start a drag. + q->setFloating(true); + } else +#endif + { + startDrag(); + q->grabMouse(); + ret = true; + } } } - if (state->dragging && !state->nca) { + if (state && state->dragging && !state->nca) { QMargins windowMargins = q->window()->windowHandle()->frameMargins(); QPoint windowMarginOffset = QPoint(windowMargins.left(), windowMargins.top()); QPoint pos = event->globalPosition().toPoint() - state->pressPos - windowMarginOffset; |