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

DialogButtonBox.DestructiveRole doesn't close the dialog

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.8.1, 6.9.0 FF
    • 5.7.0
    • Quick: Controls 2
    • None
    • fbc473d22 (dev), ff177a379 (6.8)

    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

          For Gerrit Dashboard: QTBUG-67168
          # Subject Branch Project Status CR V

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes