QLayout: Observe contents margin when positioning the menu bar.
Task-number: QTBUG-38152 Change-Id: I53ea6bce33057251265a7eca1651aeabca314ba9 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
This commit is contained in:
parent
4958cadeda
commit
03c4b52e13
@ -576,11 +576,12 @@ void QLayoutPrivate::doResize(const QSize &r)
|
||||
int mbh = menuBarHeightForWidth(menubar, r.width());
|
||||
QWidget *mw = q->parentWidget();
|
||||
QRect rect = mw->testAttribute(Qt::WA_LayoutOnEntireRect) ? mw->rect() : mw->contentsRect();
|
||||
const int mbTop = rect.top();
|
||||
rect.setTop(rect.top() + mbh);
|
||||
q->setGeometry(rect);
|
||||
#ifndef QT_NO_MENUBAR
|
||||
if (menubar)
|
||||
menubar->setGeometry(0,0,r.width(), mbh);
|
||||
menubar->setGeometry(rect.left(), mbTop, r.width(), mbh);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -780,6 +780,9 @@ void tst_QMainWindow::contentsMargins()
|
||||
mw.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&mw));
|
||||
|
||||
QCOMPARE(mw.menuBar()->geometry().left(), contentsMargin);
|
||||
QCOMPARE(mw.menuBar()->geometry().top(), contentsMargin);
|
||||
|
||||
QCOMPARE(mw.statusBar()->geometry().left(), contentsMargin);
|
||||
QCOMPARE(mw.statusBar()->geometry().bottom() + 1, mw.height() - contentsMargin);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user