[PyKDE] treeWidget in QT designer

Andreas Pakulat apaku at gmx.de
Wed Jul 26 12:40:44 BST 2006


On 26.07.06 13:52:30, kakada wrote:
> curItem = self.ui.treeWidget.itemAt(1,1)
> self.ui.treeWidget.setCurrentItem(curItem)
> It's ok.
> 
> Then I want it jump to 4th row by doing
> 
> curItem = self.ui.treeWidget.itemAt(4,1)
> self.ui.treeWidget.setCurrentItem(curItem)
> This time is not ok for me, It goes somewhere else.

Let me guess, it goes to the 2nd column in the first row?

We just had this on qt-interest, you're using the wrong function.

>  I have read the document about Qtreewidget, but I found it is difficult
> to understand.

I don't really see why the documentation is difficult to understand:

QTreeWidgetItem * QTreeWidget::itemAt ( int x, int y ) const
This is an overloaded member function, provided for convenience.
Returns a pointer to the item at the coordinates (x, y).

It clearly states that it gives you the item at coordinates (x,y),
coordinates in a GUI framework typically mean screen coordinates.

What you're looking for is the item(row,col) function.

Andreas

-- 
Don't look now, but there is a multi-legged creature on your shoulder.




More information about the PyQt mailing list