[PyQt] How to have QML interpret a property as null (instead of undefined)?
russ at perspexis.com
Thu Oct 12 16:24:22 BST 2017
Solution found: Returning a freshly instantiated QObject() does the trick.
QML interprets this as a null. ie:
@pyqtProperty(QVariant, notify = publicPropertyChanged)#'QDateTime')
if self._my_date is None:
return QObject() # QML interprets this as null
return QDateTime(self._my_date) # no PyQt autoconvert for
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt