January 17, 2012

scumpyt scumpyt
Lab Rat
26 posts

How to programatically popup one of the QMenu’s on my QMainWindow QMenuBar???

 

I have a QMainWindow, with a normal QMenuBar (containing 2 QMenu’s: “File” and “Help”)

When the application starts, I would like to programatically popup the “File” menu…

What is the best way to do this?

I have tried show() and raise(), and setVisible(true), etc…

The only thing that I can get working is to call:

menuFile->popup(QWidget::mapToParent(QPoint(0,21)));

But that is questionable in that if I even move that menu in the menubar, it may not popup where it’s suppose to…

Any better ideas? I’m sure I’m missing something obvious, but it’s minus 30 degrees here today, and my brain is probably frozen…

Thanks in advance,

Wayne

2 replies

January 18, 2012

Alexander Kuchumov Alexander Kuchumov
Lab Rat
378 posts

It’s not good idea to show popup menu after start. It will be better to show wizard with menu items after start program. But you can try to call QAction::activate ( ActionEvent event ) for this menu QAction.

January 18, 2012

scumpyt scumpyt
Lab Rat
26 posts

Alexander,

Your idea of a wizard does sound like a better way to go. I’m going to implement that.

Thanks for your time…

Wayne

 
  ‹‹ addSpacing(): something better than pixels?      Custom-context-QGLWidget causes problems ››

You must log in to post a reply. Not a member yet? Register here!