Results 1 to 6 of 6

Thread: How to suppress user defined events in processEvents()

  1. #1
    Join Date
    Jan 2006
    Location
    Germany, Rostock
    Posts
    17
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to suppress user defined events in processEvents()

    We've got some problems with widget repainting and user defined events generated by the underlaying process.

    That's the situation:

    1. Some event handling causes to change the appereance of a dialog (includeing call to update()). This will get visible during a subsequent event processing of the corresponding painting event.
    2. Some thread of the underlaying process is posting application specific events (of type QEvent::User) to the GUI thread. This forces the main thread to start a more or less expensive handling.


    Unfortunately, the application events may delay the re-painting if they are posted just before the update() call.

    To re-draw that widget as soon as possible I'm calling processEvents() during the event handler routine. But, how can I suppress the delivery of the application events along with the user input events (as defined by QEventLoop::ExcludeUserInputEvents) when calling processEvents()

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to suppress user defined events in processEvents()

    You can always subclass QCoreApplication::notify() or QCoreApplication::event() (or apply an event filter on the application object) and do the filtering there.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany, Rostock
    Posts
    17
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to suppress user defined events in processEvents()

    Quote Originally Posted by wysota View Post
    You can always subclass QCoreApplication::notify() or QCoreApplication::event() (or apply an event filter on the application object) and do the filtering there.
    Well. But filtering events this way will consume all events. However, I want to keep the user defined ones in the event queue for later processing (in the main event loop).

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to suppress user defined events in processEvents()

    You can't put your own custom events "on hold" if processEvents() doesn't support that. You can only discard an event by filtering it out.

  5. #5
    Join Date
    Jan 2006
    Location
    Germany, Rostock
    Posts
    17
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Re: How to suppress user defined events in processEvents()

    Quote Originally Posted by wysota View Post
    You can't put your own custom events "on hold" if processEvents() doesn't support that. You can only discard an event by filtering it out.
    That's a pity

    If there is somebody from the developer team is watching this thread ...

    Wouldn't it be nice to have a new ProcessEventsFlag ExcludeUserDefinedEvents, which suppresses external influences in a way like ExcludeUserInputEvents and ExcludeSocketNotifiers do?

    This supports a more strict separation of GUI related and process/application related parts even in an event driven design.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to suppress user defined events in processEvents()

    http://www.trolltech.com/developer/tasktracker

    BTW. I believe it is still doable using QCoreApplication::notify(), but it might not be worth the effort.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.