[PyQt] QSortFilterProxyModel.createIndex from within a slot
callback
Zorg 421
zorglub421 at gmail.com
Fri Feb 27 21:40:34 GMT 2009
Thanks, Mark, upon looking for a way to debug, I got another (clean and
simple) idea:
def onTableRowSelected(self, index):
if index.isValid():
>>> index0 = self.proxyModel.index(index.row(), 0) <<<
qvar = self.proxyModel.itemData(index0)
qst_ip_addr = qvar[0].toString()
self.onDraw(qst_ip_addr)
else:
print "WW: invalid index in table model!"
But your answer will for sure save me hours of pain in the next couple of
weeks.
Thanks.
On Fri, Feb 27, 2009 at 6:41 PM, Mark Summerfield <mark at qtrac.eu> wrote:
> On 2009-02-27, Zorg 421 wrote:
> > Hello PyQt users, I do not know how to use the third argument of
> > createIndex in the following code.
>
> I didn't have time to look at your code, but the third argument must be
> a QModelIndex, specifically the model index of the relevant item's
> _parent_. For top-level items this is easy: QModelIndex(); but inside
> the method using index.parent() should work fine.
>
>
> --
> Mark Summerfield, Qtrac Ltd, www.qtrac.eu
> C++, Python, Qt, PyQt - training and consultancy
> "Programming in Python 3" - ISBN 0137129297
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090227/ce6be7e5/attachment.html
More information about the PyQt
mailing list