[Qt-interest] QEventLoop and QEvents

Eric Clark eclark at ara.com
Fri Feb 19 20:21:07 CET 2010


When I say that it is a little bit of time, it is milliseconds. This is how it HAS to work. Without going into great detail, this particular widget is a GLWidget. There is an active 3D simulation going on in the widget and when you click on the widget, a 3D ray-trace is performed to find the 3D object that was clicked on. During the active simulation, there are events that happen that cause manipulation of the 3D objects, such as cutting holes in the objects, or possibly removing the object from the viewer all together. The simulation runs on a separate thread than the GUI and as such, it is VERY unsafe to allow the ray-trace to happen while the simulation is active. Instead, the 3D viewer reacts to mouse events when it repaints. During repainting of the GLWidget, the simulation is temporarily paused and any events that occurred between painting will also be processed. Believe me, I know what I am doing as far as deferring the events. The time between repaints is so fast that no user will ever notice the delay in reaction of a mouse click. Not only that, what happens when you click on an object is that it gets highlighted in the 3D viewer, this highlighting would even be ok if it did take longer than normal, but the reaction time now is on the order of milliseconds and no human eye can possibly see the delay.

Now that everyone knows what is really going on. I would love for someone to answer my question. Is there any way to tell Qt to not delete the event? Or do I need to make a copy of the event?

Eric

> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Andreas Pakulat
> Sent: Friday, February 19, 2010 11:40 AM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QEventLoop and QEvents
> 
> On 19.02.10 16:41:58, Eric Clark wrote:
> > Sorry to reply to my own post, but I have determined that the event
> is
> > being deleted before my event loop can execute it. Does anyone know
> of
> > a way to keep Qt from deleting the event?
> 
> No and IMHO your approach is wrong. If your widget is not ready for
> usage it shouldn't be shown in the GUI or accept GUI events. The latter
> can be achieved by overriding the relevant event-handling functions in
> a
> subclass and ignore the event. Then once the widget is ready it can
> call
> the base-class implementation of the event-handlers. A widget where I
> click on and it doesn't react, but 5 seconds later it suddenly does
> something is not very usable - IMHO.
> 
> Andreas
> 
> --
> You will inherit some money or a small piece of land.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list