Using PyQt + QML, it's pretty intuitive. However I'm a little stumped. The qml binding 'window.current.summary' complains with the error in the title Cannot read property 'summary' of null
Python:
class DataPoint(QObject):
....
@pyqtProperty('QString')
def summary(self):
print("Retrieving summary: ", self._datapoint.summary)
return self._datapoint.summary
class Weather(QObject):
....
@pyqtProperty(DataPoint, notify=forecastChanged)
def current(self):
return DataPoint(self._forecast.currently())
@pyqtProperty('QString', notify=forecastChanged)
def current_summary(self):
return self._forecast.currently().summary
QML:
Weather {
id: w1
}
Text {
...
id: current_temp
text: w1.current.summary
// text: w1.current_summary // this works
}
Think I've missed something obvious here. I've verified that the 'current' property is indeed interrogated. Retrieving summary is never seen, indicating to me that DataPoint itself is never interrogated. How do we get that QML w1.current.summary to bind as expected?