summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-09-09 13:10:37 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-16 14:15:06 +0200
commit26ddb586acd49834c7cffac781ce504ec78635cc (patch)
tree9395d60b9df150d383b2cc315875e159db69695b
parent63b6a9e6e451d1095bc624e99e82738e2f26e3be (diff)
xcb: QWindow never uses XCB_GRAVITY_CENTER
Center gravity doesn't mean center the window, it only affects the method of converting between internal window bounds and decorated bounds. So wanting to have each dialog centered w.r.t. its transient parent is not a reason for using center gravity. Instead it caused the bug that when you resize a QMessageBox by clicking the Show Details button, it jumps downwards on the screen. Task-number: QTBUG-32473 Change-Id: I3fabf3caa1e4d10fd4f7508e297f73efe5cc51b6 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp4
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp45
2 files changed, 45 insertions, 4 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 028cd9ab72..37b96fc391 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -646,7 +646,6 @@ void QXcbWindow::show()
if (!transientXcbParent)
transientXcbParent = static_cast<QXcbScreen *>(screen())->clientLeader();
if (transientXcbParent) { // ICCCM 4.1.2.6
- m_gravity = XCB_GRAVITY_CENTER;
Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32,
1, &transientXcbParent));
@@ -1302,9 +1301,6 @@ QRect QXcbWindow::windowToWmGeometry(QRect r) const
r.translate(m_frameMargins.left(), m_frameMargins.top());
} else if (!frameInclusive && m_gravity == XCB_GRAVITY_NORTH_WEST) {
r.translate(-m_frameMargins.left(), -m_frameMargins.top());
- } else if (!frameInclusive && m_gravity == XCB_GRAVITY_CENTER) {
- r.translate(-(m_frameMargins.left() - m_frameMargins.right())/2,
- -(m_frameMargins.top() - m_frameMargins.bottom())/2);
}
return r;
}
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index c3faa93309..0425db3098 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -114,6 +114,7 @@ private slots:
void about();
void detailsText();
void detailsButtonText();
+ void expandDetails_QTBUG_32473();
#ifndef Q_OS_MAC
void shortcut();
@@ -137,6 +138,19 @@ private:
QTimer keySendTimer;
};
+class tst_ResizingMessageBox : public QMessageBox
+{
+public:
+ tst_ResizingMessageBox() : QMessageBox(), resized(false) { }
+ bool resized;
+
+protected:
+ void resizeEvent ( QResizeEvent * event ) {
+ resized = true;
+ QMessageBox::resizeEvent(event);
+ }
+};
+
tst_QMessageBox::tst_QMessageBox() : keyToSend(-1)
{
}
@@ -603,6 +617,37 @@ void tst_QMessageBox::detailsButtonText()
}
}
+void tst_QMessageBox::expandDetails_QTBUG_32473()
+{
+ tst_ResizingMessageBox box;
+ box.setDetailedText("bla");
+ box.show();
+ QApplication::postEvent(&box, new QEvent(QEvent::LanguageChange));
+ QApplication::processEvents();
+ QDialogButtonBox* bb = box.findChild<QDialogButtonBox*>("qt_msgbox_buttonbox");
+ QVERIFY(bb);
+
+ QList<QAbstractButton *> list = bb->buttons();
+ QAbstractButton* moreButton = NULL;
+ foreach (QAbstractButton* btn, list)
+ if (btn && bb->buttonRole(btn) == QDialogButtonBox::ActionRole)
+ moreButton = btn;
+ QVERIFY(moreButton);
+ QVERIFY(QTest::qWaitForWindowExposed(&box));
+ QRect geom = box.geometry();
+ box.resized = false;
+ moreButton->click();
+ QTRY_VERIFY(box.resized);
+ // After we receive the expose event for a second widget, it's likely
+ // that the window manager is also done manipulating the first QMessageBox.
+ QWidget fleece;
+ fleece.show();
+ QTest::qWaitForWindowExposed(&fleece);
+ if (geom.topLeft() == box.geometry().topLeft())
+ QTest::qWait(500);
+ QCOMPARE(geom.topLeft(), box.geometry().topLeft());
+}
+
void tst_QMessageBox::incorrectDefaultButton()
{
keyToSend = Qt::Key_Escape;