| 4 | #include "mypushbutton.h" |
| 5 | |
| 6 | MainWindow::MainWindow(QWidget *parent) |
| 7 | : QMainWindow(parent) { |
| 8 | qDebug() << this; |
| 9 | qDebug() << (parent == nullptr); |
| 10 | qDebug() << "MainWindow被创建了"; |
| 11 | // 设置窗口标题 |
| 12 | setWindowTitle("主窗口"); |
| 13 | // 设置窗口大小 |
| 14 | // resize(600, 600); |
| 15 | setFixedSize(600, 600); |
| 16 | // 设置窗口位置 |
| 17 | move(100, 100); |
| 18 | // 添加第1个按钮 |
| 19 | QPushButton *btn = new QPushButton; |
| 20 | btn->setText("登录"); |
| 21 | btn->setFixedSize(100, 30); |
| 22 | btn->move(100, 200); |
| 23 | // 设置按钮的父控件 |
| 24 | btn->setParent(this); |
| 25 | // btn->show(); |
| 26 | // 添加第2个按钮 |
| 27 | // new QPushButton("注册", this); |
| 28 | QPushButton *btn2 = new MyPushButton(this); |
| 29 | btn2->setText("注册"); |
| 30 | } |
| 31 | |
| 32 | MainWindow::~MainWindow() { |
| 33 | qDebug() << "MainWindow被销毁了"; |
nothing calls this directly
no outgoing calls
no test coverage detected