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/Trellis
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/Trellis')
-rw-r--r--Swift/QtUI/Trellis/QtGridSelectionDialog.cpp11
-rw-r--r--Swift/QtUI/Trellis/QtGridSelectionDialog.h2
2 files changed, 6 insertions, 7 deletions
diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
index 1ca1953..fb9734d 100644
--- a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
+++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
@@ -68,6 +68,10 @@ QSize QtGridSelectionDialog::getMaxGridSize() const {
return maxGridSize;
}
+QSize QtGridSelectionDialog::getFrameSize() const {
+ return frameSize;
+}
+
void QtGridSelectionDialog::keyReleaseEvent(QKeyEvent* event) {
if (event) {
QSize newGridSize = currentGridSize;
@@ -133,13 +137,6 @@ 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;
- // 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);
}
diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.h b/Swift/QtUI/Trellis/QtGridSelectionDialog.h
index 557963d..3ccba55 100644
--- a/Swift/QtUI/Trellis/QtGridSelectionDialog.h
+++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.h
@@ -29,6 +29,8 @@ namespace Swift {
void setMaxGridSize(const QSize& size);
QSize getMaxGridSize() const;
+ QSize getFrameSize() const;
+
signals:
void currentGridSizeChanged(QSize);
void minGridSizeChanged(QSize);