Im able to implement zoom in and zoom out functionality as described in the PyQGIS developer cookbook using a tool bar. I would like to have buttons that display above my map canvas layer and have the same functionality as oppose to using a toolbar
1 Answer
Using PyQGIS, you're able to manipulate pyqgis calls and make plugins. You cannot add content to the QGIS application. This would be done in CPP. You can take a look at the following pull request, which add a button in the subform.
https://github.com/qgis/QGIS/pull/1682/commits
What you may want is in fact to add a toolbar or a menu in the QGIS application using PyQGIS in the form of a plugin.
Take a look at plugin building: http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html
and you will add you're toolbar with the following line to the QGIS main window:
self.toolbar = self.iface.addToolBar('My toolbar')
-
@Marcus is not asking about how to add content to QGIS, but to a standalone application built with PyQGIS. Moreover, he has told us he already had success with adding toolbars and would like a different approach. Commented Jan 19, 2015 at 12:44
-
As he must have a ui file (isn't it ?), a button can simply be added there.– GilliMCommented Jan 19, 2015 at 14:27