1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| #include "QtWidgetsApplication1.h"
QtWidgetsApplication1::QtWidgetsApplication1(QWidget *parent) : QDialog(parent) { ui.setupUi(this); connect(ui.btn_run, SIGNAL(clicked()), this, SLOT(btn_run_clicked())); connect(ui.checkBox_1, SIGNAL(clicked()), this, SLOT(checkBox1_clicked())); connect(ui.checkBox_2, SIGNAL(clicked()), this, SLOT(checkBox2_clicked())); connect(ui.checkBox_3, SIGNAL(clicked()), this, SLOT(checkBox3_clicked())); connect(ui.checkBox_4, SIGNAL(clicked()), this, SLOT(checkBox3_clicked()));
ui.comboBox->addItem("Male"); ui.comboBox->addItem("FeMale");
}
void QtWidgetsApplication1::btn_run_clicked() { ui.label_6->setText("Age:" + ui.spinBox->cleanText());
ui.label_5->setText("Gender:" + ui.comboBox->currentText()); QString chk1 = "", chk2 = "", chk3 = "", chk4=""; if (ui.checkBox_1->isChecked()) chk1 = "Hobby :Watching Movie"; if (ui.checkBox_2->isChecked()) chk2 = "Hobby :Sports"; if (ui.checkBox_3->isChecked()) chk3 = "Hobby :Drawing"; if (ui.checkBox_4->isChecked()) chk3 = "Hobby :Pet"; ui.label_4->setText(QString("\n%1 \n%2 \n%3 \n%4").arg(chk1, chk2, chk3, chk4)); };
|