Qt自定义保存文件对话框 [英] Qt customizing save file dialog

查看:1248
本文介绍了Qt自定义保存文件对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要自定义默认的Qt保存文件对话框:在其中添加一些选项.例如,在文件类型和保存/关闭按钮之间添加一些具有我自己的值的复选框.

I need to customize default Qt save file dialog: add some options in it. For example, adding some checkboxes with my own values in it between file type and save/close buttons.

Qt有什么方法吗?

推荐答案

只要可以使用Qt随附的非本机" Qt文件对话框,就可以自定义Qt文件对话框. Qt提供的另一种选择是使用操作系统的本机文件对话框,但是如果您这样做,则(我知道)无法自定义对话框.

You can customize the Qt file dialog as long as you're okay with using the "non-native" Qt file dialog that comes with Qt; the other option Qt provides is to use the OS's native file dialog, but if you do that there is no way (that I'm aware of) to customize the dialog.

此处是我编写为增强型文件对话框类的示例音频格式转换程序的一部分.该代码有些陈旧,可能需要一些调整才能使用较新版本的Qt(尤其是在Qt 4.6及更高版本中),您可能需要在文件对话框对象上调用setOption(DontUseNativeDialog),否则您将获得本机对话框和自定义窗口小部件将不会出现在MacOS/X下),但是其源代码可以在

Here's an example of an enhanced file dialog class I wrote as part of an audio-format-conversion program. The code is a bit dated and may need a bit of tweaking to work with newer versions of Qt (in particular in Qt 4.6 and higher you'll probably need to call setOption(DontUseNativeDialog) on your file dialog object, otherwise you'll get the native dialog and custom widgets won't appear under MacOS/X), but the source code for it can be found in the source archive if you want to take a look.

这篇关于Qt自定义保存文件对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆