#include "form3.h" #include "ui_form3.h" Form3::Form3(QWidget *parent) : QWidget(parent), ui(new Ui::Form3) { ui->setupUi(this); } Form3::~Form3() { delete ui; } void Form3::on_pushButton_clicked() { QString s; if(ui->w1->isChecked()) s+=ui->w1->text()+", "; if(ui->w2->isChecked()) s+=ui->w2->text()+", "; if(ui->w3->isChecked()) s+=ui->w3->text()+", "; if(ui->w4->isChecked()) s+=ui->w4->text()+", "; // 删除 最后一个", " s.remove(s.size()-2,1); ui->result->setText(s); }