2

I would like add my plugin icon to the status bar at the bottom of the screen. How would I do that? (QGIS API documentation on statusBar() seems to be leading to the QT docs and that site is down right now)

1 Answer 1

3

It's quite simple.

Create QToolButton class instance by calling (might be in init() section):

self.button = QToolButton()

Then in initGui() method put this lines:

#set default action for this button (I've chosen my second action, so that's why I put 1st index)
self.button.setDefaultAction(self.actions[1])

#add the button to statusbar
self.iface.mainWindow().statusBar().addPermanentWidget(self.button)

Last thing, that might be useful is adding this line to unload() method:

self.iface.mainWindow().statusBar().removeWidget(self.button)

It will prevent button to get multiple, e. g. after you reload a plugin.

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.