ubuntu-sdk-bugs team mailing list archive
-
ubuntu-sdk-bugs team
-
Mailing list archive
-
Message #07143
[Bug 1621509] [NEW] ListView with extension from UbuntuToolkit updates its model after the component is completed
Public bug reported:
This is the cause for the Sections index resetting after initialization,
see bug https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-
toolkit/+bug/1610231
Create the file ModelTest.qml:
import QtQuick 2.4
Item {
id: root
width: 800
height: 600
ListView {
model: root.model
onModelChanged: print("LV model changed to "+model[0]+" "+model[1]+" "+model[2]+" "+model[3])
Component.onCompleted: print("ListView completed.")
}
Component.onCompleted: print("root item completed.")
property list<QtObject> objectList
onObjectListChanged: print("root.objectList changed to "+objectList[0]+" "+objectList[1]+" "+objectList[2])
property var model: objectList
}
and run this program modelInst.qml:
import QtQuick 2.4
import Ubuntu.Components 1.3
ModelTest {
QtObject {
objectName: "one"
id: objectOne
}
QtObject {
objectName: "two"
id: objectTwo
}
QtObject{
objectName: "three"
id: objectThree
}
objectList: [objectOne, objectTwo, objectThree]
}
The output is as follows:
ubuntu@xenial1:~/dev/ubuntu-ui-toolkit/m/qt56fixes2sections$ qmlscene modelInst.qml
qml: root.objectList changed to undefined undefined undefined
qml: root.objectList changed to QObject(0x118abf0, "one") undefined undefined
qml: root.objectList changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") undefined
qml: root.objectList changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") QObject(0x1182f80, "three")
qml: LV model changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") QObject(0x1182f80, "three") undefined
qml: LV model changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") QObject(0x1182f80, "three") undefined
qml: root item completed.
qml: ListView completed.
qml: LV model changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") QObject(0x1182f80, "three") undefined
qml: LV model changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") QObject(0x1182f80, "three") undefined
so the model ic changed AFTER the ListView and root item are completed.
When the Ubuntu.Components import is removed, the output is correct, like this:
ubuntu@xenial1:~/dev/ubuntu-ui-toolkit/m/qt56fixes2sections$ qmlscene modelInst.qml
qml: root.objectList changed to undefined undefined undefined
qml: root.objectList changed to QObject(0x171c8d0, "one") undefined undefined
qml: root.objectList changed to QObject(0x171c8d0, "one") QObject(0x171d290, "two") undefined
qml: root.objectList changed to QObject(0x171c8d0, "one") QObject(0x171d290, "two") QObject(0x171d420, "three")
qml: LV model changed to QObject(0x171c8d0, "one") QObject(0x171d290, "two") QObject(0x171d420, "three") undefined
qml: LV model changed to QObject(0x171c8d0, "one") QObject(0x171d290, "two") QObject(0x171d420, "three") undefined
qml: root item completed.
qml: ListView completed.
Also, if there is no ListView inside ModelTest.qml, then nothing is updated after the items are completed. So I suspect the issue is in our ListView extension.
** Affects: ubuntu-ui-toolkit (Ubuntu)
Importance: Critical
Status: New
** Tags: qt5.6
** Changed in: ubuntu-ui-toolkit (Ubuntu)
Importance: Undecided => Critical
** Tags added: qt56
** Tags removed: qt56
** Tags added: qt5.6
--
You received this bug notification because you are a member of Ubuntu
SDK bug tracking, which is subscribed to ubuntu-ui-toolkit in Ubuntu.
https://bugs.launchpad.net/bugs/1621509
Title:
ListView with extension from UbuntuToolkit updates its model after the
component is completed
Status in ubuntu-ui-toolkit package in Ubuntu:
New
Bug description:
This is the cause for the Sections index resetting after
initialization, see bug https://bugs.launchpad.net/ubuntu/+source
/ubuntu-ui-toolkit/+bug/1610231
Create the file ModelTest.qml:
import QtQuick 2.4
Item {
id: root
width: 800
height: 600
ListView {
model: root.model
onModelChanged: print("LV model changed to "+model[0]+" "+model[1]+" "+model[2]+" "+model[3])
Component.onCompleted: print("ListView completed.")
}
Component.onCompleted: print("root item completed.")
property list<QtObject> objectList
onObjectListChanged: print("root.objectList changed to "+objectList[0]+" "+objectList[1]+" "+objectList[2])
property var model: objectList
}
and run this program modelInst.qml:
import QtQuick 2.4
import Ubuntu.Components 1.3
ModelTest {
QtObject {
objectName: "one"
id: objectOne
}
QtObject {
objectName: "two"
id: objectTwo
}
QtObject{
objectName: "three"
id: objectThree
}
objectList: [objectOne, objectTwo, objectThree]
}
The output is as follows:
ubuntu@xenial1:~/dev/ubuntu-ui-toolkit/m/qt56fixes2sections$ qmlscene modelInst.qml
qml: root.objectList changed to undefined undefined undefined
qml: root.objectList changed to QObject(0x118abf0, "one") undefined undefined
qml: root.objectList changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") undefined
qml: root.objectList changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") QObject(0x1182f80, "three")
qml: LV model changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") QObject(0x1182f80, "three") undefined
qml: LV model changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") QObject(0x1182f80, "three") undefined
qml: root item completed.
qml: ListView completed.
qml: LV model changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") QObject(0x1182f80, "three") undefined
qml: LV model changed to QObject(0x118abf0, "one") QObject(0x118a110, "two") QObject(0x1182f80, "three") undefined
so the model ic changed AFTER the ListView and root item are
completed.
When the Ubuntu.Components import is removed, the output is correct, like this:
ubuntu@xenial1:~/dev/ubuntu-ui-toolkit/m/qt56fixes2sections$ qmlscene modelInst.qml
qml: root.objectList changed to undefined undefined undefined
qml: root.objectList changed to QObject(0x171c8d0, "one") undefined undefined
qml: root.objectList changed to QObject(0x171c8d0, "one") QObject(0x171d290, "two") undefined
qml: root.objectList changed to QObject(0x171c8d0, "one") QObject(0x171d290, "two") QObject(0x171d420, "three")
qml: LV model changed to QObject(0x171c8d0, "one") QObject(0x171d290, "two") QObject(0x171d420, "three") undefined
qml: LV model changed to QObject(0x171c8d0, "one") QObject(0x171d290, "two") QObject(0x171d420, "three") undefined
qml: root item completed.
qml: ListView completed.
Also, if there is no ListView inside ModelTest.qml, then nothing is updated after the items are completed. So I suspect the issue is in our ListView extension.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1621509/+subscriptions
Follow ups