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. Accept from child dialog closes hidden parent dialog.
Forum Updated to NodeBB v4.3 + New Features

Accept from child dialog closes hidden parent dialog.

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 448 Views 2 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.
  • I Offline
    I Offline
    IsAnton
    wrote on last edited by
    #1

    Very simple situation. I am trying to hide parent dialog while a child (modal dialog) is active, but after I call accept from the child I get result from
    parentDlg.exec() function.

    If parent dialog is not hidden then everything is as expected, I get a result of the child.exec() inside parent.

    Why parent becomes closed indirectly from the code of the child?

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

      Hi
      please be aware of
      https://doc.qt.io/qt-5/qguiapplication.html#quitOnLastWindowClosed-prop
      If this property is true, the applications quits when the last visible primary window (i.e. window with no parent) is closed.

      so try to set to false and see if it still closes

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Beside the good point made by @mrjj, why are you hiding the parent dialog ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • I Offline
          I Offline
          IsAnton
          wrote on last edited by
          #4

          @mrjj I didn't say application quits, My parent dialog return it's close code like I closed it, but I close the child.

          @SGaist Structure of application very simple, I have login dialog and when I click "Ok" connection to server is in progress while user see progress dialog. And user can terminate progress and get back to Login dialog.

          I know I can execute dialogs one by one, achieving the same result, but still, how to make it work as it is now.

          (Screenshot_341.png Screenshot_340.png Screenshot_339.png image url)

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Please show the complete code related to that dialog handling.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • I Offline
              I Offline
              IsAnton
              wrote on last edited by
              #6

              @SGaist On "Ok" button I have
              hide();
              auto res = mSessionProgress->exec();
              show();

              On "Cancel" of Progress dialog I just have:
              connect(ui->btnCancel, &QPushButton::clicked, this, ={
              accept();
              });

              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