From 98b931a841f284051a2e22de412701bd2c4f4a76 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Wed, 20 Oct 2010 13:31:27 +0200 Subject: Fix autotest failure with experimental client deco The menu bar is in the outer layout, not the inner one --- src/gui/widgets/qmainwindow.cpp | 2 +- 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(d_func()->layout->menuBar()); + QMenuBar *menuBar = qobject_cast(layout()->menuBar()); if (!menuBar) { QMainWindow *self = const_cast(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(&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); } } -- cgit v0.12