//mainwindow.h #include <QMdiArea> private: QMdiArea *mdiArea;
//mainwindow.cpp #include <QDialog> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); mdiArea=new QMdiArea(); setCentralWidget(mdiArea); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_actionA_triggered() { QDialog *dlg=new QDialog(); mdiArea->addSubWindow(dlg); dlg->show(); }
时间: 2024-10-11 13:20:31