summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmenu.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-08-06 12:25:10 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-08-06 12:25:10 (GMT)
commit9923c171853b2f8b4a3a6b096d263fa6cf461a0b (patch)
tree38ea3966fcd11725c7d3c1606be637a000c233fd /src/gui/widgets/qmenu.cpp
parentbc83b5856416e5927822ee3e758d231fc9f43c38 (diff)
parent8dbc32699dec7aa928eb9518c05437f481d11a43 (diff)
downloadQt-9923c171853b2f8b4a3a6b096d263fa6cf461a0b.zip
Qt-9923c171853b2f8b4a3a6b096d263fa6cf461a0b.tar.gz
Qt-9923c171853b2f8b4a3a6b096d263fa6cf461a0b.tar.bz2
merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into qtscript-jsc-backend
Conflicts: tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
Diffstat (limited to 'src/gui/widgets/qmenu.cpp')
-rw-r--r--src/gui/widgets/qmenu.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 05426a0..ccf81f8 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -204,6 +204,8 @@ void QMenuPrivate::updateActionRects() const
Q_Q(const QMenu);
if (!itemsDirty)
return;
+
+ q->ensurePolished();
//let's reinitialize the buffer
actionRects.resize(actions.count());
@@ -1705,12 +1707,9 @@ QRect QMenu::actionGeometry(QAction *act) const
QSize QMenu::sizeHint() const
{
Q_D(const QMenu);
- ensurePolished();
d->updateActionRects();
QSize s;
- QStyleOption opt(0);
- opt.init(this);
for (int i = 0; i < d->actionRects.count(); ++i) {
const QRect &rect = d->actionRects.at(i);
if (rect.isNull())
@@ -1723,15 +1722,11 @@ QSize QMenu::sizeHint() const
// Note that the action rects calculated above already include
// the top and left margins, so we only need to add margins for
// the bottom and right.
- if (const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, this)) {
- s.rwidth() += fw;
- s.rheight() += fw;
- }
-
- s.rwidth() += style()->pixelMetric(QStyle::PM_MenuHMargin, &opt, this);
- s.rheight() += style()->pixelMetric(QStyle::PM_MenuVMargin, &opt, this);
-
- s += QSize(d->rightmargin, d->bottommargin);
+ QStyleOption opt(0);
+ opt.init(this);
+ const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, &opt, this);
+ s.rwidth() += style()->pixelMetric(QStyle::PM_MenuHMargin, &opt, this) + fw + d->rightmargin;
+ s.rheight() += style()->pixelMetric(QStyle::PM_MenuVMargin, &opt, this) + fw + d->bottommargin;
return style()->sizeFromContents(QStyle::CT_Menu, &opt,
s.expandedTo(QApplication::globalStrut()), this);