Hi,

I have to expose into a QML widget fields from a set of nested classes like in the follows example:


Qt Code:
  1. class A : public QObject
  2. {
  3. Q_OBJECT
  4. Q_PROPERTY(QString name READ getName)
  5.  
  6. public:
  7. ...
  8. QString getName()
  9.  
  10. private:
  11. QString _name;
  12.  
  13. }
  14.  
  15.  
  16. class B : public A
  17. {
  18. Q_OBJECT
  19. Q_PROPERTY(int value READ getValue)
  20.  
  21. public:
  22. B(int val);
  23. int getValue();
  24.  
  25. private:
  26. int _value;
  27. }
  28.  
  29.  
  30. // in another c
  31. Q_INVOKABLE QObject * getObjectOfTypeB()
  32. {
  33. return new B(1);
  34. }
To copy to clipboard, switch view to plain text mode 

in QML:
Qt Code:
  1. var tmp = myModel.getObjectOfTypeB();
  2.  
  3. tmp.name // works
  4. tmp.value // undefined
To copy to clipboard, switch view to plain text mode 

The filed from the top class works, while the field form the sub-class B is undefined.
What's wrong?

Thank you