Rewrite qMRMLSubjectHierarchyTreeView

我想要修改qMRMLSubjectHierarchyTreeView实现一些功能,但是我不想改动它的源码,所以我创建了一个myTreeView继承于qMRMLSubjectHierarchyTreeView,现在问题是我应该怎么样将slicer中的qMRMLSubjectHierarchyTreeView替换成myTreeView

I want to change qMRMLSubjectHierarchyTreeView implement some functions, but I don’t want to change its source code, so I created a myTreeView inheritance in qMRMLSubjectHierarchyTreeView, now the problem is that I should how the slicer the qMRMLSubjectHierarchyTreeView replace myTreeView

You can either contribute your changes as options in the existing class in Slicer, or you can fork Slicer, in which case the maintenance burden will significantly increase.

1 Like

What are those functions?

The best way to proceed depends on that, because if those functions are generally useful for Slicer users then it makes sense to maintain them in Slicer core. If those features are only useful for your project then you can use existing infrastructure in subject hierarchy that already allows very flexible customization and extension. If current subject hierarchy customization/extension infrastructure in Slicer core are not sufficient then you can improve that.

1 Like

Thank you very much I have changed qMRMLSubjectHierarchyTreeView source I want to achieve