Screen flash when the mouse move to the module

Screen flash when the mouse move to the module.

class testWidget(object):

def init(self, parent = None):

if not parent:
  self.parent = slicer.qMRMLWidget()
  self.parent.setLayout(qt.QVBoxLayout())
  self.parent.setMRMLScene(slicer.mrmlScene)
else:
  self.parent = parent
self.layout = self.parent.layout()
if not parent:
  self.setup()
  self.parent.show()

def setup(self):
# Instantiate and connect widgets …

#
#
# Parameters Area
#
parametersCollapsibleButton = ctk.ctkCollapsibleButton()
parametersCollapsibleButton.text = "Parameters"
self.layout.addWidget(parametersCollapsibleButton)
parametersFormLayout = qt.QFormLayout(parametersCollapsibleButton)

This happens because there is nothing the module GUI that would constrain the width of the panel, so the panel is resized to the minimum necessary. The minimum size depends only on “Data Probe” panel content (at the bottom), which is changing when you move over/away from a slice view.

At some point, we’ll rework the Data Probe panel to have more robust size policy, but until then you can fix this by setting a suitable size policy in widgets in your module (e.g., set preferred or minimum size for the button).