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. Parent window actions suspended when MessageBox is shown
Qt 6.11 is out! See what's new in the release blog

Parent window actions suspended when MessageBox is shown

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

    If the title is not descriptive, let me explain further.

    I have a Qt single threaded front end application, which connects to a back end and keep sending the heart beat messages to inform that it's alive.
    The problem is when a message box is shown, it suspends the activity of the parent application, which causes to miss sending the heart beats, which ultimately results in disconnection due to heart beat miss count exceed.
    We can use the msgBox.setWindowModality(Qt::NonModal);, but the msgBox needs to be a class variable, or else it will be closed if that is a local variable. And also it violates the requirement as well as it, since it would allow the user to interact with the system if there is an error message being shown.
    What is the most efficient and convenient way of doing this?

    Thanks.

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

      HI and welcome
      As you might know, all modal dialogs have their own message loop. ( exec() ) and
      this is the reason for application being suspended.

      So best option would be to use a thread for the heartbeat function and modal dialog to show error and
      block mainwindow interaction.

      If that is not an option, you could use FindChildren on mainwindow and set all Enabled to false when error is
      displayed and reverse when error is cleared. Not pretty/best design.

      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