MCPcopy Create free account
hub / github.com/CoderMJLee/audio-video-dev-tutorial / MainWindow

Method MainWindow

02_代码/03_QtBase/mainwindow.cpp:6–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include "mypushbutton.h"
5
6MainWindow::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
32MainWindow::~MainWindow() {
33 qDebug() << "MainWindow被销毁了";

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected