On Sun, Jun 16, 2013 at 6:27 AM, Stephen Kelly <stephen.ke...@kdab.com> wrote: > On Friday, June 14, 2013 16:43:12 Sandro Andrade wrote: >> Am I missing something ? > > The QML engine doesn't use the QVariant API for accessing things in a > QVariant. So capabilities you have when using QVariant/Q_PROPERTY are not > available in QML. This is probably fixable, but I'm not sure it's understood > by the people who know QML well enough to fix it. > > QGuiApplication app(argc, argv); > > QList<QUmlObject*> l; > QUmlObject *o1 = new QUmlObject; > Q_SET_OBJECT_NAME(o1); > l.push_back(o1); > QUmlObject *o2 = new QUmlObject; > Q_SET_OBJECT_NAME(o2); > l.push_back(o2); > > QVariant v = QVariant::fromValue(l); > > if (v.canConvert<QVariantList>()) { > QSequentialIterable seqIter = v.value<QSequentialIterable>(); > qDebug() << seqIter.size(); > > foreach(const QVariant &item, seqIter) { > qDebug() << item; > } > } > > QQmlEngine engine; > engine.rootContext()->setContextProperty("_objList", v); > QQmlComponent component(&engine); > component.setData("import QtQuick 2.0\nItem { Component.onCompleted : > console.log(_objList), _objList.length() }", QUrl()); > component.create(); > > > 2 > QVariant(QUmlObject*, QUmlObject(0xa05920, name = "o1") ) > QVariant(QUmlObject*, QUmlObject(0xa11190, name = "o2") ) > QVariant(QList<QUmlObject*>) > <Unknown File>: TypeError: Object [object Object] has no method 'length' > >
Well, I'm directly registering all required data converted to QVariantData by now. I'll try to investigate further in the beginning of July. Thanks Stephen and Allan, > > > Thanks, > > -- > Stephen Kelly <stephen.ke...@kdab.com> | Software Engineer > KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company > www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090 > KDAB - Qt Experts - Platform-Independent Software Solutions > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest