[PyQt] Performance problems with QSortFilterProxyModel
Steve Borho
steve at borho.org
Wed May 12 16:10:29 BST 2010
On Wed, May 12, 2010 at 1:04 AM, Mark Summerfield <list at qtrac.plus.com> wrote:
> On 2010-05-12, Steve Borho wrote:
>> Hello,
>>
>> The TortoiseHg project is currently porting all of our PyGTK apps to
>> PyQt, This has been going pretty well so far, but I've hit a snag with
>> our file status browser.
>>
>> I have a simple QAbstractTableModel (4 columns) being displayed in a
>> QTreeView. After connecting a QSortFilterProxyModel between the tree
>> view and the data model, reloading the model became very expensive for
>> moderately sized data sets. After calling setSourceModel() with a
>> model of 555 rows, I counted over 3 million calls to the model data()
>> method, which takes about 15 seconds.
>
> Have you tried switching off sorting just before resetting the model and
> then switching it back on afterwards?
I just tried with this:
tm = MyTableModel(data)
tv.setSortingEnabled(False)
proxy.setSourceModel(tm)
tv.setSortingEnabled(True)
But it made no performance difference.
--
Steve Borho
More information about the PyQt
mailing list