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

DialogButtonBox cannot override standardButtons set in separate QML file

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.8.0
    • Quick: Controls 2
    • None
    • Mageia Linux Cauldron x86_64, Plasma 5.8

    Description

      Consider the following example:

      CustomDialog.qml
      import QtQuick.Controls 2.1
      
      Dialog {
          standardButtons: Dialog.Ok | Dialog.Cancel
      
          Label {
              text: "Test text"
          }
      }
      
      main.qml
      import QtQuick 2.7
      import QtQuick.Controls 2.1
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          Button {
              anchors.centerIn: parent
              text: "Open dialog"
              onClicked: dialog.open()
      
              CustomDialog {
                  id: dialog
      
                  x: (parent.width - width) / 2
                  y: (parent.height - height) / 2
      //            standardButtons: Dialog.NoButton
      
                  footer: DialogButtonBox {
                      standardButtons: DialogButtonBox.Save | DialogButtonBox.Cancel
                  }
              }
          }
      }
      

      As a result, dialog has "Ok" button, instead of the "Save".

      Setting in the dialog standardButtons: Dialog.NoButton is a workaround.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            krnekit Nikita Krupenko
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes