对话窗口

对话框可以是模式对话框(在这种情况下,用户必须提供必要的信息才能继续在主窗口中工作),也可以是无模式对话框(在这种情况下,用户必须提供必要的信息才能继续在主窗口中工作)。无模式对话框不会阻止用户与应用程序中的任何其他窗口进行交互。

Qt 提供了一组现成的对话框,用于文件、字体、颜色选择等。

QColorDialog

用于指定颜色的对话框部件

QFileDialog

允许用户选择文件或目录的对话框

QFontDialog

用于选择字体的对话框部件

QInputDialog

从用户处获取单个值的简单方便对话框

QMessageBox

用于通知用户或向用户提问并得到答复的模态对话框

QProgressDialog

反馈慢速操作的进度

通过将常规窗口部件组合成QDialog ,可以轻松创建自定义对话框。这些类专门用于创建自定义对话框:

QDialog

对话框窗口基类

QDialogButtonBox

以适合当前 widget 风格的布局显示按钮的 widget

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.