summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoanna Hulboj <joanna.hulboj@isode.com>2017-01-12 11:10:23 (GMT)
committerJoanna Hulboj <joanna.hulboj@isode.com>2017-01-18 10:39:02 (GMT)
commitfa068e62cbf70d93296de7887cbcfdda5d36d2b2 (patch)
tree8993c4d5bddb7446dcd675f522af73c519e3db44 /Swift/QtUI/QtChatTabs.cpp
parente649c54daa666c99d2f934b223acd0262c05e11a (diff)
downloadswift-fa068e62cbf70d93296de7887cbcfdda5d36d2b2.zip
swift-fa068e62cbf70d93296de7887cbcfdda5d36d2b2.tar.bz2
Set cursor position to the center of the screen to show layout window in the middle of the screen
Test-Information: Tested with multiple screen setup. Tested only on Windows. From view menu choose "Change Layout", the layout window appears in the middle of the screen. Change-Id: Iab4ba64d54766426be39926773aa5b5bb628b9e9
Diffstat (limited to 'Swift/QtUI/QtChatTabs.cpp')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index 3241858..de9d2d2 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -19,6 +19,7 @@
#include <QTabBar>
#include <QTabWidget>
#include <QtGlobal>
+#include <QWindow>
#include <Swiften/Base/Log.h>
@@ -372,9 +373,16 @@ void QtChatTabs::flash() {
void QtChatTabs::handleOpenLayoutChangeDialog() {
disconnect(gridSelectionDialog_, SIGNAL(currentGridSizeChanged(QSize)), dynamicGrid_, SLOT(setDimensions(QSize)));
gridSelectionDialog_->setCurrentGridSize(dynamicGrid_->getDimension());
- gridSelectionDialog_->move(QCursor::pos());
+
+ int screen = QApplication::desktop()->screenNumber(QCursor::pos());
+ QPoint center = QApplication::desktop()->screenGeometry(screen).center();
+ gridSelectionDialog_->move(center);
+
connect(gridSelectionDialog_, SIGNAL(currentGridSizeChanged(QSize)), dynamicGrid_, SLOT(setDimensions(QSize)));
gridSelectionDialog_->show();
+
+ QPoint pos(gridSelectionDialog_->getFrameSize().width() / 2, gridSelectionDialog_->getFrameSize().height() / 2);
+ QCursor::setPos(gridSelectionDialog_->windowHandle()->screen(), gridSelectionDialog_->mapToGlobal(QPoint(gridSelectionDialog_->width(), gridSelectionDialog_->height()) - pos));
}
void QtChatTabs::storeTabPositions() {