Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. No WM_QUIT, QCoreApplication::processEvents()
Forum Updated to NodeBB v4.3 + New Features

No WM_QUIT, QCoreApplication::processEvents()

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zlxwd
    wrote on last edited by
    #1

    I use Qt as a offscreen html render in a Win32 application. In the main loop, I repeatedly call QCoreApplication::processEvents() to process qt events. The problem is after I call PostQuitMessage(0) in WM_DESTROY, the main loop don't break. While if I remove QCoreApplication::processEvents(), PostQuitMessage(0) will produce a WM_QUIT message.

    Is there anything wrong about the code? Or any ideas? Thanks

    Main Loop
    [code]
    while (true) {
    QCoreApplication::processEvents(); // If remove this line, PostQuitMessage(0) will produce WM_QUIT
    if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) {
    if (msg.message == WM_QUIT) {
    break;
    }
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    } else {
    Render()
    }
    }
    [/code]

    Message process:
    [code]
    LRESULT WINAPI MsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
    switch (msg) {
    case WM_DESTROY:
    PostQuitMessage(0);
    break;
    }
    }
    [/code]

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved