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

onClosing event of ApplicationWindow not invoked via close()

    XMLWordPrintable

Details

    Description

      If a window is closed via the close() function from QML, the onClosing event is not invoked. If the window is closed via the chrome([x] button), the event is raised as expected.

      Bar.java
      import QtQuick 2.1
      import QtQuick.Controls 1.0
      import QtQuick.Window 2.0
      
      ApplicationWindow {
        title: qsTr("Hello World")
        width: 640
        height: 480
        property ApplicationWindow win : ApplicationWindow {
          title: "hello"
          Button {
            text: "Something"
            anchors.centerIn: parent
          }
          onClosing: console.log("Called")
        }
      
        Button {
          anchors.left: parent.left
          text: "Open"
          onClicked: win.show();
        }
      
        Button {
          anchors.right: parent.right
          text: "Close"
          onClicked: {
            win.close()
          }
        }
      }
      
      • Click the "Open" button to open a window.
      • Close via the window chrome [x] button in the new window and you'll see the console log output
      • Close the new window via the "Close" button in the parent. Console log output is not currently raised

      Attachments

        Issue Links

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

          Activity

            People

              srutledg Shawn Rutledge
              nosf Viv Rajkumar
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes