Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ListModel append object with null value
Forum Update on Monday, May 27th 2025

ListModel append object with null value

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.0k Views
  • 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 Offline
    V Offline
    Vi67
    wrote on 13 Nov 2015, 09:20 last edited by
    #1

    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
    0
    • D Offline
      D Offline
      dheerendra
      Qt Champions 2022
      wrote on 16 Nov 2015, 11:39 last edited by
      #2

      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
      3

      1/2

      13 Nov 2015, 09:20

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved