summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@nokia.com>2010-09-29 10:07:07 (GMT)
committerAndy Shaw <andy.shaw@nokia.com>2010-09-29 10:07:07 (GMT)
commit1f554a40c65fef249b8044246731a6de34eb90a1 (patch)
tree6949d0c10b4d8fc5bbad3b0b380ee5b7c14d4234
parent8050dc45c8c9a134875196dcddf010d4194fd974 (diff)
downloadQt-1f554a40c65fef249b8044246731a6de34eb90a1.zip
Qt-1f554a40c65fef249b8044246731a6de34eb90a1.tar.gz
Qt-1f554a40c65fef249b8044246731a6de34eb90a1.tar.bz2
Update frameGeometry when the unified toolbar visiblity is toggled
When the unified toolbar visiblity was toggled on Carbon then it would not have a correct frameGeometry as it would have a top position different to what it should have been as the window does not move. Autotest included in this commit. Task-number: QTBUG-14055 Reviewed-by: Prasanth
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm1
-rw-r--r--tests/auto/qmainwindow/tst_qmainwindow.cpp19
2 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 7d23abf..3945754 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -193,6 +193,7 @@ void macWindowToolbarShow(const QWidget *widget, bool show )
}
}
#else
+ qt_widget_private(const_cast<QWidget *>(widget))->updateFrameStrut();
ShowHideWindowToolbar(wnd, show, false);
#endif
}
diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp
index 5a69d9c..e427863 100644
--- a/tests/auto/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp
@@ -109,6 +109,7 @@ private slots:
void centralWidgetSize();
void dockWidgetSize();
void QTBUG2774_stylechange();
+ void toggleUnifiedTitleAndToolBarOnMac();
};
// Testing get/set functions
@@ -1747,6 +1748,24 @@ void tst_QMainWindow::QTBUG2774_stylechange()
}
}
+void tst_QMainWindow::toggleUnifiedTitleAndToolBarOnMac()
+{
+#ifdef Q_OS_MAC
+ QMainWindow mw;
+ QToolBar *tb = new QToolBar;
+ tb->addAction("Test");
+ mw.addToolBar(tb);
+ mw.setUnifiedTitleAndToolBarOnMac(true);
+ mw.show();
+ QRect frameGeometry = mw.frameGeometry();
+ mw.setUnifiedTitleAndToolBarOnMac(false);
+ QVERIFY(frameGeometry.topLeft() == mw.frameGeometry().topLeft());
+ mw.setUnifiedTitleAndToolBarOnMac(true);
+ QVERIFY(frameGeometry.topLeft() == mw.frameGeometry().topLeft());
+#else
+ QSKIP("Mac specific test", SkipAll);
+#endif
+}
QTEST_MAIN(tst_QMainWindow)