summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorJoanna Hulboj <joanna.hulboj@isode.com>2017-01-16 11:03:28 (GMT)
committerJoanna Hulboj <joanna.hulboj@isode.com>2017-01-16 12:20:30 (GMT)
commita2acaebfb02879ce5907077381210885f5c41e48 (patch)
tree4a7a4dc4bd46bf9ea17565dc53dcea68b4fa91d9 /Swift
parent3b0cde2e6dbf26a01a59b0004e4041199731cbc8 (diff)
downloadswift-a2acaebfb02879ce5907077381210885f5c41e48.zip
swift-a2acaebfb02879ce5907077381210885f5c41e48.tar.bz2
Prevent cursor from jumping to the wrong position when using Change Layout dialog
Test-Information: Tested only on Windows with two monitors. Tested by opening Swift App on the first screen, next choose View->Change Layout, mouse cursor appears correctly on Change Layout dialog, next move Swift App to the second screen choose View->Change layout, mouse cursor appears correctly on Change Layout dialog. Change-Id: Ibb3e2ca1de6bcdb620104ff6b0940005ab85a827
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/Trellis/QtGridSelectionDialog.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
index f67a4b8..1ca1953 100644
--- a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
+++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
@@ -135,7 +135,11 @@ void QtGridSelectionDialog::paintEvent(QPaintEvent*) {
void QtGridSelectionDialog::showEvent(QShowEvent*) {
int xPos = horizontalMargin + frameSize.width() + (padding + frameSize.width()) * (currentGridSize.width() - 1) - frameSize.width()/2;
int yPos = verticalMargin + frameSize.height() + (padding + frameSize.height()) * (currentGridSize.height() - 1) - frameSize.height()/2;
- QCursor::setPos(mapToGlobal(QPoint(xPos, yPos)));
+ // Apply the above offset to the global cursor position (which was positioned at a known position before showing the widget):
+ QPoint pos = QCursor::pos();
+ pos.rx() += xPos;
+ pos.ry() += yPos;
+ QCursor::setPos(pos);
setMouseTracking(true);
}