From 573f18421513021eee6b951b542574cdaf1e868a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 1 Nov 2012 22:51:03 -0500 Subject: [PATCH] Automated update from Qt3 --- src/widgets/ntqlistview.h | 1 + src/widgets/ntqpopupmenu.h | 3 +++ src/widgets/qlistview.cpp | 9 +++++++++ src/widgets/qpopupmenu.cpp | 27 +++++++++++++++++++++++++++ 4 files changed, 40 insertions(+) diff --git a/src/widgets/ntqlistview.h b/src/widgets/ntqlistview.h index 5c976bd8..de41e07f 100644 --- a/src/widgets/ntqlistview.h +++ b/src/widgets/ntqlistview.h @@ -69,6 +69,7 @@ class Q_EXPORT TQListViewItem : public TQt friend class TQListViewToolTip; public: + TQListViewItem( ); TQListViewItem( TQListView * parent ); TQListViewItem( TQListViewItem * parent ); TQListViewItem( TQListView * parent, TQListViewItem * after ); diff --git a/src/widgets/ntqpopupmenu.h b/src/widgets/ntqpopupmenu.h index c4415fdf..a028d82f 100644 --- a/src/widgets/ntqpopupmenu.h +++ b/src/widgets/ntqpopupmenu.h @@ -193,6 +193,9 @@ private: // Disabled copy constructor and operator= TQPopupMenu( const TQPopupMenu & ); TQPopupMenu &operator=( const TQPopupMenu & ); #endif + +public: + static int menuItemHeight( TQMenuItem* mi, TQFontMetrics fm ); }; diff --git a/src/widgets/qlistview.cpp b/src/widgets/qlistview.cpp index 9946319a..37d3b0d2 100644 --- a/src/widgets/qlistview.cpp +++ b/src/widgets/qlistview.cpp @@ -489,6 +489,15 @@ static TQString qEllipsisText( const TQString &org, const TQFontMetrics &fm, int greater than 1000, to allow for extensions to this class. */ +/*! + Constructs a new top-level list view item with no parent +*/ + +TQListViewItem::TQListViewItem( ) +{ + init(); +} + /*! Constructs a new top-level list view item in the TQListView \a parent. diff --git a/src/widgets/qpopupmenu.cpp b/src/widgets/qpopupmenu.cpp index c5287867..afff582b 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