Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Unsolved ListModel append object with null value

    QML and Qt Quick
    2
    2
    780
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      Vi67 last edited by

      Hello,

      I have a new bug sinse I upgraded Qt 5.5 to Qt 5.5.1. This problem didn't exist in Qt5.5.

      When I add a javascript object to a ListModel, and this object has a null value, the attribute with null value is disappearing. This is a simple example :

      ListModel {
      	id: myList
      }
      
      function foo() {
      	var obj = {
      		attribute1 : 'value ok',
      		attribute2 : null
      	};
      	
      	console.log(JSON.stringify(obj));
      	// show {attribute1: 'value ok', attribute2 : null}
      	
      	myList.append(obj);
      	console.log(JSON.stringify(myList));
      	// show only {attribute1: 'value ok'}
      }
      
      1 Reply Last reply Reply Quote 0
      • dheerendra
        dheerendra Qt Champions 2022 last edited by

        I tried to repro the problem. First I tried the same thing on 5.5 on mac. When we print the mylist i just see the qml: {"objectName":"","count":2,"dynamicRoles":false}. I don't see anything. Is there something missing here ?

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply Reply Quote 3
        • First post
          Last post