Second layout manager rendering issue

I have a second layout manager that I’m using in an outside window (Slicer main window not displayed). Does anyone recognize what this rendering issue might mean? Not setting some size policy correctly?

layout_widget = slicer.qMRMLLayoutWidget()
layout_widget.setMRMLScene(slicer.mrmlScene)
layout_manager = slicer.qSlicerLayoutManager()
layout_manager.setMRMLScene(slicer.mrmlScene)
layout_widget.setLayoutManager(layout_manager)
slicer.app.setLayoutManager(layout_manager)

slicer_views_layout = self.findChild(qt.QVBoxLayout, "slicer_views_layout")
slicer_views_layout.addWidget(layout_widget)

and another…

I haven’t seen these artifacts before, but it may be because you set the layout manager to Slicer app. This is how a second layout manager is created in an existing slicelet:

So no layout manager is created explicitly and it is not set to the app. I think it should not be set to the app if you use a second window, because the Slicer app layout manager corresponds to the main Slicer window’s layout.
Check out the rest of the file for usage (see self.layoutWidget.layoutManager()).

@cpinter, you were correct about setting the layout manager to slicer app causing the issues. I commented out the lines as seen below and the rendering issues have appeared to go away.

layout_widget = slicer.qMRMLLayoutWidget()
layout_widget.setMRMLScene(slicer.mrmlScene)
# layout_manager = slicer.qSlicerLayoutManager()
# layout_manager.setMRMLScene(slicer.mrmlScene)
# layout_widget.setLayoutManager(layout_manager)
# slicer.app.setLayoutManager(layout_manager)

slicer_views_layout = self.findChild(qt.QVBoxLayout, "slicer_views_layout")
slicer_views_layout.addWidget(layout_widget)
1 Like