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

widget-based MessageDialog doesn't get centered over its transient parent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 6.1.0
    • 5.9.1
    • Quick: Dialogs
    • None
    • d9a651707646722915c5f20b64804252dd041a16 (qt/qtbase/dev)

      qml -apptype widget messagedialog.qml

      If the window isn't centered on the screen, you can see that the dialog is centered on the screen rather than w.r.t. the app window. (But it's fine if the MessageDialog is DefaultMessageDialog rather than QMessageBox.)

      In QMessageBoxHelper::show(), it does try to set its transient parent:

           virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
              m_dialog.winId();
              QWindow *window = m_dialog.windowHandle();
              Q_ASSERT(window);
              window->setTransientParent(parent); 
       qDebug() << window << "transient for" << parent;
          … }
      

      QMessageBoxHelper::show - QWidgetWindow(0x7fcf52d80a40, name="QMessageBoxClassWindow") transient for QQuickWindowQmlImpl(0x7fcf54a192c0)

      so this might be a generic problem with widget dialogs transient for QWindow; needs testing in C++ to be sure.

        1. messagedialog.qml
          0.6 kB
          Shawn Rutledge
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            srutledg Shawn Rutledge
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes