From 573f18421513021eee6b951b542574cdaf1e868a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 1 Nov 2012 22:51:03 -0500 Subject: Automated update from Qt3 --- src/widgets/qpopupmenu.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/widgets/qpopupmenu.cpp') 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 -- cgit v1.2.1