Hello,

I've been suffering some serious performance problems with Qt 4.4 and a
QAbstractItemModel + QTreeView + QSortFilterProxyModel. Before creating
a test case and submit a bug, I tried Qt 4.5-rc1: the good news is that
the problem is gone; the bad news is that I'm experiencing a different
performance problem now. I'll explain both in more detail now, thanks in
advance for your attention! (Feel free to skip to point #2 directly.)

1. The old problem
==================

In my application, I create a QAbstractItemModel which is a tree
reflecting the structure of a directory in the file system. In my tests,
I use a tree with ~600 sub-directories, and ~6000 files in total. The
view is a standard QTreeView, and I use a QSortFilterProxyModel with a
QLineEdit to filter the model. This used to work fine, but as of late
(Qt 4.4 for sure) I discovered the following problem.

Sometimes, if the user expands or selects some items from a the result
of a search/filter expression, going back to the unfiltered view would
become unbearably slow, with the CPU spinning at 100% for quite a number
of seconds. AIUI, this seems to be related to the view wanting to
preserve the expanded items as expanded, and the selected items as
selected. The number of calls to my data/index/rowCount increased by an
order of magnitude.

Upgrading to 4.5-rc1 seems to have solved this problem, or at least I
can no longer reproduce.

2. The new problem
==================

I load data into my model in the background, calling begin/endInsertRows
as appropriate. With Qt 4.4 this was a reasonably fast operation, but
with 4.5-rc1 it has become very slow, apparently because the number of
calls to my data/index/rowCount has increased by an order of magnitude.
Compare:

    Function |  4.4  | 4.5-rc1
    =========+=======+=========
    data     |  1248 | 30736
    index    |  9006 | 47662
    rowCount | 10243 | 48899

If I don't call begin/endInsertRows, and just do a model.reset() when
all the data has been loaded, I get:

    Function |  4.4 | 4.5-rc1
    =========+======+=========
    data     | 1064 |  900
    index    | 1316 | 1160
    rowCount | 1319 | 1163

Can somebody help me figure out what's going on?

-- 
Adeodato Simó
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

Reply via email to