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

Crash when detaching QMdiSubWindow with QQuickWidget as internal widget

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P1: Critical P1: Critical
    • None
    • 6.9.1
    • GUI: Other
    • None
    • Debian 13, Qt Creator
    • Linux/X11

      Context:

      I have an application which is using a QMdiArea and some subwindows. I'd like to be able to detach subwindows to make them floating windows. Settings the parent to nullptr and call setVisible is enough while dealing with pure QWidget subwindows. 
      But that leads to crash when the subwindow contains a QQuickWidget. (see example in the archive).

      Summarize:

      QMdiSubWindow reparenting crash when there is an QQuickWidget as internal widget.

       

      The code:  (Which is fine with normal QWidget subwindows)

      connect(m_ctrl, &MainController::detachChanged, this, [this](){
         if(m_ctrl->detach())
         {
             m_subWin->setParent(nullptr);
             m_subWin->setVisible(true);
         }
         else
         {
             ui->mdiArea->addSubWindow(m_subWin);
             m_subWin->setVisible(true);
         }
      });

      The example :

      I made a simple example of the issue with 2 subwindows. The QML subwindow (red one) leads to the crash, while the QWidget (the small one) can be detach and reattach easily. 

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            obiwankennedy renaud.guezennec
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes