How to dock QGIS plugin window? I am trying

self.iface.addDockWidget(Qt.RightDockWidgetArea, dlg) 

in run method of QGIS Plugin Implementation class, but the dialog keeps appearing as a floating window. dlg is an instance of class inheriting from QtWidgets.QDockWidget

  • Maybe you disabled docking capability of the dockwidget. Aug 10, 2022 at 16:38

1 Answer 1


Check out this run method for my widget :

def run(self):
    """Run method that loads and starts the plugin"""

    if not self.pluginIsActive:
        self.pluginIsActive = True

        if self.dockwidget == None:
            # Create the dockwidget (after translation) and keep reference
            self.dockwidget = FastFieldFillerDockWidget(self.iface)

        # connect to provide cleanup on closing of dockwidget

        # show the dockwidget
        self.iface.addDockWidget(Qt.LeftDockWidgetArea, self.dockwidget)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.