Rem Rem - 1 month ago 10
C++ Question

Connect to C++ signal from QML

I want to connect to C++ signals from QML like this:

action.onMouseUp = function() {
console.log("mouse up>>");
}


And declare in my C++ object this signal:

signals:
void mouseUp(const QPointF point);


But I'm getting QML Error: TypeError: Cannot assign to read-only property "mouseUp". What might the problem be?

Answer

You need to call connect method of action.onMouseUp object.

action.onMouseUp.connect( function() {
    console.log("mouse up>>");
});
Comments