简体   繁体   English

如何通过QFileSystemModel获取所选文件的* full *文件路径?

[英]How to get the *full* filepath of a selected file via QFileSystemModel?

How to get a filepath via QFileSystemModel? 如何通过QFileSystemModel获取文件路径? Selecting via selection model returns just file name, or drive name. 通过选择模型进行选择仅返回文件名或驱动器名。

Note, that just file name isn't enough. 请注意,仅文件名是不够的。 Whole filepath is needed. 需要整个文件路径。

On qt website: http://doc.qt.io/qt-5/qfilesystemmodel.html 在qt网站上: http : //doc.qt.io/qt-5/qfilesystemmodel.html

QString QFileSystemModel::filePath ( const QModelIndex & index ) const Returns the path of the item stored in the model under the index given. QString QFileSystemModel::filePath ( const QModelIndex & index ) const返回给定索引下存储在模型中的项目的路径。

I dont know if this answers your question, else you can give us some code about what you tried / are trying to reach. 我不知道这是否能回答您的问题,否则您可以给我们一些有关您尝试/正在尝试达到的目标的代码。

您可以使用类似QFileSystemModel :: filePath(index)的方法来完成此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM