myDlg->setWindowTitle(tr("创建socket服务器"));
QLabel *mylisthenPortlabel = new (QLabel);
QLineEdit *mylisthenPortLineEdit = new (QLineEdit);
QVBoxLayout *myMainLayout = new (QVBoxLayout);
mylisthenPortlabel->setText(tr("监听端口"));
mylisthenPortLineEdit->setText(tr(""));
QHBoxLayout *myTopLayout = new QHBoxLayout;
QHBoxLayout *myButtonLayout = new QHBoxLayout;
QDialogButtonBox *myBtnBox = new QDialogButtonBox;
myBtnBox = new QDialogButtonBox;
myBtnBox->setObjectName(QStringLiteral("buttonBox"));
myBtnBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
myBtnBox->button(QDialogButtonBox::Ok)->setText(tr("确定"));
myBtnBox->button(QDialogButtonBox::Cancel)->setText(tr("取消"));
myTopLayout->addWidget(mylisthenPortlabel);
myTopLayout->addWidget(mylisthenPortLineEdit);
myButtonLayout->addWidget(myBtnBox);
myMainLayout->addLayout(myTopLayout);
myMainLayout->addLayout(myButtonLayout);
myMainLayout->addStretch(0);
QObject::connect(myBtnBox, SIGNAL(accepted()), myDlg, SLOT(accept()));
QObject::connect(myBtnBox, SIGNAL(rejected()), myDlg, SLOT(reject()));
myDlg->setLayout(myMainLayout);
if (myDlg->exec() == QDialog::Accepted){
}
delete myDlg;
delete mylisthenPortlabel;
delete mylisthenPortLineEdit;
delete myMainLayout;
delete myTopLayout;
delete myButtonLayout;
delete myBtnBox;
QT 代码创建对话框
最新推荐文章于 2024-05-26 18:13:45 发布