When QMessagBOx met with QGLWidget?
-
Hello everyone
Just now, i have come cross an small issue, i have tried hours, but without any effetcs. the problem descibes as follows:when i using QGLWidget to implement opengl funtions, in the overrided initializeGL() of my subclass , once i call QMessagebox::warning(this, "Title", "Content"); the messsage box cause the initializeGL function execute twice, and the box apears double too.
So, any can help? many thanks!
-
Hi, welcome to devnet.
That is strange indeed.
You can report a bug here: https://bugreports.qt-project.orgIt seems a strange place to deal with UI. It's intended for OpenGL initialization, not for interacting with the user.
The only "workaround" I can think of is just not calling the warning message in there. Maybe instead of a message box you could emit a custom warning signal and connect a queued slot that would show the message later on? -
[quote author="Chris Kawa" date="1415635477"]Maybe instead of a message box you could emit a custom warning signal and connect a queued slot that would show the message later on?[/quote]
Or good old QTimer::singleShot();
-
Hi and welcome to devnet,
While I agree with Chris Kawa about the strangeness, I'd say that it's also not the right place to put a dialog, initializeGL's role is to setup OpenGL for your widget