[PyQt] Maintaining index after sort

Marc Rossi mrossi19 at gmail.com
Tue May 31 15:00:57 BST 2011

Andreas -

You actually provided me the answer.  Was not aware of proxy models but once
I added the QSortFilterProxyModel (as shown in the pyqt example) everything
now works.

Thanks again.


On Mon, May 30, 2011 at 1:54 PM, Andreas Pakulat <apaku at gmx.de> wrote:

> On 29.05.11 15:06:17, Marc Rossi wrote:
> > Thanks for the reply.  There must be some core concept of Qt/Model-View
> > programming I am just missing.
> >
> > Makes sense that I can store the data keyed by symbol in the model and
> > update it that way, but I thought I had to emit a dataChanged signal for
> the
> > view to update as shown below:
> >
> >     self.emit(SIGNAL("dataChanged(QModelIndex,QModelIndex)"),
> > self.index(index.row(), COL1), self.index(index.row(), COL5))
> >
> > Doing it this way required me to have the index for the column I wanted
> > refreshed.   I see there is a 'match()' function in the
> QAbstractItemModel
> > class but when I tried that (calling match for every update) things were
> > ridiculously slow.
> Hmm, I don't have that much experience with sorting without a proxy
> model between the real one and the view, but if the model does not get
> notified about changes in its indexes then that sounds like a there's a
> bug somewhere.
> Andreas
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110531/9944ec2a/attachment.html>

More information about the PyQt mailing list