From 616469bb760fc7f751b3fc103f3584f14d3e2d0d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 15 Jul 2014 16:21:13 +0200 Subject: [PATCH] QMainWindow:::restoreDockWidget(): Restore to correct screen. Use the placeholder top level geometry to determine the screen. Task-number: QTBUG-40155 Change-Id: If56b239200e9daf754b0963574367cf7891c5f40 Reviewed-by: Giuseppe D'Angelo --- src/widgets/widgets/qdockarealayout.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 066b3c7a86..5a40ceb2f7 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -44,6 +44,7 @@ #include "QtWidgets/qtabbar.h" #include "QtWidgets/qstyle.h" #include "QtWidgets/qdesktopwidget.h" +#include "QtWidgets/qapplication.h" #include "QtCore/qvariant.h" #include "qdockarealayout_p.h" #include "qdockwidget.h" @@ -2978,8 +2979,9 @@ bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget) item.widgetItem = new QDockWidgetItem(dockWidget); if (placeHolder->window) { - QDesktopWidget desktop; - QRect r = constrainedRect(placeHolder->topLevelRect, desktop.screenGeometry(dockWidget)); + const QRect screenGeometry = + QApplication::desktop()->screenGeometry(placeHolder->topLevelRect.center()); + const QRect r = constrainedRect(placeHolder->topLevelRect, screenGeometry); dockWidget->d_func()->setWindowState(true, true, r); } dockWidget->setVisible(!placeHolder->hidden);