通过一个类去访问另一个类的成员,两个类都需要注册`在这里插入代码片
注册部分代码:
qmlRegisterType();
qmlRegisterType(“com.yun.qt5.qml”,1,0,“WrapperObject”);
class WrapperObject : public QObject
{
Q_OBJECT
public:
explicit WrapperObject(QObject parent = nullptr);
~WrapperObject();
Q_PROPERTY(Object objecto READ object)
Object* object();
signals:
private:
Object* _object;
};