QWidget(掌握)
所有的UI组件的基类,内部规定了很多组件的基本属性和函数。
属性:
height 高度,单位像素
width 宽度,单位像素
x是横坐标,y是纵坐标,单位像素。x轴正方向是右,y轴的正方向是下。原点是左上角。坐标以组件的左上角为准。
dialog.h
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
// 引入头文件
#include <QDebug>
#include <QPushButton>
class Dialog : public QDialog
{
Q_OBJECT
public:
Dialog(QWidget *parent = 0);
~Dialog();
private:
// 按钮对象
QPushButton *btn;
};
#endif // DIALOG_H
dialog.cpp
#include "dialog.h"
Dialog::Dialog(QWidget *par