[PyQt] connection to list view and combo pyqt

Peter Liedler peter at liedler.at
Sun Jan 20 10:49:41 GMT 2008


Thanks for the hint. The signal connection to the combo Box now works.
The listView class that provides the signal selectionChanged() is
QAbstractItemView and is declared as
virtual void selectionChanged ( const QItemSelection & selected, const
QItemSelection & deselected )

So I now would connect to the signal with 
self.connect(self.listViewTitle,
SIGNAL("selectionChanged(QItemSelection, QItemSelection)"),
self.titleSelected)

That doesn't work until now, I'll try other constellations.

thx Peter

On Son, 2008-01-20 at 01:26 +0100, David Boddie wrote:
> On Sat Jan 19 13:41:12 GMT 2008, Peter Liedler wrote:
> 
> > In my main view I have several connect strings to buttons and
> > checkBoxes. They work fine.
> > 
> >         self.connect(self.checkBoxRipLongest, SIGNAL("clicked()"),
> > self.toggleRipLongest)
> >         self.connect(self.listViewTitle, SIGNAL("selectionChanged()"),
> > self.titleSelected)
> >         self.connect(self.comboBoxLanguage, SIGNAL("currentIndexChanged()"),
> > self.languageSelected)
> 
> Are you sure they all work? The problem below would make me suspicious that
> the third one wouldn't work.
> 
> > But the connection string to a QComboBox and a QListView do not work.
> > What am I doing wrong here?
> > 
> >         self.connect(self.listViewTitle, SIGNAL("selectionChanged()"),
> > self.titleSelected)
> >         self.connect(self.comboBoxLanguage, SIGNAL("currentIndexChanged()"),
> > self.languageSelected)
> > 
> > I want to call the self.titleSelected function when another index in the
> > list is filled, but obviously the signal is never emitted. (I have put a
> > print statement there). Same with the comboBox.
> 
> You need to include the argument types in the signal declaration. For
> example, currentIndexChanged() is actually available in two forms:
> 
>   currentIndexChanged(int)
>   currentIndexChanged(const QString&)
> 
> I believe you can simplify the second form to
> 
>   currentIndexChanged(QString)
> 
> if that's the one you want.
> 
> Which class provides the selectionChanged() signal?
> 
> > Please forgive me to ask such a simple question.
> 
> That's what we're here for!
> 
> David
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 



More information about the PyQt mailing list