Qt - 使用对话框选择多个文件夹/目录
我想要实现类似以下的目标:
我可以在多个驱动器上选择多个文件夹并检索文件夹所选择的路径。 Qt 仅具有粗略的多文件夹选择功能,但它不支持从其他驱动器等选择文件夹。
任何人都可以指导我如何创建这样的对话框吗?更好的是,是否有人有我可以使用的示例代码(这是对旧项目的扩展,我宁愿节省时间而不是重新发明轮子!)
谢谢
I want to achieve something like the following:
Where I can select multiple folders across multiple drives and retrieve the folder paths of those selected. Qt only has a crude multi-folder selection feature, but it does not support selected folders from other drives etc.
Can anyone guide me on how to create such a dialog? Better yet, does any one have any sample code I could use (this is an extension to an old project, and I'd much rather save my time and not re-invent the wheel!)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 QFileSystemModel 来表示 QTreeView。 此示例说明了如何执行此操作。
对于复选框问题,根据此列表档案:
请注意,QDirModel 类 已过时。您不能在较新的 Qt 版本。我建议使用 QFileSystemModel。
You can use QFileSystemModel for represent filesystem on QTreeView. This example explains how to do that.
For checkbox issue, according to this list archives:
Note that QDirModel class is obsolete. You may not use that on newer Qt versions. I recommend to use QFileSystemModel.