[PyQt] Trouble with QTreeWidget
Milan Hemžal
milan at 3trees.cz
Tue Dec 9 07:29:06 GMT 2008
On Monday 03 November 2008 01:30:00 Min Li wrote:
Hi,
i tested example basicsortfiltermodel from,
how i get data if i selected any row. I know howto get data for first column,
but cannot get data from second.
# signal:
self.connect(self.tree_postavy,QtCore.SIGNAL("activated ( const QModelIndex &
)"),self.GetTest)
def GetTest(self,n):
print n
# output is: <PyQt4.QtCore.QModelIndex object at 0x1dca518>
print QtCore.QVariant.toString((self.tree_postavy.model().data(n,0)))
# output first column
print QtCore.QVariant.toString((self.tree_postavy.model().data(n,1)))
# output empty string, i
Thanks
> Hi, everyone.I have some trouble to use the signals to trigger events
> QTreeWidget.
>
> The detailed situation is that:
>
> I want trigger a event by click the left button on the items in
> treeWidget. I try to use
>
> <self.connect(self.treeWidget,SIGNAL("activated()"),self.activedFunction)>
> to do this,
>
> the activedFunction doesn't work.
>
> Now, I use <
> self.connect(self.treeWidget,SIGNAL('itemSelectionChanged()'),self.activedF
>unction)>
>
> to do this, the activedFunction can be actived.
>
> However, if I want to store the item which is selected into a local
> variable, how this activedFunction should be defined?
>
> Thanks
>
> Lee
--
Milan Hemžal
3 Trees s.r.o.
--------------------------
Dřevěné podlahy a koupelny
Kontakt info:
GSM +420 775 393 335
www: www.3trees.cz
More information about the PyQt
mailing list