qt 本地文件浏览程序

ronal7do 2015-07-24 08:06:25
想用qt Model/View的QListView实现一个本地文件浏览,模型使用的是QFileSystemModel,但发现View显示的只是那一个路径的文件,而不能返回上一层或进入某个文件夹。我想实现如下图的效果:

点击最上面的../能返回上一层,点击文件夹能进入文件夹访问,请问大家,该用什么实现?
...全文
321 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yxred 2015-07-25
  • 打赏
  • 举报
回复
QModelIndex QFileSystemModel::setRootPath(const QString & newPath) Sets the directory that is being watched by the model to newPath by installing a file system watcher on it. Any changes to files and directories within this directory will be reflected in the model. If the path is changed, the rootPathChanged() signal will be emitted. Note: This function does not change the structure of the model or modify the data available to views. In other words, the "root" of the model is not changed to include only files and directories within the directory specified by newPath in the file system. 双击 或 单击 信号,后取当前 路径 设置 setRootPath
ronal7do 2015-07-25
  • 打赏
  • 举报
回复
没人帮忙吗?自顶!

16,818

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧