Skip to content

Commit

Permalink
ParamTab: Make sure we update correct model
Browse files Browse the repository at this point in the history
So that changes on param update will be reflected.

Fixes: bitcraze#560
  • Loading branch information
jonasdn committed Jan 25, 2022
1 parent 8bdcdf7 commit b48f668
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cfclient/ui/tabs/ParamTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def updated(self, name, value):
"""Callback from the param layer when a parameter has been updated"""
self.value = round_if_float(value)
self.is_updating = False
self.parent.model.refresh()
self.parent.model.proxy.dataChanged.emit(QModelIndex(), QModelIndex())

def child_count(self):
"""Return the number of children this node has"""
Expand Down Expand Up @@ -115,6 +115,10 @@ def __init__(self, parent, mainUI):
self._red_brush = QBrush(QColor("red"))
self._enabled = False
self._mainUI = mainUI
self.proxy = None

def set_proxy(self, proxy):
self.proxy = proxy

def set_enabled(self, enabled):
if self._enabled != enabled:
Expand Down Expand Up @@ -305,6 +309,7 @@ def __init__(self, tabWidget, helper, *args):
self.proxyModel = ParamTreeFilterProxy(self.paramTree)
self.proxyModel.setSourceModel(self._model)
self.proxyModel.setRecursiveFilteringEnabled(True)
self._model.set_proxy(self.proxyModel)

@QtCore.pyqtSlot(str)
def onFilterChanged(text):
Expand Down

0 comments on commit b48f668

Please sign in to comment.