[Qt-interest] QEventLoop and QEvents

Eric Clark eclark at ara.com
Fri Feb 19 22:23:01 CET 2010



> -----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 2:52 PM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QEventLoop and QEvents
> 
> On 19.02.10 19:21:07, Eric Clark wrote:
> > 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?
> 
> Yes, but even then things might not work as you expect as Qt handles
> application-created and posted events differently from those coming
> from
> the user (see QEvent::spontaneous). So even posting the event later
> might not work.

Yes, I understand the difference between spontaneous and non-spontaneous events. And
I did attempt to make a copy of the event and, of course, like you said, it did not work. Maybe
related to the spontaneous flag, not sure though. I did have this stuff working with my own
implementation where I just stored an array of functions to call once it was time to process those
events, but the functions were things like LeftClick(), RightClick(), etc. The problem with
this implementation is that I need more information about the event than just it was a 
left-click. I need the rest of the information as well, mouse position, buttons pressed, and
modifiers that were held down. Since the QMouseEvent class stores all of this, I thought it
would make sense to use the QMouseEvent class along with a QEventLoop to store and process the
events, but it is becoming quite the burden since no one on this interest board seems to
have any ideas. I would love to use Qt classes to do this, but I think I am not using them
the way they were intended to be used. It looks like I may just have to make my own data
structure that stores the same data as QMouseEvent and pass that into the functions.

I am really open to suggestions from anyone that has any ideas related to Qt. One person did
attempt to give me a solution using boost, but I do not want to use boost, I know that this can
be done with Qt, at least I would hope that it could be, I just am not sure I am approaching it
the right way.


> 
> Andreas
> 
> --
> Generosity and perfection are your everlasting goals.
> _______________________________________________
> 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