summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmenu.cpp
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-06 06:38:11 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-06 07:18:48 (GMT)
commit55c4f15df0d482c7d3d6c889b9fc132ed0bdd12a (patch)
tree99c01d7a4e0941f415e9a48f51faac94787b6cb0 /src/gui/widgets/qmenu.cpp
parent57ceb11ecf95032418712a686418116cf2398e7a (diff)
parentb008dfbd67176948f6fdf830dc99d23a538a6b9c (diff)
downloadQt-55c4f15df0d482c7d3d6c889b9fc132ed0bdd12a.zip
Qt-55c4f15df0d482c7d3d6c889b9fc132ed0bdd12a.tar.gz
Qt-55c4f15df0d482c7d3d6c889b9fc132ed0bdd12a.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: configure.exe doc/src/classes/qnamespace.qdoc examples/examples.pro src/corelib/kernel/qcoreevent.cpp src/corelib/kernel/qobject.cpp src/gui/kernel/qapplication.cpp src/gui/kernel/qstandardgestures.h src/gui/kernel/qwidget.cpp
Diffstat (limited to 'src/gui/widgets/qmenu.cpp')
-rw-r--r--src/gui/widgets/qmenu.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index f130a29..4b48fce 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -229,6 +229,10 @@ void QMenuPrivate::updateActionRects() const
const int hmargin = style->pixelMetric(QStyle::PM_MenuHMargin, 0, q),
vmargin = style->pixelMetric(QStyle::PM_MenuVMargin, 0, q),
icone = style->pixelMetric(QStyle::PM_SmallIconSize, 0, q);
+ const int fw = style->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
+
+ const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, 0, QApplication::globalStrut(), q).width() - QApplication::globalStrut().width();
+ const int min_column_width = q->minimumWidth() - (sfcMargin + leftmargin + rightmargin + 2 * (fw + hmargin));
//for compatability now - will have to refactor this away..
tabWidth = 0;
@@ -301,7 +305,7 @@ void QMenuPrivate::updateActionRects() const
if (!sz.isEmpty()) {
- max_column_width = qMax(max_column_width, sz.width());
+ max_column_width = qMax(min_column_width, qMax(max_column_width, sz.width()));
//wrapping
if (!scroll &&
y+sz.height()+vmargin > dh - (style->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q) * 2)) {
@@ -317,7 +321,6 @@ void QMenuPrivate::updateActionRects() const
max_column_width += tabWidth; //finally add in the tab width
//calculate position
- const int fw = style->pixelMetric(QStyle::PM_MenuPanelWidth, 0, q);
const int base_y = vmargin + fw + topmargin +
(scroll ? scroll->scrollOffset : 0) +
(tearoff ? style->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, q) : 0);
@@ -1710,9 +1713,7 @@ QSize QMenu::sizeHint() const
QSize s;
QStyleOption opt(0);
- opt.rect = rect();
- opt.palette = palette();
- opt.state = QStyle::State_None;
+ opt.init(this);
for (int i = 0; i < d->actionRects.count(); ++i) {
const QRect &rect = d->actionRects.at(i);
if (rect.isNull())