diff options
-rw-r--r-- | src/gui/widgets/qmainwindow.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qmainwindow/tst_qmainwindow.cpp | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index d971f61..2731182 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -504,7 +504,7 @@ void QMainWindow::setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle) */ QMenuBar *QMainWindow::menuBar() const { - QMenuBar *menuBar = qobject_cast<QMenuBar *>(d_func()->layout->menuBar()); + QMenuBar *menuBar = qobject_cast<QMenuBar *>(layout()->menuBar()); if (!menuBar) { QMainWindow *self = const_cast<QMainWindow *>(this); menuBar = new QMenuBar(self); diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index e427863..c82c566 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -701,10 +701,12 @@ void tst_QMainWindow::statusBar() // deleting the status bar should remove it from the main window QMainWindow mw; QStatusBar *sb = mw.statusBar(); - int indexOfSb = mw.layout()->indexOf(sb); + QMainWindowLayout *l = qFindChild<QMainWindowLayout *>(&mw); + QVERIFY(l); + int indexOfSb = l->indexOf(sb); QVERIFY(indexOfSb != -1); delete sb; - indexOfSb = mw.layout()->indexOf(sb); + indexOfSb = l->indexOf(sb); QVERIFY(indexOfSb == -1); } } |