qt - QML drops binding after assignment `undefined` -
i have pyqt5 property proper notify-function:
class friendswidgetbackend(qobject): messagecompanionchanged = pyqtsignal() def __init__(self, parent=none): qobject.__init__(self, parent) self._current_message_companion = none @pyqtproperty('qvariant', notify=messagecompanionchanged) def message_companion(self): return qvariant(self._current_message_companion) @message_companion.setter def message_companion(self, message_companion): self._current_message_companion = message_companion self.messagecompanionchanged.emit() everything works until i'll assign variable undefined - when refuses update variable in qml after emiting messagecompanionchanged signal. i've tried set breakpoint - updates application start until undefined assignment:
item { id: rootitem property qtobject friendswidgetbackend onvisiblechanged: { if (!visible) { friendswidgetbackend.message_companion = undefined } } } i'd after experience of c# qml disconnects binding after such assignment. how can avoid behavior?
p.s. binding example:
column { visible: friendswidgetbackend.message_companion ? true : false } p.p.s. not work without binding - tried connect messagecompanionchanged signal qml - not update value after emitting.
p.p.p.s. if change undefined empty js object {} or ({}) binding work not need.
Comments
Post a Comment