Connecting C++ signal to QML function with arguments
-
wrote on 23 Mar 2012, 11:46 last edited by
Connecting a C++ signal to a QML function seems to work fine if the QML function has no arguments.
But if the QML function has an argument, how can I connect a signal to it? What is the type of the argument? QVariant? -
wrote on 25 Mar 2012, 21:46 last edited by
name the parameters in your signal declaration, something like this
@void mySignal(int value);@
and you can get the parameter value by using that name. for example
@
connections {
target: engineonMySignal: {
console.log(value)
}
}
@ -
wrote on 26 Mar 2012, 07:33 last edited by
Thanks. Problem is, I need to connect the signal to the QML function from C++, since I don't know the name of the signal/function to connect until runtime.
1/3