Texts module does not observe changed nodes

I’m working on adding Markdown and HTML support for the Texts module. This module works on vtkMRMLTextNode nodes. If I change such a node outside the Texts module GUI by adding an attribute using the Data module or programmatically, the changes are not reflected in qMRMLTextWidget; the function qMRMLTextWidget::updateWidgetFromMRML() is never called. Is this a bug?

vtkMRMLNode::SetAttribute() should fire a ModifiedEvent according to documentation. But how do qSlicerTextsModuleWidget and qMRMLTextWidget observe these events?

qMRMLTextWidget currently only observers TextModifiedEvent (https://github.com/Slicer/Slicer/blob/73ca5332aeeee92f8b8ad015f3a03ee8d50c0b99/Modules/Loadable/Texts/Widgets/qMRMLTextWidget.cxx#L147).

If you change vtkMRMLTextNode::TextModifiedEvent to vtkCommand::ModifiedEvent it should observe the other changes.

1 Like

Thank you! I’ll take a look at the QVTK_OBJECT macro.