diff options
author | Darrell Anderson <[email protected]> | 2012-11-02 17:25:22 -0500 |
---|---|---|
committer | Darrell Anderson <[email protected]> | 2012-11-02 17:25:22 -0500 |
commit | f7873ac3368532ee4ab09e77e5112d7b6b1a8069 (patch) | |
tree | 017ba371afaf0aa399de342c43bd06ff8cdff2c7 /src/widgets/qpopupmenu.cpp | |
parent | 0a232e5b3c2875e68d97be690beec7da1ccc65ba (diff) | |
parent | 180abfff4d31bc8db66fea92cf070ff21b7a5e2f (diff) | |
download | qt3-f7873ac3368532ee4ab09e77e5112d7b6b1a8069.tar.gz qt3-f7873ac3368532ee4ab09e77e5112d7b6b1a8069.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/qt3
Diffstat (limited to 'src/widgets/qpopupmenu.cpp')
-rw-r--r-- | src/widgets/qpopupmenu.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/widgets/qpopupmenu.cpp b/src/widgets/qpopupmenu.cpp index f20cbfc..086c423 100644 --- a/src/widgets/qpopupmenu.cpp +++ b/src/widgets/qpopupmenu.cpp @@ -2882,5 +2882,32 @@ QPopupMenu::updateScrollerState() d->scroll.topScrollableIndex++; } +/*! + Calculates the height in pixels of the menu item \a mi. +*/ +int QPopupMenu::menuItemHeight( QMenuItem *mi, QFontMetrics fm ) +{ + if ( mi->widget() ) + return mi->widget()->height(); + if ( mi->custom() && mi->custom()->fullSpan() ) + return mi->custom()->sizeHint().height(); + + int h = 0; + if ( mi->isSeparator() ) // separator height + h = 2; + else if ( mi->pixmap() ) // pixmap height + h = mi->pixmap()->height(); + else // text height + h = fm.height(); + + if ( !mi->isSeparator() && mi->iconSet() != 0 ) + h = QMAX(h, mi->iconSet()->pixmap( QIconSet::Small, + QIconSet::Normal ).height()); + if ( mi->custom() ) + h = QMAX(h, mi->custom()->sizeHint().height()); + + return h; +} + #endif // QT_NO_POPUPMENU |