Emitting a QObject signal FROM QML
-
Is it possible for QML to have a QObject emit a signal without needing a glue slot in the QObject that with then call emit MySignal?
For example, you click a QML button and you want that action to emit a signal that could be seen by QObjects. It seems like the only way to do this is have a slot somewhere which would then emit a QObject signal.
-
just call the signal from QML, they are normal functions and are invokable from QML.
onClicked: yourCppObject.signal()
-
@GrecKo Thanks, but I think I'm running into a much deeper implementation question. I'm actually trying to emit a signal across a QRemoteObjects from the replica back to the source. I tried adding a test signal to my .rep file and calling it from the QML app which has the replica but nothing happens on the source side. I don't get any error messages or warnings on either end.
The only thing that does work is having a slot in the remote object that emits a signal. I can call that slot from QML and that gets handled on the source side. It's an ugly hack but it works.