Left and Right Panel Ratio

I want to know how the ratio of left panel and right panel work in slicer, which can be adjust by us. Which Slicer code-base file I have to explore to learn “how this actually work with the help of particular program”?

Three screenshot is attached.

It is all standard Qt behavior. Slicer does not impose any extra constraints, but Qt computes the allowed sizes for each section of the GUI (based on sizing policies set in each widget).

1 Like

Sure, I will explore Qt.
But I want to know which UI file I’ve to work on to learn this behavior for sliding left and right panel.

Often, hiding the Data Probe (lower left widget in Slicer main window) solves the problem of randomly resizing module panels, which is an extremely annoying feature of Slicer UI.

If the problem still persists, you could insert this code on the python interactor to force a fixed with on the module panel and its contents. Or add this code to your module setup function so it is automatically applied every time you open your module (if you are working on a custom module):

modulePanelDockWidget = slicer.util.mainWindow().findChildren(‘QDockWidget’,‘PanelDockWidget’)[0]
modulePanelDockWidget.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Expanding)
modulePanelScrollArea = modulePanelDockWidget.findChild(“QWidget”, “dockWidgetContents”)
modulePanelScrollArea.setSizePolicy(qt.QSizePolicy.Fixed, qt.QSizePolicy.Expanding)

Thanks, I have done that before.
But I want to know how this left and right panel in screenshot above works. Which GUI file I have to explore?
For example: If I say, I want to fix that left and right panel in the ratio of 25:75 then how to do it.

Since Qt dynamically changes the layout based on sizing policies of every visible widget. If you want to know what sizes the left panel may end up in various scenarios, you would need to review size policies of all the widgets of all the modules that you may use. This is of course practically infeasible.

Therefore, if you need to force a certain width for the left panel then probably your only option is to force a specific size as @ungi described above. You can query the screen size to compute how many voxels 25% of the screen width corresponds to.