动态生成对话框,记录如下:
QDialog *submitDlg= newQDialog(this);
QLabel *label = new QLabel(tr("确认提交修改到数据库吗?"),submitDlg);
QPushButton *ok_Btn = new QPushButton(tr("确认"),submitDlg);
QPushButton *cancel_Btn = new QPushButton(tr("取消"),submitDlg);
QGridLayout *gridLayout = new QGridLayout(submitDlg);
gridLayout->setColumnStretch(0, 1);
gridLayout->setColumnStretch(1, 4);
gridLayout->setColumnStretch(2, 1);
gridLayout->setColumnStretch(3, 4);
gridLayout->setColumnStretch(4, 1);
gridLayout->setMargin(15);
gridLayout->setColumnMinimumWidth(2, 15);
gridLayout->setRowMinimumHeight(2,15);
gridLayout->addWidget(label,0,0,2,5);
gridLayout->addWidget(ok_Btn,1,1,1,2);
gridLayout->addWidget(cancel_Btn,1,3,1,2);
submitDlg->setLayout(gridLayout);
submitDlg->resize(200,200);
submitDlg->setWindowTitle(tr("确认提交到数据库?"));