summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-02-18 15:19:41 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-20 06:39:03 +0100
commitdd30f3e65b7fb56f64c992dc5f341a9c5dba6c07 (patch)
tree583b4084ce15432ffc0f18d89ff7f1e8689abfe6
parent2f5b4d47f6da4702dc6bfd411289aedf612bed6a (diff)
Fix QDockWidget being unable to dock when initially floating.
When setFloating(true) is called before show, frame strut events are not enabled for the native window (since there is none yet) in QDockWidgetPrivate::setWindowState(). In that case, do it in the show event handling. Task-number: QTBUG-29012 Change-Id: I93b679f20200c149d608a1bcc65b4936a035c6a0 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
-rw-r--r--src/widgets/widgets/qdockwidget.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index c5694d9d8c..a2e363f991 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1000,6 +1000,14 @@ void QDockWidgetPrivate::plug(const QRect &rect)
setWindowState(false, false, rect);
}
+static void setFrameStrutEventsEnabled(const QWidget *w, bool enabled)
+{
+ if (const QWindow *window = w->windowHandle())
+ if (QPlatformWindow *platformWindow = window->handle())
+ if (platformWindow->frameStrutEventsEnabled() != enabled)
+ platformWindow->setFrameStrutEventsEnabled(enabled);
+}
+
void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect &rect)
{
Q_Q(QDockWidget);
@@ -1053,9 +1061,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
}
if (floating && nativeDeco)
- if (const QWindow *window = q->windowHandle())
- if (QPlatformWindow *platformWindow = window->handle())
- platformWindow->setFrameStrutEventsEnabled(true);
+ setFrameStrutEventsEnabled(q, true);
resizer->setActive(QWidgetResizeHandler::Resize, !unplug && floating && !nativeDeco);
}
@@ -1391,6 +1397,8 @@ bool QDockWidget::event(QEvent *event)
emit visibilityChanged(false);
break;
case QEvent::Show:
+ if (static_cast<QDockWidgetLayout *>(QDockWidget::layout())->nativeWindowDeco(isFloating()))
+ setFrameStrutEventsEnabled(this, true);
d->toggleViewAction->setChecked(true);
emit visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0);
break;