-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdialogquickpredict.cpp
50 lines (45 loc) · 1.03 KB
/
dialogquickpredict.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
#include "dialogquickpredict.h"
#include "ui_dialogquickpredict.h"
DialogQuickPredict::DialogQuickPredict(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogQuickPredict)
{
ui->setupUi(this);
ui->lineEdit->setFocus();
}
DialogQuickPredict::~DialogQuickPredict()
{
delete ui;
}
void DialogQuickPredict::focusText()
{
ui->lineEdit->setFocus();
}
QList<int> DialogQuickPredict::getValues()
{
QString text = ui->lineEdit->text();
QStringList texts;
if (text.contains(";"))
texts = text.split(";");
else if (text.contains(","))
texts = text.split(",");
else
texts = text.split(" ");
QList<int> values;
for (QString text : texts)
{
if (!text.isEmpty()) {
values.push_back(text.toInt());
}
}
return values;
}
void DialogQuickPredict::setValues(QList<int> values)
{
QString text;
for (uint i = 0; i < values.size(); ++i) {
text += QString::number(values[i]);
text += ";";
}
ui->lineEdit->setText(text);
}