Details
Description
Creating some class
CWkStuff.cpp
class CWkStuff: public QObject { Q_OBJECT public: Q_INVOKABLE QVariant doSome(const QVariant &data) const { qDebug() << data; return data; }; }; // class
And use this method in JavaScript
CWkStuff.doSome("hello"); // done CWkStuff.doSome({}); // done CWkStuff.doSome({a: 23, b: {q: [1, 2]}}); // done CWkStuff.doSome([]); // FAILS! // incompatible type of argument(s) in call to doSome(); candidates were // doSome(QVariant)
but if I using
CWkStuff.cpp
Q_INVOKABLE QVariant doSome(const QVariantList &data) const
it's work done. (Without support Map or other types)
That bug from qt_runtime.cpp:641
qt_runtime.cpp
// in function 'convertValueToQVariant' we contain visited object some like that if (value.isObject()) { object = value.toObject(exec); if (visitedObjects->contains(object)) return QVariant(); visitedObjects->add(object); } /* ... */ // But checking for recursive call some like that if (type == Object) { // may be using `value.isObject()` here // Since we haven't really visited this object yet, we remove it visitedObjects->remove(object); }
Attachments
For Gerrit Dashboard: QTBUG-39951 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
92374,2 | Fix fallback conversion of recognized objects | 5.3 | qt/qtwebkit | Status: MERGED | +2 | 0 |