I want to scroll automatically to currentIndex in verticalscrollbar of QTreeView which is populated by QFileSystemModel.
I am trying it with QPropertyAnimation on the verticalScrollBar->setValue().
I have a default index in the QTreeView which I set in a function, and so I want to scroll to it.
void MainWindow::updateTree()
{
QString dir=QFileInfo(ui->lineEdit->text()).path();
QModelIndex idx = model->index(dir);
if (idx.isValid())
{
ui->treeView->setCurrentIndex(model->index(dir));
ui->treeView->expand(idx);
}
}
I am not good with QPropertyAnimation so please help me with this.
Bookmarks