[PyQt] Signal on Selection in QTreeView
Kevin
fossks at cox.net
Mon Mar 17 20:31:01 GMT 2008
Andreas,
The problem is that my connect statement does not call the
appropriate function.
I've done some searching based on your recommendations, yet I have
not been able to find a basic example I can understand.
Could you point me to a simple example that would take a list with
columns and can return the row number of the row that is selected? I
believe that I can adapt this into my app.
Kevin
Sent from my iPhone
On Mar 17, 2008, at 11:16 AM, Andreas Pakulat <apaku at gmx.de> wrote:
> On 17.03.08 10:22:05, fossks at cox.net wrote:
>> Hi,
>> I'm trying to use a list that contains a media library react to a
>> user clicking on an item in the list. When clicked, the details of
>> the item would show up in a GroupBox elsewhere on the screen.
>> However, at this time I'm a little stumped on Lists/Trees/Models/
>> Views.
>>
>> I'm including the function that is called when the library is
>> opened. You can see that I have a connection to the listview call
>> (self.lv). I also have a backup in case this doesn't work which
>> is a button to get the details. However, I would like to have it
>> such that whichever item is selected/highlighted, would get shown
>> in the item details group box.
>>
>> I've likely missed the implementation of this by a mile, and I
>> need some help. I've checked for examples but either they don't
>> seem to do the same as I want or they are too complicated.
>>
>> Please let me know if anyone has some advice.
>
> So what exactly is your problem?
>
>> self.lv = QTreeView()
> ....
>> self.connect(self.lv, SIGNAL("currentTextChanged(const
>> QString&)"), self.item_selected)
>
> This won't work. There's no such signal on a QTreeView. You should
> look
> up the API in the PyQt docs (or Qt docs) to see which kind of signal
> you
> can use. Probably though you need to connect to the SelectionModel of
> your treeview to get notified about selection changes. See
> QTreeView.selectionModel()
>
> Andreas
>
> --
> You will be aided greatly by a person whom you thought to be
> unimportant.
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
More information about the PyQt
mailing list