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

close.accepted behavior

    XMLWordPrintable

Details

    • Windows
    • fa6ee2d9c1506da6eaa07062ce854e1ebdfe26ec (qt/qtdeclarative/6.2) 8ec849646d8bd590e64bda6105021bde58fa7ae3 (qt/qtdeclarative/dev)

    Description

      Hello everyone,

      I am migrating some working software to Qt6, and I encountered what I consider to be a bug.

      The software has a popup window that becomes visible when the user tries to close the program. It asks the user if they're sure if they want to exit. This is the way it's being done:

       

      onClosing: function(close){
              close.accepted = false
              confirmExitPopup.visible = true
          }
      
      VPPopupWindow {
              id: confirmExitPopup
              title: "Exit Program?"
              text: "Are you sure you want to close?"
          }
      
      Connections {
              target: confirmExitPopup
              function onButtonClicked(buttonState) {
                  if(buttonState == "yes") {
                      Qt.quit();
                  }
                  visible = false;
              }
          }

       

      According to the Qt documentation, that is exactly the way it should be done:

      However, the program now closes regardless of which button I click. Actually, if I click "no", the GUI crashes. Why is that? This feature was working fine in Qt5.

      Attachments

        1. image.png
          26 kB
          Volker Hilsheimer
        2. image-2021-11-29-13-29-23-082.png
          26 kB
          María García
        3. qtbug98747.zip
          9 kB
          Volker Hilsheimer
        For Gerrit Dashboard: QTBUG-98747
        # Subject Branch Project Status CR V

        Activity

          People

            vhilshei Volker Hilsheimer
            mariag María García
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes