有没有一种方法可以将QModelIndex转换为QString?这样做的主要目的是我想与动态生成的QListView项目的内容一起工作。
这是获取当前选定项目的正确方法吗?提前感谢!
QFileSystemModel *foolist = new QFileSystemModel;
foolist->setRootPath(QDir::rootPath());
foolistView->setModel(foolist);
[...]
QMessageBox bar;
QString foolist_selectedtext = foolistView->selectionModel()->selectedIndexes();
bar.setText(foolist_selectedtext);
bar.exec;
这是获取当前选定项目的正确方法吗?提前感谢!