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
Qt 6.11 is out! See what's new in the release blog

ListModel append object with null value

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.2k 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 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
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
      wrote on 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
      https://www.pthinks.com

      1 Reply Last reply
      3

      • Login

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