Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-69495

QMdiArea subwindow does not redraw in some cases

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.11.0
    • None
    • Linux/X11, Windows

    Description

      I created an MDI application and noticed that the first visible window had issues. Primarily, the move and resize events didn't seem to be working at all. Maximizing and unmaximizing, or opening a second window would fix the issue.

      In the end, I tracked it down to what I guess is an ordering issue with my code (when the QMdiSubWindow is attached to the QMdiArea vs when the child widget is setup), but it seems to me that since Qt could eventually figure out how to work properly, it should perhaps always work properly?

       

      Here is a trivial example that demonstrates the issue:

      #include <QApplication>
      #include <QMdiArea>
      #include <QMdiSubWindow>
      #include <QLabel>
      #include <QHBoxLayout>
      
      static bool bad = true;
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QMdiArea *window = new QMdiArea;
          window->show();
          QWidget *widget = new QWidget;
          QMdiSubWindow *subWindow;
          if (bad) {
              subWindow = new QMdiSubWindow(window);
          } else {
              subWindow = new QMdiSubWindow;
          }
          subWindow->setWidget(widget);
          subWindow->setAttribute(Qt::WA_DeleteOnClose);
          QLabel *label = new QLabel("This is just some text");
          QHBoxLayout *layout = new QHBoxLayout;
          layout->addWidget(label);
          widget->setLayout(layout);
          if (!bad) {
              window->addSubWindow(subWindow);
          }
          widget->show();
          return a.exec();
      }

       

      1. Run the app and try to move or resize the subwindow.
      2. Observe the painting errors.
      3. Maximize (double click the title bar) and unmaximize the subwindow.
      4. Observe that painting is corrected.
      5. Change the bool bad to false and re-run the app.
      6. Observe that there are no painting errors.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            a1291762 Lincoln Ramsay
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes