summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-07 09:14:26 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-07 09:14:26 (GMT)
commita28dc778305cf67830f15119b29c5a77754a8c18 (patch)
tree34800c1bdb3743d28a9681c25685d583e1e025e1 /src/gui/widgets
parent07ba75cb8031b844484901bef903fb055cc0b182 (diff)
downloadQt-a28dc778305cf67830f15119b29c5a77754a8c18.zip
Qt-a28dc778305cf67830f15119b29c5a77754a8c18.tar.gz
Qt-a28dc778305cf67830f15119b29c5a77754a8c18.tar.bz2
QMenu: with tearoff handle, it would reserve the space for it twice
sizeHint is now fixed
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qmenu.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index af9ddf5..35b68b4 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -1355,8 +1355,7 @@ QMenu::~QMenu()
if (d->eventLoop)
d->eventLoop->exit();
- if (d->tornPopup)
- d->tornPopup->close();
+ hideTearOffMenu();
}
/*!
@@ -1567,8 +1566,8 @@ void QMenu::setTearOffEnabled(bool b)
Q_D(QMenu);
if (d->tearoff == b)
return;
- if (!b && d->tornPopup)
- d->tornPopup->close();
+ if (!b)
+ hideTearOffMenu();
d->tearoff = b;
d->itemsDirty = true;
@@ -1603,8 +1602,8 @@ bool QMenu::isTearOffMenuVisible() const
*/
void QMenu::hideTearOffMenu()
{
- if (d_func()->tornPopup)
- d_func()->tornPopup->close();
+ if (QWidget *w = d_func()->tornPopup)
+ w->close();
}
@@ -1719,8 +1718,6 @@ QSize QMenu::sizeHint() const
if (rect.right() >= s.width())
s.setWidth(rect.x() + rect.width());
}
- if (d->tearoff)
- s.rheight() += style()->pixelMetric(QStyle::PM_MenuTearoffHeight, &opt, this);
// 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.