我正在使用 QTreeView 和 QFileSystem 模型:
QTreeView *treeview;
treeview = new QTreeView(win);
QFileSystemModel *fsm = new QFileSystemModel;
fsm->setRootPath(QDir::currentPath());
treeview->setModel(fsm);
......
我该如何实现?
答案 0 :(得分:0)
QModelIndex index = treeview->currentIndex();
QString path;
if (index.isValid())
{
path = fsm->filePath(index);
}