summaryrefslogtreecommitdiffstats
path: root/src/widgets/qpopupmenu.cpp
diff options
context:
space:
mode:
authorDarrell Anderson <humanreadable@yahoo.com>2012-11-02 15:27:42 -0500
committerDarrell Anderson <humanreadable@yahoo.com>2012-11-02 15:27:42 -0500
commit1ae1be3065a315252a7dfac96a9c981ed6727ae6 (patch)
treec4d51d9066fd845714fe305c9709c33db8073998 /src/widgets/qpopupmenu.cpp
parent308537cb0eb307820f385f38c55dc1ccc47b343b (diff)
parent573f18421513021eee6b951b542574cdaf1e868a (diff)
downloadtqt-1ae1be3065a315252a7dfac96a9c981ed6727ae6.tar.gz
tqt-1ae1be3065a315252a7dfac96a9c981ed6727ae6.zip
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tqt3
Diffstat (limited to 'src/widgets/qpopupmenu.cpp')
-rw-r--r--src/widgets/qpopupmenu.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/widgets/qpopupmenu.cpp b/src/widgets/qpopupmenu.cpp
index c52878679..afff582b5 100644
--- a/src/widgets/qpopupmenu.cpp
+++ b/src/widgets/qpopupmenu.cpp
@@ -2882,5 +2882,32 @@ TQPopupMenu::updateScrollerState()
d->scroll.topScrollableIndex++;
}
+/*!
+ Calculates the height in pixels of the menu item \a mi.
+*/
+int TQPopupMenu::menuItemHeight( TQMenuItem *mi, TQFontMetrics 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 = TQMAX(h, mi->iconSet()->pixmap( TQIconSet::Small,
+ TQIconSet::Normal ).height());
+ if ( mi->custom() )
+ h = TQMAX(h, mi->custom()->sizeHint().height());
+
+ return h;
+}
+
#endif // QT_NO_POPUPMENU