Skip to content Skip to sidebar Skip to footer

How Can I Send A Python Dictionary To A QML Interface With A Signal?

I want to send dictionaries, containing data that I need to use to dynamically create qml objects, from a PySide2 class to a QML interface and since I need to do it in response to

Solution 1:

The signature you have to use in the signal is QVariant:

class Test1(QObject):
    theSignal = Signal('QVariant')

    @Slot(int)
    def catchInt(self,caught):
        print("Caught: {0}".format(caught))
        testDict = {"myAnswer":caught}
        self.theSignal.emit(testDict)

Post a Comment for "How Can I Send A Python Dictionary To A QML Interface With A Signal?"