I wonder if it's possible to add an plugin button (QAction) to the print composer toolbar. I only know options to add the plugin-buttons to the plugin,vector or database menu or to own toolbars in the main window of QGIS.

  • 2
    Nice to see you're making progress! If you come up with a possible solution, remember to post it as an answer and not as an edit to your question :) – Joseph Nov 11 '16 at 13:58

I found a way to solve the problem. I am just not sure if self.iface.mainWindow() is the correct parent QObject for this action.

import qgis
from PyQt4.QtCore import *
from PyQt4.QtGui import *

self.activeComposer = self.iface.activeComposers()

for item in self.activeComposer:
    print item.composerWindow().windowTitle()
    if item.composerWindow().windowTitle()=='test123':
        print "ja"
        self.composerWindow = item.composerWindow()
        print self.composerWindow
        self.action = QAction(u"Druckstempel einfügen", self.iface.mainWindow())
        # is self.iface.mainWindow() the correct QObject * parent for this Action?
        self.action.setWhatsThis(u"Druckstempel einfügen")
        self.action.setStatusTip(u"Druckstempel einfügen")


enter image description here

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.