Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.0
-
Ubuntu 18.04
64 bit Intel compatible
-
-
a1c1ad11ce6f4a415cefc583cfab41336ecf71e3 (qt/qtdeclarative/dev) e51f6cd8af19d1c55faae39e0e1c0203b619fb19 (qt/qtdeclarative/6.2) e25c25453c (qt/tqtc-qtdeclarative/5.15)
Description
Instantiator creates delegates when active property is false if items are dynamically added to a ListModel associated with the Instantiator.
It won't let me attached the zip file (Jira token error) of the project so I am pasting the main.qml:
// code import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.15 import QtQml.Models 2.15Window { visible: true width: 640 height: 480 title: qsTr("Instantiator Active Bug") ListModel { id: listmodel dynamicRoles: true /* ListElement{name:"not one"} ListElement{name:"not two"} ListElement{name:"not three"} */ } Component.onCompleted: { if(1){ listmodel.insert(listmodel.count, {name: "one"}) listmodel.insert(listmodel.count, {name: "two"}) listmodel.insert(listmodel.count, {name: "three"}) } } StackView { anchors.fill: parent initialItem: page1 } Component { id: page1 Page { Instantiator { id: instantiator // https://doc.qt.io/qt-5/qml-qtqml-models-instantiator.html#active-prop active: false model: listmodel delegate: Text { width: 100 height: 20 text: name Component.onCompleted: console.log(instantiator.active, name) } onObjectAdded: column.data.push(object) onActiveChanged: console.log(active) } Column { id: column } } } }