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. QList<customObj *> in QML not working on raspberry
Forum Updated to NodeBB v4.3 + New Features

QList<customObj *> in QML not working on raspberry

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 332 Views 1 Watching
  • 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.
  • P Offline
    P Offline
    poucz
    wrote on last edited by
    #1

    Hello,
    I develop application on desktop. Now I'm done, and I need deploy it to raspberry.

    Compilation (on raspberry) was success.

    When I run application I cannot access to my sensors -list - QLlist<SENSOR *>.
    I make some test:
    When I push button print count of sensors - but - qml prin "undefined".

    But If I run same test code on my desktop - it's working.

    If I change QLlist<SENSOR *> to QLlist<QObject *> - code working on my desktop and on raspberry too.

    So I make another test (if SENSOR is really registred in QT):

    SENSOR * sensor=new SENSOR();
    sensor->ID="Hello;";
    engine.rootContext()->setContextProperty("sensor",sensor);
    
            Button{
                text:"test"
                onClicked: {
                    console.log(sensor.ID)
                }
            }
    

    This code working on desktop even on raspberry.

    So why QLlist<SENSOR *> not working on raspberry (QT5.11) but work on my desktop (QT5.14,QT5.15,QT5.11.3)?

    SENSOR class is inherit form QObject, and in header I have

    Q_DECLARE_METATYPE(SENSOR);
    

    QList is registred as property:

    Q_PROPERTY(QList<SENSOR *> sensorsUnit READ getSensorUnitList NOTIFY sensorUnitListChange)
    
    //getSensorUnitList ->
    QList<SENSOR *> getSensorUnitList()const;
    
    

    Thank you for any help

    1 Reply Last reply
    0
    • P Offline
      P Offline
      poucz
      wrote on last edited by
      #2

      Source code is here

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by dheerendra
        #3
        Try changing the QList<SENSOR*> to QList<QObject*>
        

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

        1 Reply Last reply
        0
        • P Offline
          P Offline
          poucz
          wrote on last edited by
          #4

          Yes QList<QObject*> is working. But why QList<SENSOR*> work on my Desktop and not work on raspberry???

          1 Reply Last reply
          0

          • Login

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