diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-10-28 10:31:33 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-10-28 10:33:29 (GMT) |
commit | 44f8fac4e2fc4a4258b921ac595c2826ca96e99c (patch) | |
tree | 2eb123b1b431ca43bcf3a681ebc04d7fd5a98c22 /src/gui/widgets | |
parent | 42fdaf078b9332e13d260df00359e8adc8522872 (diff) | |
download | Qt-44f8fac4e2fc4a4258b921ac595c2826ca96e99c.zip Qt-44f8fac4e2fc4a4258b921ac595c2826ca96e99c.tar.gz Qt-44f8fac4e2fc4a4258b921ac595c2826ca96e99c.tar.bz2 |
Double-clicking a dock widget titlebar could make it disappear
If it wasn't already docked on a mainwindow, its state would become
unexpected.
Task-number: QTBUG-945
Reviewed-by: gabi
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qdockwidget.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp index 6710275..a8e2a37 100644 --- a/src/gui/widgets/qdockwidget.cpp +++ b/src/gui/widgets/qdockwidget.cpp @@ -685,8 +685,6 @@ void QDockWidgetPrivate::_q_toggleTopLevel() void QDockWidgetPrivate::initDrag(const QPoint &pos, bool nca) { - Q_Q(QDockWidget); - if (state != 0) return; @@ -694,8 +692,6 @@ void QDockWidgetPrivate::initDrag(const QPoint &pos, bool nca) Q_ASSERT(win != 0); QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout()); Q_ASSERT(layout != 0); - if (layout->layoutState.indexOf(q).isEmpty()) //The dock widget has not been added into the main window - return; if (layout->pluggingWidget != 0) // the main window is animating a docking operation return; @@ -1012,6 +1008,12 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect { Q_Q(QDockWidget); + if (!floating && parent) { + QMainWindowLayout *mwlayout = qobject_cast<QMainWindowLayout *>(q->parentWidget()->layout()); + if (!mwlayout || mwlayout->dockWidgetArea(q) == Qt::NoDockWidgetArea) + return; // this dockwidget can't be redocked + } + bool wasFloating = q->isFloating(); bool hidden = q->isHidden(); |