Solved Connect to signals in nested objects
-
Hi together,
I do have a nested QObject structure whereas the objects (classes) are written in C++.
It's like the following
class InnerClass : public QObject { Q_OBJECT public: Q_INVOKABLE void doSomething(); // emits somethingDone() signals: void somethingDone(); } class OuterClass : public QObject { Q_OBJECT Q_PROPERTY(InnerObject* innerObject READ getInnerObject CONSTANT) public: InnerClass *getInnerObject(); .... }
Then, in my QML file I instanciate an OuterClass object.
OuterClass { id: outerObject } function mySomethingDone() { console.log("foobar called") } Component.onComplete: outerObject.innerObject.somethingDone.connect(mySomethingDone)
But now, when the somethingDone signal of the InnerClass instance gets emitted I don't receive anything in my QML code. When I connect to this signal via C++ code, my slot does receive the signal.
Does Qt have a limitation here with nested (C++) objects and QML?
I'm using Qt 5.9.1Best, Michael
-
Okay, the problem was of other origin.
-
Hi and welcome to devnet,
What was that origin ?