diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-06-26 10:24:07 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-06-26 13:48:50 (GMT) |
commit | aa02959061857f3a3e91ec09e14ae38c399b2810 (patch) | |
tree | 6c2780b0070bc0582ea7622e618102f25966f610 /src/gui | |
parent | bd7c123dc88908f41e6c0eccb9b03f9684e5ca27 (diff) | |
download | Qt-aa02959061857f3a3e91ec09e14ae38c399b2810.zip Qt-aa02959061857f3a3e91ec09e14ae38c399b2810.tar.gz Qt-aa02959061857f3a3e91ec09e14ae38c399b2810.tar.bz2 |
QMenu: Fixed a painting regression
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 20 | ||||
-rw-r--r-- | src/gui/widgets/qmenu_p.h | 1 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 2b098c0..ee00e61 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -381,14 +381,20 @@ QList<QAction *> QMenuPrivate::filteredActions() const QRect QMenuPrivate::actionRect(QAction *act) const { - Q_Q(const QMenu); - QRect ret; for (int i = 0; i < actionRects.count(); ++i) { - if (act == actionRects.at(i).action) { - ret = actionRects.at(i).rect; - break; //we found the action - } + if (act == actionRects.at(i).action) + return actionRect(i); //we found the action } + + return QRect(); +} + +QRect QMenuPrivate::actionRect(int index) const +{ + Q_ASSERT(index >= 0 || index < actionRects.count()); + + Q_Q(const QMenu); + QRect ret = actionRects.at(index).rect; if (ret.isNull()) return ret; if (scroll) @@ -2111,7 +2117,7 @@ void QMenu::paintEvent(QPaintEvent *e) //draw the items that need updating.. for (int i = 0; i < d->actionRects.count(); ++i) { QAction *action = d->actionRects.at(i).action; - QRect adjustedActionRect = d->actionRects.at(i).rect; + QRect adjustedActionRect = d->actionRect(i); if (!e->rect().intersects(adjustedActionRect) || d->widgetItems.value(action)) continue; diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index fef1ff9..e92eca0 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -155,6 +155,7 @@ public: mutable uint itemsDirty : 1; mutable uint maxIconWidth, tabWidth; QRect actionRect(QAction *) const; + QRect actionRect(int index) const; struct ActionRectInfo { QAction *action; |