可以使用“打开文件”对话框选择文件夹吗?
“浏览文件夹”Windows 对话框非常不方便,因为:
- 它没有路径框,我可以在其中粘贴我想要的路径(例如,从 Total Commander)
- 它总是从桌面开始,所有内容都关闭
有没有办法使用“打开”文件”对话框(这更好)来选择文件夹?一些标志或选项什么的?
上下文:calibre eLibrary 管理器,用 Python 和 Qt 编写。
它当前显示如左侧。我希望它显示为右侧
甚至更好,如“打开文件”对话框:
The "Browse For Folder" Windows dialog is very inconvenient because:
- it has no Path box where I can paste the path I want (eg from Total Commander)
- it always starts from the Desktop with everything closed
Is there a way to use the "Open File" dialog (which is much better) to select a Folder? Some flag or option or something?
Context: the calibre eLibrary manager which is written in Python and Qt.
It currently displays as on the left. I'd like it to display as on the right
or even better, as the Open File dialog:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以试试这个:
这个是用来选择一个目录的,会弹出一个对话框,就像你最后显示的那样。
演示:
You can try this one:
This one is used to choose a directory, and will popup a dialog like you show at last.
Demo:
您可以将
QFileDialog
中的文件模式设置为QFileDialog::Directory
,请参阅http://qt-project.org/doc/qt-5.0/qtwidgets/qfiledialog.html#FileMode-enum
或者您可以使用
QFileDialog::setOption
值为QFileDialog::ShowDirsOnly
You can set the file mode in
QFileDialog
toQFileDialog::Directory
see http://qt-project.org/doc/qt-5.0/qtwidgets/qfiledialog.html#FileMode-enum
Or You can use
QFileDialog::setOption
with valueQFileDialog::ShowDirsOnly