QMainWindow、QWidget 和 QDialog 有什么区别?

发布于 2024-09-10 22:41:37 字数 43 浏览 3 评论 0原文

QMainWindow、QWidget 和 QDialog 有什么区别?

What's the difference between QMainWindow, QWidget and QDialog?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温折酒 2024-09-17 22:41:37

QWidget 是 Qt 中所有可绘制类的基类。任何基于 QWidget 的类都可以通过在没有父级时显示它来显示为窗口。

QDialog 基于QWidget,但设计为显示为窗口。它总是出现在窗口中,并且具有使其能够与对话框上的常见按钮(接受、拒绝等)配合使用的功能。

QMainWindow 是围绕主窗口的常见需求而设计的。它为菜单栏、状态栏、工具栏和其他小部件预定义了位置。它没有像 QDialog 那样的任何内置按钮功能。

A QWidget is the base class for all drawable classes in Qt. Any QWidget-based class can be shown as a window by showing it when it has no parent.

A QDialog is based on QWidget, but designed to be shown as a window. It will always appear in a window, and has functions to make it work well with common buttons on dialogs (accept, reject, etc.).

QMainWindow is designed around common needs for a main window to have. It has predefined places for a menu bar, a status bar, a toolbar, and other widgets. It does not have any built-in allowances for buttons like QDialog does.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文