To add Widget on Slice Views

Hi, I am now working on placing my button group widget on the side of the Slice View.
I did it by placing a toolButton on the sliceController.

However, the question here is that I want it place on the view forever, which means that I should not use a toolButton which will make my button list disappear as long as the toolButton is not triggered.
I wish to add widget on the Slice View but I still cannot fix this problem, hope someone can help. Thank you.

The button of the sliceWidget that does not dissapear when is pinned it’s implemented with a ctkPopUpWidget CTK/ctkPopupWidget.cpp at master · commontk/CTK · GitHub

You can check if that is useful for you. I have used them for the exact purpose you describe

Hope this helps

@mau_igna_06
Hi, thank you for the quick reply!
I did what you suggest, it works. However, I encountered a problem which the width of the popupWidget is to large and I could not fix it by now. Do you have any suggestion? Thank you so much.
image

I think the size of the popup is controlled by the widget that is inside it

@mau_igna_06
I did it by this way
image
So I think the horizontal size is fixed by the sliceController horizontal size?

You have chosen the qt.QVBoxLayout = vertical box layout, which puts all widgets in a column. If you want to display widgets in a row you can use qt.QHBoxLayout.

1 Like

@lassoan Hello, Thanks for your reply.
I did what you suggest and it looks great as the image below.
image

However, I still wish it to be a vertical button table. Which looks like
the image below but with a narrow width
image
The problem is that as long as the popupWidget is added under the sliceController().layout(), the width will be as large as the slice Controller layout. Which I want the white blank to disappear as the above image shows.

If you want to get vertical button layout then I would recommend the solution that @ungi described above.

1 Like

@lassoan I see, I will try it later.
Thank you so much for the reply.