2

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

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

1 Answer 1

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
        self.dockwidget.closingPlugin.connect(self.onClosePlugin)

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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