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. Cannot return from exec()
Forum Updated to NodeBB v4.3 + New Features

Cannot return from exec()

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 502 Views
  • 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.
  • A Offline
    A Offline
    alan73
    wrote on last edited by
    #1

    I use QDialog to implement interface for computationally extensive module. Dialog begins by exec() call.

    When pressing "Ok" button, application creates several posix threads.
    These threads connect with dialog with callback functions of type (particularly to send procents to dialog progress bar):

    void AcceptMessage(...)
    {
    qApp->processEvents();
    ...
    }

    With this processEvents() call I keep GUI responsible. That's why, when user presees "Cancel" I expect app to quit.

    void Dialog::Cancel()
    {
    ...
    close();
    // done();
    }

    Dialog closes but threads (detached) don't close and EventLoop continues to functionalize. What can be the reason?

    1 Reply Last reply
    0
    • jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Why do you need qApp->processEvents();?
      Is your dialog blocked by something?
      If your havy computation happens in other threads then there should not be any need for qApp->processEvents();

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      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