Results 1 to 6 of 6

Thread: How to log returning control back to the main event loop?

  1. #1
    Join Date
    May 2009
    Posts
    133
    Thanks
    10
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default How to log returning control back to the main event loop?

    Is there any way to log when program returns control back to the main event loop?

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

    Default Re: How to log returning control back to the main event loop?

    You can reimplement QCoreApplication::notify() which is a method called for every event dispatch in your application. An alternative is to install an event filter on the application object which gives you a similar possibility just without subclassing.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2009
    Posts
    133
    Thanks
    10
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to log returning control back to the main event loop?

    typedef QCoreApplication::EventFilter
    A function with the following signature that can be used as an event filter:
    bool myEventFilter(void *message, long *result);
    I guess every message should have at least some kind of an id. Is there any way to get message's id from message argument on Windows?

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

    Default Re: How to log returning control back to the main event loop?

    This is for Windows events... If you want Qt events, use QObject::installEventFilter() and QObject::eventFilter().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2009
    Posts
    133
    Thanks
    10
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to log returning control back to the main event loop?

    Quote Originally Posted by wysota View Post
    You can reimplement QCoreApplication::notify() which is a method called for every event dispatch in your application. An alternative is to install an event filter on the application object which gives you a similar possibility just without subclassing.
    Let's say I'm interested in logging the fact of entering the main event loop only. I'm not interested in what and how many events are processed after entering the loop. Any idea how to go about implementing this?

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

    Default Re: How to log returning control back to the main event loop?

    A full implementation would require reimplementing QAbstractEventDispatcher::processEvents() but I assume you wouldn't like to do that thus it's best to track event dispatching as suggested.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 3
    Last Post: 31st August 2009, 22:50
  2. Main Thread Event loop
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2007, 12:10
  3. Replies: 12
    Last Post: 14th June 2006, 09:24
  4. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55
  5. While statement inside the main loop
    By OnionRingOfDoom in forum Qt Programming
    Replies: 4
    Last Post: 8th February 2006, 18:17

Tags for this Thread

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.