Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
QDS 4.5.1
-
None
Description
Given a simple Settings object, I can add a JSON object to my list and change my text string.
Editing the object works as expected and the state is saved for the next app start.
When modifying the below delegate and saving, myObj in the settings model gets reset. myAppendix is not affected.
Reproduce:
- Start app
- Click button
- Close app
- Restart app (to confirm that state was saved)
- Enter a new line in the Text delegate. (Ex: a new line between height and width)
- Save
- Restart app. If Settings hasn't reverted, it will probably be reverted if you restart the app again. (Delay due to Settings sync() ?)
Rectangle { id: rectangle height: 500 width: 500 Settings { id: testSettings1 category: "test1" property list<var> myObj: [{ "x": 1, "y": 2 }] property string myAppendix: "Hello" } ListView { width: rectangle.width height: rectangle.height model: testSettings1.myObj delegate: Text { height: 40 width: 100 text: "x y: " + modelData.x + " " + modelData.y } } Button { id: button text: qsTr("Press me") + " " + testSettings1.myAppendix anchors.bottom: parent.bottom checkable: true anchors.horizontalCenter: parent.horizontalCenter Connections { target: button onClicked: { console.log(testSettings1.myObj) testSettings1.myObj.push({ "x": 3, "y": 4 }) testSettings1.myAppendix = "Hello World" } } } }