QMainWindow,QWidget和QDialog有什么区别? [英] What's the difference between QMainWindow, QWidget and QDialog?
问题描述
QMainWindow,QWidget和QDialog有什么区别?
What's the difference between QMainWindow, QWidget and QDialog?
推荐答案
QWidget
是Qt中所有可绘制类的基类.任何基于QWidget
的类都可以在没有父类的情况下显示为窗口.
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
基于QWidget
,但旨在显示为窗口.它将始终显示在窗口中,并具有使其与对话框上的常用按钮(接受,拒绝等)配合使用的功能.
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
围绕主窗口的常见需求而设计.它具有用于菜单栏,状态栏,工具栏和其他小部件的预定义位置.像QDialog
一样,它没有按钮的内置余量.
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.
这篇关于QMainWindow,QWidget和QDialog有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!