# How to use qMRMLSubjectHierarchyTreeView

**URL:** <https://discourse.slicer.org/t/how-to-use-qmrmlsubjecthierarchytreeview/16632>\
**Category:** Development\
**Created:** [March 19, 2021, 8:59am UTC](https://discourse.slicer.org/t/how-to-use-qmrmlsubjecthierarchytreeview/16632 "2021-03-19T08:59:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kejuhn](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kejuhn/32/10826_2.png) [@kejuhn](https://discourse.slicer.org/u/kejuhn)\
**Post date:** [March 19, 2021, 8:59am UTC](https://discourse.slicer.org/t/how-to-use-qmrmlsubjecthierarchytreeview/16632/1 "2021-03-19T08:59:19Z")

</div>

I create an extension, and add a loadable module “PluginA”.  
In default UI, I add a qMRMLSubjectHierarchyTreeView by Qt Designer.  
After build extension in Visual Studio, several errors occurred.  
‘qMRMLSubjectHierarchyTreeView.h’: No such file or directory in ui\_qSlicerPluginAModuleWidget.h  
Are there any settings missing?  
How to solve this error, Thanks!

 ![2021-03-19 16 34 32](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/a/1a3f638fbfd8ea0a50aeb21d0eade8da5f4f6b7b.png)  
 ![2021-03-19 16 34 16](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/c/8cf34bf9dcb6f26812dc5495819a985b8c1fc116.png)

---

<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:** [March 19, 2021, 9:33am UTC](https://discourse.slicer.org/t/how-to-use-qmrmlsubjecthierarchytreeview/16632/2 "2021-03-19T09:33:28Z")

</div>

The error is probably due to the fact that the necessary include directories are not added in the `CMakeLists.txt` file. See examples in the Slicer source code, for example:

> <https://github.com/Slicer/Slicer/blob/main/Modules/Loadable/Data/CMakeLists.txt#L20>

Also just to prevent further surprises any MRML object, including the SH tree view, needs to be connected in Designer to the mrmlSceneChanged event, like this:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/a/0a13afed7bc68d00b8abb6e3e58f3c50aae1e264.png)  
(you can get to signal/slot mode by pressing F4)

In general, as suggested by the [guide](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Modules#Loadable_Modules), it is a good idea to take existing Slicer modules as example when developing a new one.

---

<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 2, 2022, 10:01am UTC](https://discourse.slicer.org/t/how-to-use-qmrmlsubjecthierarchytreeview/16632/3 "2022-09-02T10:01:09Z")

</div>

2 posts were merged into an existing topic: [qMRMLSubjectHierarchyTreeView vs2022 error LNK2019](https://discourse.slicer.org/t/qmrmlsubjecthierarchytreeview-vs2022-error-lnk2019/25021/3)
