#include "form4.h" #include "ui_form4.h" Form4::Form4(QWidget *parent) : QWidget(parent), ui(new Ui::Form4) { ui->setupUi(this); } Form4::~Form4() { delete ui; } void Form4::on_okBtn_clicked() { QString sex = ui->sexBox->currentText(); QString city = ui->cityBox->currentText(); ui->result->setText(sex+", "+city); QMessageBox::information(this,"信息",tr("性别: %1, 家乡: %2").arg(sex).arg(city)); }