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

Dialog is shown not centered

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.0, 5.5.0
    • 5.3.0, 5.3.1
    • Quick: Dialogs
    • None

    Description

      Next simple example must show us dialog, and according to documentation it must be centered over the Window (http://qt-project.org/doc/qt-5/qml-qtquick-dialogs-messagedialog.html)

      A MessageDialog window is automatically transient for its parent window. So whether you declare the dialog inside an Item or inside a Window, the dialog will appear centered over the window containing the item, or over the Window that you declared.

      main.qml
      import QtQuick 2.2
      import QtQuick.Window 2.1
      import QtQuick.Dialogs 1.2
      import QtQuick.Controls 1.2
      
      Window {
          visible: true
          width: 360
          height: 360
      
          Button {
              anchors.centerIn: parent
              text: "Push me"
              onClicked: testDialog.visible = true
          }
      
          MessageDialog {
              id: testDialog
              modality: Qt.ApplicationModal
              title: "MessageDialog"
              text: "This dialog must be centered in parent window"
              standardButtons: StandardButton.Ok
              visible: false
          }
      }
      

      But as a result every time I got MessageDialog positioned in top left corner of screen.

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              troyane Nazar Gerasymchuk
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes