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

Instantiator creates delegate when active is false and delegate is updated

    XMLWordPrintable

Details

    • Linux/X11
    • a1c1ad11ce6f4a415cefc583cfab41336ecf71e3 (qt/qtdeclarative/dev) e51f6cd8af19d1c55faae39e0e1c0203b619fb19 (qt/qtdeclarative/6.2) e25c25453c (qt/tqtc-qtdeclarative/5.15)

    Description

      Hello,

      Instantiator creates and destroys delegate when active property is false and delegate is updated.

      [Reading the documentation](https://doc-snapshots.qt.io/qt5-5.14/qml-qtqml-models-instantiator.html#active-prop), no objects should be created or destroyed.

      A sandbox project with minimalist code is attached to this issue.

      Best regards

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.5
      import QtQuick.Layouts 1.12
      import QtQml.Models 2.12
      
      Window {
          id: root
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Component {
              id: componentTest
              QtObject {
                  Component.onCompleted: {
                      console.warn("!=======Component instantiated============!")
                  }
                  Component.onDestruction: {
                      console.warn("!=======Component destructed============!")
                  }
              }
          }
      
          Component.onCompleted: {
              instantiator.delegate = componentTest
          }
      
          Instantiator {
              id: instantiator
      
              active: false
      
          }
      }
      

      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
            pierre-luc Pierre-Luc Manteaux
            Votes:
            11 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes