Event processing control on Widget
-
Hi,
I'm working on a GIS app with Qt 5.6 and OpenGL.
I was working on migrating Qt from 4.8.4 to 5.6.
From this migration, I replaced QGLWidget with QOpenGLWidget.
But now, it seems that my QOpenGLWidget are starting to process event to early. It start to receive and process "mouseEntered" event before the component is ready to fully process it, and there is stuff I need to do on mouseEntered.
I need some help here to be able to disable event processing until everythings is ready and them re enable it.
Is it a way to do this in Qt ?
Regards,
Valerian
-
Event processing begins when
QApplication::exec()
is called, so do all of your setup before calling it. -
I can't. I can open dynamically open as much widget as needed. Each one are supposed to hold a view with a different image. All of them are opened during the execution.
Hi
its hard to guess at with no code but maybe you can move some of the init code to the views constructor?I assume you do something like
new View
setup viewto be even possible for it to get events before "Ready to fully process it"
Trying to pause event loop is not a good idea as its also used for drawing etc so it would be better to find out why it get events when u think its still being setup.
-
Hi !
Code is sadly too complex to be shown here in an understandable way.
Each view has some "tools" which has to be activated when the mouse enter the view, and has to be disabled when the mouse leave.
But when I create the QOpenGLWidget and call for show(), it receive a MouseEnteredEvent (even with setEnabled(false)).
This event is too early, so I cannot set my tool, and I've to get my mouse out the view and back in again to make it works as usual.I need to call for show() because the surface needs to be created, but I just need to know if it is possible to delay that first MouseEnteredEvent.
If it is not possible I'll try to find a workaround in my code.
-
Hi !
Code is sadly too complex to be shown here in an understandable way.
Each view has some "tools" which has to be activated when the mouse enter the view, and has to be disabled when the mouse leave.
But when I create the QOpenGLWidget and call for show(), it receive a MouseEnteredEvent (even with setEnabled(false)).
This event is too early, so I cannot set my tool, and I've to get my mouse out the view and back in again to make it works as usual.I need to call for show() because the surface needs to be created, but I just need to know if it is possible to delay that first MouseEnteredEvent.
If it is not possible I'll try to find a workaround in my code.
@kragnfrol
Maybe give it an event filter and control what events are allowed until ready ?