# Data Module: column show/hide branch or node is editable

**URL:** <https://discourse.slicer.org/t/data-module-column-show-hide-branch-or-node-is-editable/3992>\
**Category:** Development\
**Created:** [September 5, 2018, 4:42pm UTC](https://discourse.slicer.org/t/data-module-column-show-hide-branch-or-node-is-editable/3992 "2018-09-05T16:42:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![phcerdan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/phcerdan/32/1559_2.png) [@phcerdan](https://discourse.slicer.org/u/phcerdan)\
**Post date:** [September 5, 2018, 4:42pm UTC](https://discourse.slicer.org/t/data-module-column-show-hide-branch-or-node-is-editable/3992/1 "2018-09-05T16:42:04Z")

</div>

Using a recent Slicer [c88b17d38](https://github.com/Slicer/Slicer/tree/c88b17d38acf99c66892f867aff163a9c07d073a)

 ![Peek%202018-09-05%2012-31](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/c/7c76b84b0ecefdd99ac8d8207869d2ce27547565.gif)

Is this expected? Thanks

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 5, 2018, 4:57pm UTC](https://discourse.slicer.org/t/data-module-column-show-hide-branch-or-node-is-editable/3992/2 "2018-09-05T16:57:35Z")

</div>

This seems to be a bug. Can you give it a try and fix it? I think edit triggers need to be changed. It would be nicer to not show the editable part at all, though.

@cpinter

---

<div class="post-metadata">

**Author:** ![phcerdan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/phcerdan/32/1559_2.png) [@phcerdan](https://discourse.slicer.org/u/phcerdan)\
**Post date:** [September 5, 2018, 8:54pm UTC](https://discourse.slicer.org/t/data-module-column-show-hide-branch-or-node-is-editable/3992/3 "2018-09-05T20:54:08Z")

</div>

> [@lassoan](#):
>
> Can you give it a try and fix it?

I would love it, but not much time right now. That’s why I opened an “issue” and not a PR directly.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [September 6, 2018, 3:34pm UTC](https://discourse.slicer.org/t/data-module-column-show-hide-branch-or-node-is-editable/3992/4 "2018-09-06T15:34:36Z")

</div>

I spent quite a bit of time trying to figure out why the ItemIsEditable flag seems to have no effect in Subject hierarchy, as opposed to the regular qMRMLSceneModel, where it works.

This line is supposed to selectively enable the editable flag which is off by default, I confirmed it with debugging:

> <https://github.com/Slicer/Slicer/blob/master/Modules/Loadable/SubjectHierarchy/Widgets/qMRMLSubjectHierarchyModel.cxx#L777>

  
However it doesn’t matter what this flag says, the cell is always editable.

The same thing is happening here, but in this case the editable flag works as expected.

> <https://github.com/Slicer/Slicer/blob/master/Libs/MRML/Widgets/qMRMLSceneModel.cxx#L936>

I implemented a workaround to prevent editing of the visibility and ID columns. I committed it, so the symptom you reported doesn’t come up any more. If anybody has any idea about the ItemIsEditable mistery, I’d be glad to hear it.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [September 6, 2018, 5:05pm UTC](https://discourse.slicer.org/t/data-module-column-show-hide-branch-or-node-is-editable/3992/5 "2018-09-06T17:05:54Z")

</div>

We teamed up with Andras and with some painful Qt debugging we managed to find the reason why the flag was not used properly. I committed the real fix and removed the previous workaround.

> <https://github.com/Slicer/Slicer/commit/e5a5efbe6a9982ee0dc8f12c45a35e1c96f6e617>

---

<div class="post-metadata">

**Author:** ![phcerdan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/phcerdan/32/1559_2.png) [@phcerdan](https://discourse.slicer.org/u/phcerdan)\
**Post date:** [September 6, 2018, 6:13pm UTC](https://discourse.slicer.org/t/data-module-column-show-hide-branch-or-node-is-editable/3992/6 "2018-09-06T18:13:22Z")

</div>

Thanks @cpinter @lassoan! ✨
