-
Notifications
You must be signed in to change notification settings - Fork 1
/
twoinputdialog.cpp
41 lines (31 loc) · 938 Bytes
/
twoinputdialog.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
#include <QComboBox>
#include <QSpinBox>
#include <QStringList>
#include "twoinputdialog.h"
#include "ui_twoinputdialog.h"
TwoInputDialog::TwoInputDialog(QWidget *parent, QString* comboString, int* spinInt) :
QDialog(parent),
ui(new Ui::TwoInputDialog)
{
ui->setupUi(this);
QDialogButtonBox* qb = this->findChild<QDialogButtonBox*>("buttonBox");
connect(qb, SIGNAL(accepted()), this, SLOT(buttonPress()));
this->comboString = comboString;
this->spinInt = spinInt;
}
TwoInputDialog::~TwoInputDialog()
{
delete ui;
}
void TwoInputDialog::buttonPress()
{
QComboBox* cb = this->findChild<QComboBox*>("comboBox");
QSpinBox* sb = this->findChild<QSpinBox*>("spinBox");
*(this->comboString) = cb->currentText();
*(this->spinInt) = sb->value();
}
void TwoInputDialog::fillComboBox(QStringList list)
{
QComboBox* cb = this->findChild<QComboBox*>("comboBox");
cb->addItems(list);
}