C++ (Qt)const QModelIndex root = dirModel->setRootPath(newDirectory);ui.treeView->setRootIndex(root);