park
(PARKTAEYOUNG)
April 7, 2024, 9:56am
1
Hi all,
I would like to customize of qMRMLSliceControllerWidget
My code is like this (there is no error), but it is not work well.
Especially, the QLabel is not change and the maximize Button is not hide
Can I get a solution for this?
for viewColor in ["Red", "Green", "Yellow"]:
widgets2D = layoutManager.sliceWidget(viewColor).findChild("qMRMLSliceControllerWidget")
sliderWidget = widgets2D.findChild("qMRMLSliderWidget")
sliderWidget.setVisible(False)
buttons2D = widgets2D.findChildren('QToolButton')
for button in buttons2D:
button.setVisible(False)
viewLabel = widgets2D.findChild("QLabel", "ViewLabel")
if viewColor == "Red":
viewLabel.setText("Axial")
if viewColor == "Green":
viewLabel.setText("Coronal")
if viewColor == "Yellow":
viewLabel.setText("Saggital")
font = qt.QFont()
font.setPointSize(12)
font.setBold(True)
viewLabel.setFont(font)
viewLabel.setAlignment(qt.Qt.AlignLeft)
qiqi5210
(Mary)
April 7, 2024, 12:58pm
2
layoutManager=slicer.app.layoutManager()
for viewColor in ["Red", "Green", "Yellow"]:
widgets2D = layoutManager.sliceWidget(viewColor).findChild("qMRMLSliceControllerWidget")
sliderWidget = widgets2D.findChild("qMRMLSliderWidget")
sliderWidget.setVisible(False)
buttons2D=slicer.util.findChild(widgets2D, 'MaximizeViewButton')
buttons2D.hide()
park
(PARKTAEYOUNG)
April 8, 2024, 7:43am
3
Using this code, it disappears like in the video and then reappears.
layoutManager = slicer.app.layoutManager()
twoDwidget = layoutManager.sliceWidget("Red")
twoDwidgetBar = twoDwidget.findChild("qMRMLSliceControllerWidget")
button = twoDwidgetBar.findChild("QToolButton", "MaximizeViewButton")
button.hide()
lassoan
(Andras Lasso)
April 8, 2024, 5:19pm
4
Maximize/restore button state is managed by the widget, so you won’t be able to permanently change visibility by low-level under-the-hood manipulations. Instead, you can hide the entire qMRMLViewControllerBar or implement a flag that allows disabling of the maximize/restore feature.
park
(PARKTAEYOUNG)
April 9, 2024, 3:53am
5
I got a soultion about it
for controllerBar in slicer.util.mainWindow().findChildren("qMRMLViewControllerBar"):
controllerBar.showMaximizeViewButton = False
lassoan
(Andras Lasso)
April 9, 2024, 4:26pm
6
You may still be able to maximize the view by using the right-click menu or double-click on the view. That may show the maximize button again.
park
(PARKTAEYOUNG)
April 12, 2024, 2:00am
7
I think it works well. It dose not appear again.