# Why \`qMRMLThreeDWidget\` is not supposed to be inherited

**URL:** https://discourse.slicer.org/t/why-qmrmlthreedwidget-is-not-supposed-to-be-inherited/19313
**Category:** Development
**Created:** [August 23, 2021, 11:22am UTC](https://discourse.slicer.org/t/why-qmrmlthreedwidget-is-not-supposed-to-be-inherited/19313 "2021-08-23T11:22:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)
#### Post date: [August 23, 2021, 11:22am UTC](https://discourse.slicer.org/t/why-qmrmlthreedwidget-is-not-supposed-to-be-inherited/19313/1 "2021-08-23T11:22:27Z")

</div>

Hi,

I wanted to set custom `qMRMLThreeDViewControllerWidget` to the `qMRMLThreeDWidget` . But `qMRMLThreeDWidgetPrivate` is declared and defined within `qMRMLThreeDWidget.cxx` (i.e. there is no `qMRMLThreeDWidget_p.h` file). Also there is no protected constructor for inherited classes that follows pimpl idea.

Was it hidden intensionally or is it some kind of a drawback?

By the way the similar class `qMRMLSliceWidget` has `qMRMLSliceWidget_p.h` header and Slicer Astro uses it to add custom button.

---

<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: [August 23, 2021, 2:14pm UTC](https://discourse.slicer.org/t/why-qmrmlthreedwidget-is-not-supposed-to-be-inherited/19313/2 "2021-08-23T14:14:54Z")

</div>

Keeping certain implementation details private is essential for keeping enough degree of freedom for Slicer core developers to make changes without worrying that those changes may break extensions. Pluggable interfaces are available for many things, but implementing and maintaining these interfaces takes significant effort, so they only exist if there is a strong, confirmed need.

qMRMLThreeDWidget is a tiny class, that it is easier for developers to clone and modify rather than implement an API in Slicer core to inject a custom view controller widget or make it usable as a base class. You can also add/remove buttons dynamically at runtime with standard Qt API. But if you have any specific suggestion for changing the API - preferably without taking on significant development effort and maintenance commitment - then let us know.
