[PyQt] signal-slot connect problem

Phil Thompson phil at riverbankcomputing.co.uk
Tue Jan 8 17:26:53 GMT 2008


On Tuesday 08 January 2008, Martin Höfling wrote:
> Hi all,
>
> I am trying to create a filter Toolbar bar class, filtering a model.
>
> why does the following connect command  in the loadModel Method not work?:
>
> class FilterToolBar(QToolBar):
>     def __init__(self):
>         super(FilterToolBar,self).__init__(QString("Filter"))
>         self.expFilterCombo=QComboBox()
>         self.projFilterCombo=QComboBox()
>         self.expFilterCombo.setVisible(True)
>         self.projFilterCombo.setVisible(True)
>         self.addWidget(self.expFilterCombo)
>         self.addWidget(self.projFilterCombo)
>         self.expFilterCombo.setEditable(True)
>         self.projFilterCombo.setEditable(True)
>
>     def loadModel(self,  proxymdl1,  proxymdl2, model):
>         self.proxymdlexp=proxymdl1
>         self.proxymdlproj=proxymdl2
>         self.expFilterCombo.clear()
>         self.projFilterCombo.clear()
>         self.expFilterCombo.clearEditText()
>         self.projFilterCombo.clearEditText()
>         exps=model.experiments.keys()
>         projs=model.projects.keys()
>         addToComboBox(exps, self.expFilterCombo)
>         addToComboBox(projs, self.projFilterCombo)
>
> #problem section start
>         self.connect(self.expFilterCombo, SIGNAL("editTextChanged()"),
> self.expFilterChanged)
>         self.connect(self.projFilterCombo, SIGNAL("editTextChanged()"),
> self.projFilterChanged)
> #problem section stop
>
>     def expFilterChanged(self):
>        print "Filter Exp update"
>       
> self.proxymdlexp.setFilterFixedString(self.expFilterCombo.itemText())
> self.proxymdlexp.setFilterKeyColumn(EXPERIMENT)
>
>     def projFilterChanged(self):
>        print "Filter Proj update"
>       
> self.proxymdlproj.setFilterFixedString(self.projFilterCombo.itemText())
> self.proxymdlproj.setFilterKeyColumn(PROJECT)
>
> The filter toolbar is created on startup and the loadModel Method is called
> when a new model has been loaded. Nothing happens if i change the text.

Because there is no signal with that signature - you've missed out the 
argument type.

Phil



More information about the PyQt mailing list