mip网站,都匀住房和城乡建设局网站,wordpress手册下载地址,住房和城乡建设部网站 上海目录
一、Qt体系框架#xff1a;
编辑二、布局方式#xff1a;
1.绝对布局
setGeometry()函数
2.盒子布局#xff1a;
QHBoxLayout:水平布局管理器
QVBoxLayout:垂直布局管理器
QGridLayout:网格布局管理器
三、基本控件及其函数
标签类 #xff1a;QLabel
按…目录
一、Qt体系框架
编辑二、布局方式
1.绝对布局
setGeometry()函数
2.盒子布局
QHBoxLayout:水平布局管理器
QVBoxLayout:垂直布局管理器
QGridLayout:网格布局管理器
三、基本控件及其函数
标签类 QLabel
按钮类QPushButton
编辑框类 QLineEdit
下拉框类QComboBox
复选框类QCheckBox
调色板类QPalette 提示框类QMessageBox
QWidget基本函数 一、Qt体系框架
Qt类都有一个共同的祖先都是QObject类其后面有三个大的子类分别负责不同的功能它们是:
QApplicaton:类管理图形用户界面应用程序和控制台程序的控制流和主要设置 QWidget:是所有用户界面对象的基类,负责管理图形界面窗口QLayout:负责管理所有图形界面的摆放方式布局
二、布局方式
1.绝对布局
setGeometry()函数 void QWidget::setGeometry ( int x, int y, int w, int h ) 参数说明: x:表示子部件在父窗体行的位置 y:表示子部件在父窗体列的位置 w:表示子部件宽度 h:表示子部件的高度 2.盒子布局 QHBoxLayout:水平布局管理器 this-middle3new QHBoxLayout(); this-middle3-addWidget(this-typeLab); this-middle3-addWidget(this-typeBox); this-middle3-setContentsMargins(80,0,80,0);//布局四周的距离左上右下 QVBoxLayout:垂直布局管理器 QGridLayout:网格布局管理器 //初始化 this-gridlayoutnew QGridLayout; this-gridlayout-addWidget(this-btn1,0,0);//添加进网状布局 //设置按钮随窗口变化 this-btn1-setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); //设置布局之间间隙 this-gridlayout-setSpacing(0); //设置布局外边距 this-gridlayout-setMargin(0); //舞台应用这个布局 this-setLayout(gridlayout); 三、基本控件及其函数 标签类 QLabel 按钮类QPushButton 编辑框类 QLineEdit this-passEditnew QLineEdit(); this-passEdit-setEchoMode(QLineEdit::Password);//编辑框以密文显示 下拉框类QComboBox QComboBox *typeBox; //下拉框 this-typeBoxnew QComboBox(); this-typeBox-addItem(QString::fromUtf8(学生证)); this-typeBox-addItem(QString::fromUtf8(身份证)); 复选框类QCheckBox QCheckBox *ck1; QCheckBox *ck2; QCheckBox *ck3; //复选框 this-ck1new QCheckBox(QString::fromUtf8(编程)); this-ck2new QCheckBox(QString::fromUtf8(篮球)); this-ck3new QCheckBox(QString::fromUtf8(足球)); 调色板类QPalette //调色板 QPalette palettethis-palette(); palette.setBrush(QPalette::Background,QBrush(QPixmap(img/2.jpeg))); //背景图片 //palette.setColor(QPalette::Background,Qt::black); //背景颜色 this-setPalette(palette); 提示框类QMessageBox QWidget基本函数 void QWidget::show ()//显示widget void QWidget::hide ()//隐藏widget bool QWidget::close ()//关闭widget void QWidget:: resize ( int w, int h )//调整尺寸 void QWidget ::setWindowTitle//设置窗口名字 void QWidget ::setWindowIcon//设置窗口图标 例如 this-resize(800,533);//设置窗口大小 this-setWindowTitle(捕鱼达人); this-setWindowIcon(QIcon(img/Fish_Icon.png));