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

Popup closed signal emitted after destruction

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.12.8, 5.14.2, 5.15.0
    • Quick: Controls 2
    • None
    • Ubuntu 18.04, Windows 10/Surface 4 Pro
    • Linux/X11, Windows

    Description

      When popup destroyed by clearing StackView or exiting the application 'closed' signal is emitted too late:

      import QtQuick 2.12
      import QtQuick.Controls 2.12
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          Component {
              id: popupComponent
      
              Popup {
                  Button {
                      text: 'pop'
                      onClicked: stack.clear()
                  }
              }
          }
      
          StackView {
              id: stack
      
              initialItem: Component {
                  Item {
                      Button {
                          text: 'open'
      
                          onClicked: {
                              const popup = popupComponent.createObject(this)
      
                              popup.Component.destruction.connect(() => {
                                  console.log('destruction')
                              })
      
                              popup.closed.connect(() => {
                                  console.log('closed')
                                  popup.destroy()
                              })
      
                              popup.open()
                          }
                      }
                  }
              }
          }
      }
      

      Output:

      qml: destruction
      qml: closed
      qrc:/main.qml:37: TypeError: Property 'destroy' of object TypeError: Type error is not a function
      

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            michalc Michał Cieślak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes