-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvar_item.cpp
More file actions
executable file
·33 lines (25 loc) · 954 Bytes
/
var_item.cpp
File metadata and controls
executable file
·33 lines (25 loc) · 954 Bytes
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
#include "var_item.hpp"
DoubleVarItem::DoubleVarItem(QString name, double value) {
nameLabel = new QLabel(name + ":");
valueBox = new QLineEdit();
valueBox->setValidator(dynamic_cast<QValidator*>(new QDoubleValidator()));
QObject::connect(valueBox, &QLineEdit::textChanged, this, &DoubleVarItem::updateValue);
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(nameLabel);
layout->addWidget(valueBox);
}
void DoubleVarItem::updateValue() {
emit valueChanged(this);
}
StrVarItem::StrVarItem(QString name, QString value) {
nameLabel = new QLabel(name + ":");
valueBox = new QLineEdit();
valueBox->setText(value);
QObject::connect(valueBox, &QLineEdit::textChanged, this, &StrVarItem::updateValue);
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(nameLabel);
layout->addWidget(valueBox);
}
void StrVarItem::updateValue() {
emit valueChanged(this);
}