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

DialogButtonBox.DestructiveRole doesn't close the dialog

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.7.0
    • Quick: Controls 2
    • None

    Description

      import QtQuick 2.7
      import QtQuick.Controls 2.3
      
      ApplicationWindow {
          id: main
          visible: true
          width: 640
          height: 480
      
          Dialog {
              id: discardChangesDialog
              objectName: "discardChangesDialog"
              x: parent.width / 2 - width / 2
              y: parent.height / 2 - height / 2
              title: qsTr("Unsaved changes")
              modal: true
              visible: true
      
              onAccepted: print("saved")
              onDiscarded: print("discarded")
      
              Label {
                  text: qsTr("The action you're about to perform could discard changes.\n\nContinue anyway?")
              }
      
              footer: DialogButtonBox {
                  Button {
                      objectName: "saveChangesDialogButton"
                      text: qsTr("Save")
                      DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
                  }
                  Button {
                      objectName: "discardChangesDialogButton"
                      text: qsTr("Discard")
                      DialogButtonBox.buttonRole: DialogButtonBox.DestructiveRole
                  }
              }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              mitch_curtis Mitch Curtis
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes