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
| widget::widget(QWidget* parent) : QWidget(parent), ui(new Ui::widget) { ui->setupUi(this); this->boy = new TPerson("小明", 10, this); this->boy->setProperty("sex", "boy"); this->girl = new TPerson("小花", 20, this); this->girl->setProperty("sex", "girl"); this->ui->spinBoy->setProperty("isBoy", true); this->ui->spinGirl->setProperty("isBoy", false); connect(this->boy, SIGNAL(ageChanged(int)), this, SLOT(do_ageChanged(int))); connect(this->girl, SIGNAL(ageChanged(int)), this, SLOT(do_ageChanged(int))); connect(this->boy, SIGNAL(ageChanged(int)), this->ui->spinBoy, SLOT(setValue(int))); connect(this->girl, SIGNAL(ageChanged(int)), this->ui->spinGirl, SLOT(setValue(int))); connect(this->ui->spinBoy, SIGNAL(valueChanged(int)), this, SLOT(do_spinChanged(int))); connect(this->ui->spinGirl, SIGNAL(valueChanged(int)), this, SLOT(do_spinChanged(int))); connect(this->ui->btnBoyInc, SIGNAL(clicked()), this, SLOT(on_btnBoyInc_clicked())); connect(this->ui->btnGirlInc, SIGNAL(clicked()), this, SLOT(on_btnGirlInc_clicked())); connect(this->ui->btnClassInfo, SIGNAL(clicked()), this, SLOT(on_btnClassInfo_clicked())); }
|