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

QMainWindow reappears at different position with QOpenGLWidget in QMdiSubWindow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.4.0
    • None
    • Windows 10, x64, Visual Studio 2022
    • Windows

      If you put a QOpenGLWidget in a QMdiSubWindow and you add the sub window in a QMdiArea that is the central widget of a QMainWindow, the main window disappears for a moment, then it reappears in a different position.

      A sample code to reproduce the issue:

      QMainWindow* mw = new QMainWindow();
      QMdiArea* mdi = new QMdiArea(mw);
      mw->setCentralWidget(mdi);
      QToolBar* toolbar = mw->addToolBar(QString("Main toolbar"));
      QAction* testAction = toolbar->addAction(QString("Test"));
      connect(testAction, &QAction::triggered, [=]() { 
        QOpenGLWidget* oglw = new QOpenGLWidget();
        QMdiSubWindow* sw = new QMdiSubWindow();
        sw->setWidget(oglw);
        mdi->addSubWindow(sw);
        sw->show();
      });
      mw->show();

      (click on the "Test" action to add the sub window)

      The problem only occurs the first time you add the sub window.

        For Gerrit Dashboard: QTBUG-107585
        # Subject Branch Project Status CR V

            lagocs Laszlo Agocs
            puffosauro Fabio Dago
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change