I have an issue with Signal() handling in QT 5.12 with QVariantMap.
My example works fine in QT 5.15 and Python 3.8, but it needs to be compatible with QT 5.12 an Python 3.7.
The Signal seems to be emitted from Python correctly but my log function is not called.
Are there any changes between these version with QVariantMap handling?
I attached the important lines and a link to complete sample.
class WeatherWrapper(QObject):
dataChanged = Signal()
@Property("QVariantMap", notify=dataChanged)
def data(self) -> dict:
return self._data
self.dataChanged.emit()
Connections {
target: weather
function onDataChanged() {
console.log("recevied dataChanged signal")
}
}
complete sample: https://github.com/lutzh86/qmlweathertest/
It's not a problem with QVariantMap. Qt for some reason decided to change the syntax for the Connections
object. In 5.12, you need to do it like this:
Connections {
target: weather
onDataChanged: {
console.log("received dataChanged signal")
}
}
If you do that on 5.15, you will get annoying runtime warnings that the syntax is deprecated but it will still work.