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

Dialog should emit rejected() when CloseOnEscape is triggered

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P2: Important
    • 5.8.0 RC
    • 5.8.0 Alpha
    • Quick: Controls 2
    • None

    Description

      Controls 2:

      import QtQuick 2.8
      import QtQuick.Layouts 1.3
      import QtQuick.Controls 2.1
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          Dialog {
              id: dialog
              modal: true
              focus: true
              Component.onCompleted: visible = true
              implicitWidth: 500
              implicitHeight: 400
      
              standardButtons: Dialog.Ok | Dialog.Cancel
              onRejected: print("rej")
          }
      }
      

      Widgets:

      #include <QApplication>
      #include <QDialog>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QDialog dialog;
          QObject::connect(&dialog, &QDialog::rejected, []() {
              qDebug() << "Rejected!";
          });
      
          dialog.show();
      
          return a.exec();
      }
      

      Attachments

        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:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes