Uploaded image for project: 'Qt Design Studio'
  1. Qt Design Studio
  2. QDS-13695

binary QML Settings (QSettings) gets overwritten

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • QDS 4.x
    • QDS 4.5.1
    • All Other Issues
    • None
    • Windows

    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"
                  }
              }
          }
      } 

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thohartm Thomas Hartmann
            mairtin.s Mairtin Steinkamp
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes