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

Native QWindow based OpenGL/Vulkan windows positions are wrongly offset inside QMdiSubWindow

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.9.1
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Windows 10

      Visual Studio 2017

      64bit

      Description

      When assigning a QWindow derived window to a MdiSubWindow, its position gets offset to the left and top by the width of the window frame, which is 8 pixels exactly, this happens even when the sub window is maximized and there is no frame or border. Setting the window as main window or as a child of a layout on a non MDI widget does not show this behavior.

      I am creating this bug report after finding no work around.

      This is the code that creates the Sub Window:

      // code placeholder
      void MainWindow::on_actionOpen_triggered()
      {
      QString filename = QFileDialog::getOpenFileName ( this,
      tr ( "Open Model" ),
      tr ( "" ),
      tr ( "Model Files (*.mdl *.txt)" ) );
      if ( ! ( filename.isEmpty() || filename.isNull() ) )
      {
      QFileInfo fileinfo ( filename );
      EngineWindow* window = new EngineWindow ( mRenderer );
      QMdiSubWindow*
      mdiSubWindow = mdiArea->addSubWindow ( QWidget::createWindowContainer ( window, mdiArea ) );
      mdiSubWindow->setAttribute ( Qt::WA_DeleteOnClose );
      mdiSubWindow->setWindowTitle ( fileinfo.absoluteFilePath() );
      mdiSubWindow->showMaximized();
      mdiSubWindow->setMinimumSize ( QSize ( 128, 128 ) );
      window->setModel ( fileinfo.absoluteFilePath() );
      }
      }
      
      

      The full code of the project is at:

      https://github.com/AeonGames/AeonEngine/tree/master/tools/modelviewer

      It is not exactly easy to build, but it may help to look at the code when root causing the issue, I may try to create a minimal test case if required. (I don't think OpenGL or Vulkan is the reason for the problem)

      See images attached for visual aid.

       

        Attachments

        1. OpenGLMaximized.png
          OpenGLMaximized.png
          80 kB
        2. OpenGLNormal.png
          OpenGLNormal.png
          63 kB
        3. VulkanMaximized.png
          VulkanMaximized.png
          73 kB
        4. VulkanNormal.png
          VulkanNormal.png
          51 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            sletta Gunnar Sletta
            Reporter:
            Kwizatz Rodrigo Hernandez Cordoba
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes