Results 1 to 6 of 6

Thread: PeekMessage

  1. #1
    Join Date
    Oct 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Red face PeekMessage

    hi I need the equivalent code of the below VC++ code in QT.

    while (::PeekMessage (&msg, NULL, 0, 0, PM_nn))
    {
    ::TranslateMessage (&msg);
    :ispatchMessage (&msg);
    }

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PeekMessage

    That's the event loop you're asking for.
    It can be replaced by QApplication::exec() or by a starting the event loop in a worker thread.

    BTW: you can't port an application line by line. maybe you can give more details such as the context in which those statements are used.

  3. #3
    Join Date
    Oct 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PeekMessage

    Actually i need to use this while iterating through a directory.

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PeekMessage

    Then maybe QCoreApplication::processEvents is more suitable

  5. #5
    Join Date
    Oct 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PeekMessage

    Thanks a lot

  6. #6
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PeekMessage

    Or much better - don't iterate over a directory but
    a) use QDir/QFileInfo
    b) use a QThread to not block the gui

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.