PDA

View Full Version : Pop up menus disappear on repaint events



GimpMaster
23rd December 2010, 17:57
I have a couple buttons that pop up a menu when clicked. I also have a qwt graph that is directly below the buttons. Sometimes when a user clicks a button the pop up menu will only flash briefly then get hidden (I assume when the graph repaints over it). This causes the user to have to click the button multiple times until the timing is just right.

This same problem happens when you right click on the program in the Windows Taskbar. The system menu may show or may not show depending on what is getting drawn/updated at the time.

Any thoughts on how to fix this?

Thanks

franz
27th December 2010, 07:31
I've seen behavior like this which was directly related to the Unpredictable Exec (http://labs.qt.nokia.com/2010/02/23/unpredictable-exec/) blog post.

Short summary, stop using QDialog::exec() and start using open() or show().

GimpMaster
27th December 2010, 17:23
Yeah i'm just using the default main() function that Visual Studio created.



QApplication a(argc, argv);
MainWidget w;
w.show();
return a.exec();


Is there a problem with doing that? The other thing is I'm using 4.6.0 Qt, so maybe this has already been fixed?