| 221 | return |
| 222 | |
| 223 | def onItemDataChanged( |
| 224 | self, topLeft: QModelIndex, bottomRight: QModelIndex, roles: List[int] |
| 225 | ): |
| 226 | item = self._model.itemFromIndex(topLeft) |
| 227 | if not item or Qt.EditRole not in roles or item.valueItem: |
| 228 | return |
| 229 | |
| 230 | path = getattr(item, "path", None) |
| 231 | if not path: |
| 232 | return |
| 233 | |
| 234 | # 更新关联的widget |
| 235 | value = item.edit |
| 236 | for widget in self._keywidget.get(path, []): |
| 237 | if self.Debug: |
| 238 | print(f"model to view({widget}) = {value}") |
| 239 | self._setValue(widget, path, value, updated=True, block=True) |