PDA

View Full Version : QDirModel/QTreeView performance under win32



roxton
27th July 2008, 16:57
Hello. I'm using Qt 4.4, QTreeView with QDirModel to show a files tree. On Linux it works fast. But on Windows XP SP2, the QTreeView filled with a root directory content (C, D, etc., and cdroms) are freezes at start, then shows me a tree in about a 1 or 1.5 minutes. Is that a normal behavior of QTreeView/QDirModel?
Note 1: there are FAT32 and NFTS partitions.
Note 2: can I disable the standart icons set QTreeView/QDirModel and does that affect the performance?

jpn
27th July 2008, 17:02
An improved version of QDirModel, namely QFileSystemModel was introduced in Qt 4.4.

roxton
27th July 2008, 18:26
Thank you! But now I have a new problems :) When I changed the model to QFileSystemModel, I've found some strange things with my code (but all compiles well).
Here is an actual code of the function that does navigate QTreeView/QFileSystemModel to the directory at the QString path parameter. mvl_model is QFileSystemModel, tv_fman is QTreeView:



void rvln::fman_nav (const QString &path)
{
QModelIndex i = mvl_model->index(path);
if (! i.isValid())
return;

tv_fman->setCurrentIndex(i);
tv_fman->setExpanded (i, true);
tv_fman->scrollTo (i, QAbstractItemView::PositionAtTop);
}


When I call tv_fman->setCurrentIndex, treeview selects the item. Thats normal. Then I call setExpanded - but it doesn't works. And scrollTo - the same thing, doesn't work.