'window' contextProperty is registered after components are completed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-ui-toolkit (Ubuntu) |
Fix Released
|
Critical
|
Tim Peeters |
Bug Description
This is the cause for the Sections index resetting after initialization, see bug 1610231.
Use this code:
------ ModelFromList13.qml ------
import QtQuick 2.4
// This component is used in tst_listview_
Item {
id: root
property var myObject
property int count: 0 // will hold the number of changes to myObject after Component.
onMyObjectC
count++;
}
Component.
count = 0;
}
}
------ tst_list_
import QtQuick 2.4
import QtTest 1.0
// Ubuntu.Components is not explicitly used below, but its import causes bug #1621509.
import Ubuntu.Components 1.3
TestCase {
id: testCase
name: "EmbeddedListView"
width: 100
height: 100
// Bug #1621509 only occurs when we wait for the window to be visible.
// Forces the components to be completed before the test functions are executed.
when: windowShown
ModelFromList13 {
id: embeddedListView
QtObject {
id: objectOne
}
myObject: objectOne
}
Component.
}
function test_no_
}
}
----------
the test will fail. Also, one can replace the TestCase by Item (and remove when: windowShown) and simply use qmlscene to start the app. It will show that myObject is set twice: before the component completed, and then again afterwards. I suspect the reason for this is the change of the 'window' context property which causes everything in the context (objectOne) and properties that depend on that to be re-evaluated.
Related branches
- ubuntu-sdk-build-bot: Approve (continuous-integration)
- Cris Dywan: Approve
-
Diff: 729 lines (+453/-61)20 files modifiedsrc/UbuntuToolkit/ubuntutoolkitmodule.cpp (+5/-0)
src/imports/Components/1.2/MainView.qml (+9/-9)
src/imports/Components/1.2/MainView12.qml (+9/-9)
src/imports/Components/1.2/OrientationHelper.qml (+6/-4)
src/imports/Components/1.3/MainView.qml (+9/-9)
src/imports/Components/1.3/OrientationHelper.qml (+6/-4)
tests/unit/mainview11/tst_mainview.cpp (+0/-17)
tests/unit/mainview13/AppName.qml (+23/-0)
tests/unit/mainview13/LocalStorage.qml (+32/-0)
tests/unit/mainview13/PageStack.qml (+38/-0)
tests/unit/mainview13/PageTitle.qml (+32/-0)
tests/unit/mainview13/Settings.qml (+2/-2)
tests/unit/mainview13/mainview13.pro (+4/-0)
tests/unit/mainview13/tst_mainview.cpp (+216/-0)
tests/unit/orientation/tst_orientation.cpp (+2/-2)
tests/unit/runtest.sh (+2/-2)
tests/unit/unit.pro (+2/-1)
tests/unit/visual/tst_pagehead_sections_bug1511839.13.qml (+0/-1)
tests/unit/visual/tst_sections.13.qml (+0/-1)
tests/unit/visual/tst_window_context_property_init_bug1621509.13.qml (+56/-0)
Changed in ubuntu-ui-toolkit (Ubuntu): | |
importance: | Undecided → Critical |
tags: | added: qt56 |
tags: |
added: qt5.6 removed: qt56 |
description: | updated |
summary: |
- ListView with extension from UbuntuToolkit updates its model after the - component is completed + 'window' contextProperty is registered after components are completed |
description: | updated |
Changed in ubuntu-ui-toolkit (Ubuntu): | |
status: | In Progress → Fix Committed |
I checked and no ListViewProxy is created. So something else causes this when importing Ubuntu.Components (1.0/1.1/1.2/1.3).