[PyQt] a newbie pyqt question, the pyqt book related
Mark Summerfield
mark at qtrac.eu
Thu May 29 12:58:17 BST 2008
On 2008-05-29, lotr py wrote:
> Hi, Sorry for my bad english and PyQt skill.
> I am reading the book "Rapid GUI Programming with Python and Qt The
> Definitive Guide to PyQt Programming", my question is related to
> chap08/mymovies.pyw.
> near the end of MainWindow.updateTable() there is
> if selected is not None:
> selected.setSelected(True)
> self.table.setCurrentItem(selected)
> self.table.scrollToItem(selected)
> what I want to ask is, what's the mean of "selected.setSelected(True)",
> isn't self.table.setCurrentItem(selected) enough here?
> Thank in advance for your reply.
selected is either None or the QTableItem that we want to be selected.
So if it is not None:
selected.setSelected(True) # selects the item
self.table.setCurrentItem(selected) # makes the item the current item
self.table.scrollToItem(selected) # makes the item visible to the user
In a QTableView it is possible to have a selected item that is not the
current item, in other words there are two different concepts "selected
item" and "current item".
--
Mark Summerfield, Qtrac Ltd., www.qtrac.eu
More information about the PyQt
mailing list