-
Notifications
You must be signed in to change notification settings - Fork 0
/
agepage.cpp
53 lines (48 loc) · 1.87 KB
/
agepage.cpp
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "agepage.h"
#include "ui_agepage.h"
#include <iostream>
int buNeYa = 2;
int genderId = -1, ageId = -1, intentId = -1;
AgePage::AgePage(QWidget *parent) : QWizardPage(parent), ui(new Ui::AgePage)
{
// setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark.png"));
ui->setupUi(this);
// std::cout << "count: " << ui->horizontalLayout_4->count() << std::endl;
genderButtonGroup = new QButtonGroup;
#if QT_VERSION < QT_VERSION_CHECK(5,15,3)
foreach (auto radioButton, ui->groupBox->findChildren<QRadioButton*>())
#else
foreach (auto radioButton, ui->groupBox->findChildren<QRadioButton*>(Qt::FindDirectChildrenOnly))
#endif
{
genderButtonGroup->addButton(radioButton);
connect(radioButton, &QAbstractButton::clicked, this, &AgePage::whichButtonHasCheckedGender);
}
ageButtonGroup = new QButtonGroup;
#if QT_VERSION < QT_VERSION_CHECK(5,15,3)
foreach (auto radioButton, ui->groupBox_2->findChildren<QRadioButton*>())
#else
foreach (auto radioButton, ui->groupBox_2->findChildren<QRadioButton*>(Qt::FindDirectChildrenOnly))
#endif
{
ageButtonGroup->addButton(radioButton);
connect(radioButton, &QAbstractButton::clicked, this, &AgePage::whichButtonHasCheckedAge);
// connect(radioButton, &QAbstractButton::clicked, this, [this](){ageId = ageButtonGroup->id(ageButtonGroup->checkedButton()) * (-1) - buNeYa;}); // TODO: daha sade olursa kalsın yoksa lambda olmasın
}
}
void AgePage::whichButtonHasCheckedAge()
{
ageId = ageButtonGroup->id(ageButtonGroup->checkedButton()) * (-1) - buNeYa;
// qDebug() << "page age id:" << ageId;
}
void AgePage::whichButtonHasCheckedGender()
{
genderId = genderButtonGroup->id(genderButtonGroup->checkedButton()) * (-1) - buNeYa;
}
int AgePage::nextId() const
{
return 1;
}
//bool AgePage::isComplete() const
//{
//}