Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-83601

ListModel - setProperty creates a different type than append.

    XMLWordPrintable

    Details

    • Platform/s:
      Linux/X11, Windows

      Description

       

      The ListModel function append has a different behavior than setProperty. When inserting an object with append, a different data type seems to be set compared to the case if it was assigned with setProperty. The warning

      "Can't assign to existing role 'parametersObj' of different type [List -> VariantMap]"

      appears.

      However, the property is still set successfully. See the following example:

      property ListModel stage: ListModel {}
      
      let parametersArray = [];
      let parametersObj = {};
              
      for (var i = 0; i < slotTmp.length; i++){
         let parameterSlot = {
            slot: slotTmp[i],
            optional: false,
            value: "",
            storedParameter: {}
         }
         parametersArray.push(parameterSlot);
      }
      parametersObj['array'] = parametersArray;
      
      stage.append({parametersObj: parametersObj})
      
      stage.setProperty(0,"parametersObj",parametersObj)
      

       

       

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            johannesb94 Johannes Behrens
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes