Hi,

I want use model, in new type QML

example:

NewType {
       id: 42
       size: 42
       model: MyModel {}
}

But I don't use variable "model" of type QVariant,
I try convert in QObject or QAbstractListModel or QAbstractItemModel

example:

class NewType : public QDeclarativeItem
{
Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)

public:

      QVariant model() const;
      void setModel(const QVariant &);
}

In function setModel


QObject *object = qvariant_cast<QObject *>(model);
QAbstractItemModel* m = qobject_cast<QAbstractItemModel *>(object);
QAbstractListModel * i = qobject_cast<QAbstractListModel *>(object);


But don't convert type, so don't use my model.


How we create model in c++ ?
Do you want create delagate

Thank

-- 
marvin42
_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to