# Texts module does not observe changed nodes

**URL:** <https://discourse.slicer.org/t/texts-module-does-not-observe-changed-nodes/12533>\
**Category:** Development\
**Tags:** texts\
**Created:** [July 14, 2020, 2:39pm UTC](https://discourse.slicer.org/t/texts-module-does-not-observe-changed-nodes/12533 "2020-07-14T14:39:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joachim](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@joachim](https://discourse.slicer.org/u/joachim)\
**Post date:** [July 14, 2020, 2:39pm UTC](https://discourse.slicer.org/t/texts-module-does-not-observe-changed-nodes/12533/1 "2020-07-14T14:39:53Z")

</div>

I’m working on [adding Markdown and HTML support](https://discourse.slicer.org/t/text-annotations/11558/18) 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?

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [July 14, 2020, 2:49pm UTC](https://discourse.slicer.org/t/texts-module-does-not-observe-changed-nodes/12533/2 "2020-07-14T14:49:48Z")

</div>

qMRMLTextWidget currently only observers TextModifiedEvent ([https://github.com/Slicer/Slicer/blob/73ca5332aeeee92f8b8ad015f3a03ee8d50c0b99/Modules/Loadable/Texts/Widgets/qMRMLTextWidget.cxx#L147](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.

---

<div class="post-metadata">

**Author:** ![joachim](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@joachim](https://discourse.slicer.org/u/joachim)\
**Post date:** [July 14, 2020, 3:03pm UTC](https://discourse.slicer.org/t/texts-module-does-not-observe-changed-nodes/12533/3 "2020-07-14T15:03:17Z")

</div>

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