mmertama/FigmaQML

Connecting signals in FigmaQmlInterface.hpp to another class

Closed this issue · 1 comments

Thank you for this great project. The recent updates are fantastic and the project is making my Qt app development much quicker.

I am relatively new to Qt/C++, so forgive me if the answer is obvious.
I am trying to use the eventReceived signal in FigmaQmlInterface.hpp to run a function in another file. I have connected it to a slot in my Landing class constructor:

Landing::Landing(QObject *parent) :  QObject(parent) {
    bool connected = connect(FigmaQmlSingleton::instance(), &FigmaQmlSingleton::eventReceived, this, &Landing::onEventReceived);
}

However, my function onEventReceived never gets called. Printing connected returns true.

Am I doing this properly?

Oops It looks like I have a bug.... that instance is not what it is supposed to be. I will look at that, but you get the correct instance from
auto* singleton = engine.singletonInstance<FigmaQmlSingleton*>("FigmaQmlInterface", "FigmaQmlSingleton"); ... where engine is yout app's qqmlengine