Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 10

Qt-interest Archive, March 2002
unable set height for popup menu


Message 1 in thread

Hi all,

I have a popup menu, and a QListView inside this popup menu. the problem is
the height of popup menu always longer than that of QListView, making a
space below the QListView. see my code below, I tried setMaximumHeight and
setFixedHeight, neither seem to work, the popup menu just determine the
height by its own mean. how do I make the popup menu just the same height as
the QListView inside??


MemoryList = new QListView( NULL, "popup", 0 ); 
MemoryList->setMaximumWidth( 180 ); // this works ok
MemoryList->setMaximumHeight( 80 );   
QPopupMenu *pMenu = new QPopupMenu( this ); 
pMenu->setMaximumWidth( 180 ); 
pMenu->setMaximumHeight( 80 ); // also tried setFixedHeight(..), doesn't
work  
pMenu->insertItem( MemoryList ); 
PopupButton->setPopup( pMenu ); 
PopupButton->setPopupDelay( 0 );   


thanks
 ben