summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qdockwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qdockwidget.cpp')
-rw-r--r--src/gui/widgets/qdockwidget.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index 54189de..11f0a94 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -1269,12 +1269,11 @@ void QDockWidget::setFloating(bool floating)
QRect r = d->undockedGeometry;
d->setWindowState(floating, false, floating ? r : QRect());
+
if (floating && r.isNull()) {
- QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(this->layout());
- QRect titleArea = layout->titleArea();
- int h = layout->verticalTitleBar ? titleArea.width() : titleArea.height();
- QPoint p = mapToGlobal(QPoint(h, h));
- move(p);
+ if (x() < 0 || y() < 0) //may happen if we have been hidden
+ move(QPoint());
+ setAttribute(Qt::WA_Moved, false); //we want it at the default position
}
}