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 <giuseppe.dangelo@kdab.com>
This commit is contained in:
Friedemann Kleint 2014-07-15 16:21:13 +02:00
parent 25978c7f9e
commit 616469bb76

View File

@ -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 ** Contact: http://www.qt-project.org/legal
** **
** This file is part of the QtWidgets module of the Qt Toolkit. ** This file is part of the QtWidgets module of the Qt Toolkit.
@ -44,6 +44,7 @@
#include "QtWidgets/qtabbar.h" #include "QtWidgets/qtabbar.h"
#include "QtWidgets/qstyle.h" #include "QtWidgets/qstyle.h"
#include "QtWidgets/qdesktopwidget.h" #include "QtWidgets/qdesktopwidget.h"
#include "QtWidgets/qapplication.h"
#include "QtCore/qvariant.h" #include "QtCore/qvariant.h"
#include "qdockarealayout_p.h" #include "qdockarealayout_p.h"
#include "qdockwidget.h" #include "qdockwidget.h"
@ -2978,8 +2979,9 @@ bool QDockAreaLayout::restoreDockWidget(QDockWidget *dockWidget)
item.widgetItem = new QDockWidgetItem(dockWidget); item.widgetItem = new QDockWidgetItem(dockWidget);
if (placeHolder->window) { if (placeHolder->window) {
QDesktopWidget desktop; const QRect screenGeometry =
QRect r = constrainedRect(placeHolder->topLevelRect, desktop.screenGeometry(dockWidget)); QApplication::desktop()->screenGeometry(placeHolder->topLevelRect.center());
const QRect r = constrainedRect(placeHolder->topLevelRect, screenGeometry);
dockWidget->d_func()->setWindowState(true, true, r); dockWidget->d_func()->setWindowState(true, true, r);
} }
dockWidget->setVisible(!placeHolder->hidden); dockWidget->setVisible(!placeHolder->hidden);