如何创建用于QML的通用对象模型?
AnimalModel
(
QuickView view;view.rootContext()->setContextProperty("myModel", &model);
view.rootContext()->setContextProperty("obj", pDataObject);
class DataObject : public QObject{ Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged) ... AnimalModel m_modelAnimals; //Is this possible in any way? //Q_PROPERTY(AnimalModel modelAnimals READ modelAnimals NOTIFY modelAnimalsChanged)};
QAbstractListModel
QQmlListProperty
QQmlListProperty
RISEBY
相关分类