How to use qMRMLSubjectHierarchyTreeView

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
2021-03-19 16 34 16

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:

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
(you can get to signal/slot mode by pressing F4)

In general, as suggested by the guide, it is a good idea to take existing Slicer modules as example when developing a new one.

2 posts were merged into an existing topic: qMRMLSubjectHierarchyTreeView vs2022 error LNK2019