对象树

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

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    MyPushButton *pushButton = new MyPushButton(this);
}
#include "mypushbutton.h"
#include "ui_mypushbutton.h"
#include <QDebug>

MyPushButton::MyPushButton(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MyPushButton)
{
    qDebug() << "MyPushButton";

    ui->setupUi(this);
}

MyPushButton::~MyPushButton()
{
    qDebug() << "~MyPushButton";

    delete ui;
}
18:45:35: Starting ...
MyPushButton
~MyPushButton
posted @ 2022-08-01 18:52  thomas_blog  阅读(19)  评论(0编辑  收藏  举报