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

Qt-interest Archive, April 2007
QT4: "QToolButton: Menu in setMenu() overriding actions set in addAction!"


Message 1 in thread

Hi all,

I have this small code in my application:

  mp_newbtn = new QToolButton();
  mp_toolbar_new_menu = new QMenu();
  mp_toolbar_new_menu->addAction( mp_file_add_new_ping );
  mp_toolbar_new_menu->addAction( mp_file_add_new_trace );
  mp_toolbar_new_menu->addAction( mp_file_add_new_whois );
  mp_newbtn->setMenu( mp_toolbar_new_menu );
  mp_newbtn->setDefaultAction( mp_file_add_new_ping );
  mp_newbtn->setPopupMode( QToolButton::MenuButtonPopup );
  mp_filetoolbar->addWidget( mp_newbtn );

This of course adds a button to a toolbar with an arrow showing a menu 
with 3 actions. It works just fine except for one thing - whenever I bring
up the menu by clicking the arrow, I get this warning in the background:

QToolButton: Menu in setMenu() overriding actions set in addAction!

The functionality works just like expected - the actions are executed
properly. But I'm still worried by this warning. Any idea what could be
causing it?

T.S.

--
 [ signature omitted ]