[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QTreeWidget and item parents
From: Scott Frankel <frankel () circlesfx ! com>
Date: 2009-08-27 17:49:32
Message-ID: 25362836-0458-4592-9732-829356C91EDF () circlesfx ! com
[Download RAW message or body]
Perfect. Thanks!
Scott
On Aug 27, 2009, at 9:29 AM, Jamie Riotto wrote:
> Scott,
> simply do:
>
> print self.theTree.currentItem().text(0)
> index = self.theTree.currentIndex()
> print "row: ", index.row() # returns row number
> relative to branch parent
> NEW>>> print "parent", index.parent()
>
> Cheers - jamie
>
> On Thu, Aug 27, 2009 at 8:46 AM, Scott
> Frankel<frankel@circlesfx.com> wrote:
>>
>> Hello,
>>
>> How would one identify the parent of a selected item in a
>> QTreeWidget?
>>
>> I have a tree with several branches. Each branch contains leaves
>> with the
>> same names. (See attached sample code.) I'd like to be able to
>> identify
>> that the leave item selected, say "Bbbb," was picked from branch
>> "Three."
>>
>> I'm identifying the selected leaf item with currentItem(). (See
>> line 126 in
>> pickItem()). The currentIndex() method returns indeces that appear
>> to be
>> relative to the leaf's parent, which in this case doesn't help me
>> identify
>> which branch item is the selected item's parent.
>>
>> Thanks in advance!
>> Scott
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> PyQt mailing list PyQt@riverbankcomputing.com
>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
>
> _______________________________________________
> PyQt mailing list PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
Scott Frankel
President/VFX Supervisor
Circle-S Studios
www.circlesfx.com
510-339-7477 (o)
510-332-2990 (c)
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic