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
) {
if (! i.isValid())
return;
tv_fman->setCurrentIndex(i);
tv_fman->setExpanded (i, true);
}
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);
}
To copy to clipboard, switch view to plain text mode
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.
Bookmarks