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. QDialog as a QMdiSubWindow: Weird behavior when minimizing

QDialog as a QMdiSubWindow: Weird behavior when minimizing

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

    Hello!

    This short program creates a QDialog as a MDI sub window.

    I've noticed that minimizing the dialog makes the QDialog::exec() event loop to finish. Which makes no sense at all.

    Anybody has an idea about how to solve this?

    Thank you very much!

    #include <QApplication>
    #include <QtWidgets>
    
    int main(int argc,char *argv[]) {
        QApplication  app(argc,argv);
        QMainWindow   win;
        QMdiArea      mdi;
        QMdiSubWindow *sub;
        QDialog       dlg;
    
        win.setCentralWidget(&mdi);
        win.show();
    
        sub=mdi.addSubWindow(&dlg);
        sub->resize(win.size()/2);
    
        qDebug() << "before dlg.exec()";
        dlg.exec();
        qDebug() << "after dlg.exec()";
    
        win.close();
        return 0;
    }
    

    I hope I'm overlooking some small detail and that the solution is simple haha

    JonBJ 1 Reply Last reply
    0
    • AlveinA Alvein

      Hello!

      This short program creates a QDialog as a MDI sub window.

      I've noticed that minimizing the dialog makes the QDialog::exec() event loop to finish. Which makes no sense at all.

      Anybody has an idea about how to solve this?

      Thank you very much!

      #include <QApplication>
      #include <QtWidgets>
      
      int main(int argc,char *argv[]) {
          QApplication  app(argc,argv);
          QMainWindow   win;
          QMdiArea      mdi;
          QMdiSubWindow *sub;
          QDialog       dlg;
      
          win.setCentralWidget(&mdi);
          win.show();
      
          sub=mdi.addSubWindow(&dlg);
          sub->resize(win.size()/2);
      
          qDebug() << "before dlg.exec()";
          dlg.exec();
          qDebug() << "after dlg.exec()";
      
          win.close();
          return 0;
      }
      

      I hope I'm overlooking some small detail and that the solution is simple haha

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Alvein
      I don't know the answer to your question. But it always surprises me why anyone would use a QDialog as anything other than what it is intended for, such as an MDI subwindow:

      A dialog window is a top-level window mostly used for short-term tasks and brief communications with the user.

      1 Reply Last reply
      3

      • Login

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