以前我发布了一个关于如何在 QML 中访问结构的问题,并从一些很棒的人那里得到了完美的答案,现在我需要知道是否有任何方法可以访问QML中的结构内的结构,以下是代码:
//MyNewStruct
struct MyNewStruct {
Q_GADGET
float m_range;
Q_PROPERTY(float range MEMBER m_range)
};
//我的结构
struct MyStruct {
Q_GADGET
int m_val;
QString m_name1;
QString m_name2;
QString m_name3;
QString m_name4;
MyNewStruct m_newStr; //**new Struct declaration
Q_PROPERTY(int val MEMBER m_val)
Q_PROPERTY(QString name1 MEMBER m_name1)
Q_PROPERTY(QString name2 MEMBER m_name2)
Q_PROPERTY(QString name3 MEMBER m_name3)
Q_PROPERTY(QString name4 MEMBER m_name4)
Q_PROPERTY(MyNewStruct newStr MEMBER m_newStr) //**Currently getting error as != cannot be used
};