我有一组类ClassA
,ClassB
和ClassC
:
class ClassA : public QObject
{
Q_PROPERTY(int propertyA READ propertyA WRITE setPropertyA NOTIFY propertyAChanged)
}
class ClassB : public QObject
{
Q_PROPERTY(int propertyB READ propertyB WRITE setPropertyB NOTIFY propertyBChanged)
}
class ClassC : public ClassA, public ClassB //problem: both classes are derived from QObject
{
Q_PROPERTY(int propertyC READ propertyC WRITE setPropertyC NOTIFY propertyCChanged)
}
每个类都有必须在 Qml 中可访问的属性,这意味着每个类都必须实现QObject
该类。实现这一点的最佳方法是什么?
问候