# Customizing 3d views with qt widgets not working properly

**URL:** <https://discourse.slicer.org/t/customizing-3d-views-with-qt-widgets-not-working-properly/13345>\
**Category:** Support\
**Created:** [September 5, 2020, 5:57am UTC](https://discourse.slicer.org/t/customizing-3d-views-with-qt-widgets-not-working-properly/13345 "2020-09-05T05:57:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chintha\_Siva\_Prasad](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chintha_siva_prasad/32/7766_2.png) [@Chintha\_Siva\_Prasad](https://discourse.slicer.org/u/Chintha_Siva_Prasad)\
**Post date:** [September 5, 2020, 5:57am UTC](https://discourse.slicer.org/t/customizing-3d-views-with-qt-widgets-not-working-properly/13345/1 "2020-09-05T05:57:53Z")

</div>

I have a layout in which there are three 3d views.I want to put a button(load DICOM) in the topbar(barLayout) of the first threeDView.But when I am running my code many time the button is coming in second or third view node too.Why is this happening?

 ![Screenshot from 2020-09-05 11-19-18](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/7/975b6acea3d4171d8a8b684f7be961f8ee91cc9e.png)

This is my code.But the button is coming in the other windows when close the gui and run again.

 ![Screenshot from 2020-09-05 11-19-31](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/3/c3086eaf74a34900a9f507ecf315801157d55a16.png)

Is this because I not clearing the instances, the slicer is giving me some warnings.

 ![Screenshot from 2020-09-05 11-20-36](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/7/17bd2fd94c5950d72e969981bf73e65801fb1dc7.png)

---

<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, 2020, 10:39pm UTC](https://discourse.slicer.org/t/customizing-3d-views-with-qt-widgets-not-working-properly/13345/2 "2020-09-05T22:39:52Z")

</div>

`theeDWidget(0)` may refer to any of the views. Check the associated view node to determine which view are you actually modifying.

The “Class … has … instance still around” means you have a memory leak in your code: you created a VTK object, added references to it, and have not removed all references before exiting the application. Check out [this page](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Tutorials/MemoryManagement) for more details. This is not related to which view controller widgets the extra button shows up at.
