其他分享
首页 > 其他分享> > Qt模态框和非模态框

Qt模态框和非模态框

作者:互联网

#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
#include <QDialog>
#include "mywidget.h"

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

    connect(ui->pushButton, &QPushButton::clicked, this, [=](){
        qDebug() << "clickedSlot";

        QDialog dialog;
        dialog.exec();

        myWidget *widget = new myWidget();
        widget->setAttribute(Qt::WA_DeleteOnClose);
        widget->show();
    });
}
08:12:27: Starting ...
clickedSlot
myWidget
~myWidget

标签:模态,Widget,Qt,框和非,widget,ui,myWidget,include
来源: https://www.cnblogs.com/zhangxuechao/p/16545754.html