gsv-chris
9th January 2015, 15:31
Hello,
we have an application that heavily integrates C++ and QML. Now, the need arises to call a javascript method defined on a QML component with a parameter that is a QQuickItem *. Here is the relevant QML code:
Rectangle {
function show(targetItem) {
_internal_stackView.push({item:targetItem,destroyO nPop:false})
}
}
from C++, I would like to do this:
QMetaObject::invokeMethod(m_qmlItem, "show", Q_RETURN_ARG(QVariant, retval), Q_ARG(QQuickItem *, nextItemToShow));
but alas, there seems to be no way to pass anything but primitve values (those supported by QVariant) as method parameter. The code compiles, but upon execution there is a message in the console that the parameter is inacceptable. I have also not found any other way to pass the "nextItemToShow" (context property doesn't work because context not writeable, QML property has the same restrictions as QML method)
Any suggestions?
thanks,
Chris
we have an application that heavily integrates C++ and QML. Now, the need arises to call a javascript method defined on a QML component with a parameter that is a QQuickItem *. Here is the relevant QML code:
Rectangle {
function show(targetItem) {
_internal_stackView.push({item:targetItem,destroyO nPop:false})
}
}
from C++, I would like to do this:
QMetaObject::invokeMethod(m_qmlItem, "show", Q_RETURN_ARG(QVariant, retval), Q_ARG(QQuickItem *, nextItemToShow));
but alas, there seems to be no way to pass anything but primitve values (those supported by QVariant) as method parameter. The code compiles, but upon execution there is a message in the console that the parameter is inacceptable. I have also not found any other way to pass the "nextItemToShow" (context property doesn't work because context not writeable, QML property has the same restrictions as QML method)
Any suggestions?
thanks,
Chris