Move a Qt Dockwidget

Hi to all the community.

The task today is move my DockWidgetArea from here:

to here:

At this moment I’m doing it manually, but I’m sure that specifying the correct configuration it could be made automatically.

My current function is:

def createDockInterface():
    # Delete the statusBar to have cleaner view:
    slicer.util.mainWindow().setStatusBar(None)
    
    # Create and name the widget:
    dock_widget = qt.QDockWidget("ST Assistant v16")
    dock_widget.setObjectName('SegmentTracerDockWidget')
    
    
    # Add the Welcome text:
    label = qt.QLabel("Welcome to SegmentTracer. Loading and resampling data")
    dock_layout = qt.QVBoxLayout()
    dock_layout.addWidget(label)
    dock_content = qt.QWidget()
    dock_content.setLayout(dock_layout)
    dock_widget.setWidget(dock_content)
    
    # Display the widget in bottom left corner:
    slicer.util.mainWindow().addDockWidget(qt.Qt.LeftDockWidgetArea, dock_widget)   

Thanks a lot for any help :slight_smile:

Maybe somebody from the Slicer developer community will chime in, but since this is a pure Qt question (not related to how Qt is used in Slicer), you can probably find answer more easily by searching or asking on Qt forums.

2 Likes