QT button初识

QT button初识_第1张图片

 

#include "widget.h"
#include "ui_widget.h"
#include 

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{

    ui->setupUi(this);

    QPushButton *btn = new QPushButton;
//    btn->show();
    btn->setParent(this);
    btn->setText("苏轼");
    QPushButton *btn2 = new QPushButton("从此小舟逝,江海寄余生");
    btn2->setParent(this);
    btn2->move(100, 100);

    resize(640, 480);

    this->setWindowTitle("poem");
//    设置固定窗口的大小
//    this->setFixedSize(640, 480);

}

Widget::~Widget()
{
    delete ui;
}

你可能感兴趣的:(C/C++/QT,qt,ui,开发语言)