[Qgis-developer] Composer Window loses SIGNAL/SLOT connection?

Düster Horst Horst.Duester at bd.so.ch
Wed Aug 31 05:37:59 EDT 2011


Hi   
  
My aim is to add an additional toolBar with one button the all ComposerWindows I open. I created the following code to achieve that.  
  
  def __init__(self, iface):  
    self.composerWindow = {}  
    self.myPrintAction = {}  
    myApp = self.iface.mainWindow()    
    QObject.connect(myApp, SIGNAL("composerAdded(QgsComposerView*)"), self.initPrintEnvironment)  
  
  def initPrintEnvironment(self,  myComposerView):  
      self.printMenue = PrintMenue(self.iface,  myComposerView)  
      self.composerWindow[myComposerView] = myComposerView.composerWindow()  
      myToolBar = QToolBar()  
      self.myPrintAction[myComposerView] = QAction(QIcon(), "SO!GIS Print",  self.composerWindow[myComposerView])  
      myToolBar.addAction(self.myPrintAction[myComposerView])  
      self.composerWindow[myComposerView].addToolBar(myToolBar)  
      QObject.connect(self.myPrintAction[myComposerView], SIGNAL("triggered()"), self.printMenue.run)         
  
  
The code logic works fine when I open the first composer window. A new toolbaar with one button and the text SO!GIS Print is created. Click on this button starts the expected printMenue. The composer 1 window is still open. Now I open a second composer window. Everything works fine in this window. But now when I switch back to composer1 window. A click on the does nothing. I can open composer windows as much as I like. Only the last created composer window has a functioning button.  
  
Im not shure weather it is as problem of my code or the problem is hidden deeper in the QGIS code.  
  
Ill apprecciate an help or hint.  
  
Regards  
Horst  
  
------------------------------------------------  
  
Dr. Horst Düster  
  
Kanton Solothurn  
Bau- und Justizdepartement  
Amt für Geoinformation  
Rötistrasse 4  
CH-4501 Solothurn  
  
Telefon ++41(0)32 627 25 32  
Telefax ++41(0)32 627 22 14  
  
mailto:horst.duester at bd.so.ch  
http://www.agi.so.ch


More information about the Qgis-developer mailing list