QMainWindow,QWidget和QDialog有什么区别? [英] What's the difference between QMainWindow, QWidget and QDialog?

查看:770
本文介绍了QMainWindow,QWidget和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屋!

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