admin 管理员组

文章数量: 1086019

Qt Widgets

先看官方文档对Widgets的解释
Widgets are the primary elements for creating user interfaces in Qt. Widgets can display data and status information, receive user input, and provide a container for other widgets that should be grouped together. A widget that is not embedded in a parent widget is called a window.

也就是说Widgets就像一个大的窗口,可以在这个窗口中添加不同的小东西,我们在Qt中创建的GUI就叫Qt Widgets Application,其中又有三个基类对应着不同的窗口,这三个基类是QWidget,QMainWindow,QDialog。
那么这三个基类创建的窗口有什么不同呢?
其实也没什么不同。

主要是MainWindow有自己的布局,可以添加菜单栏,工具条,状态栏什么的。
而对话框一般作为一个辅助窗口,让用户选择然后将选择传递到主窗口,例如什么文件对话框,颜色对话框,选字体的对话框什么的。
然后就是Widget,widget就是可以在窗口上添加不同的小部件,还可以使用不同的布局,小部件自己作为窗口又可以添加小部件.

本文标签: Qt Widgets