PDA

View Full Version : How to pass variables as reference from C++ to QML



dmendizabal
9th February 2012, 02:56
I need to expose a (slot) function from C++ into QML with parameters as reference to be used on the QML side:

C++ side

class A : public QObject
{

public slot:
void func(int& i, QString& s);
}


QML side

onClicked: {
objectA.func(i,s)
..do something with i
..do something with s
}

When I run the application, I receive an error message saying that javascript doesn't recognise i and s parameters. Any idea?

Le_B
17th February 2012, 14:39
we will need more info:
in your javascript i and s doesn't seems to be defined.
were do they come from ?