PDA

View Full Version : PeekMessage



AnithaRagupathy
19th October 2007, 07:58
hi I need the equivalent code of the below VC++ code in QT.

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

marcel
19th October 2007, 08:00
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.

AnithaRagupathy
19th October 2007, 08:04
Actually i need to use this while iterating through a directory.

marcel
19th October 2007, 08:12
Then maybe QCoreApplication::processEvents is more suitable

AnithaRagupathy
19th October 2007, 08:33
Thanks a lot :)

ChristianEhrlicher
19th October 2007, 08:34
Or much better - don't iterate over a directory but
a) use QDir/QFileInfo
b) use a QThread to not block the gui