-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditorwidget.cpp
43 lines (36 loc) · 951 Bytes
/
editorwidget.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
#include "editorwidget.h"
#include <QVBoxLayout>
EditorWidget::EditorWidget(QWidget* parent)
: QWidget(parent)
, pushButton(new QPushButton(this))
, lineEdit(new QLineEdit(this))
, dSpinBox(new QDoubleSpinBox(this))
{
if (parent) {
qDebug() << __FUNCTION__ << parent << parent->objectName() << this << this->objectName();
}
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(pushButton);
layout->addWidget(lineEdit);
layout->addWidget(dSpinBox);
}
void EditorWidget::setPrice(const int& price)
{
pushButton->setText(QString::number(price));
}
void EditorWidget::setPosition(const int& position)
{
lineEdit->setText(QString::number(position));
}
int EditorWidget::getPosition() const
{
return lineEdit->text().toInt();
}
void EditorWidget::setSize(const double& size)
{
dSpinBox->setValue(size);
}
double EditorWidget::getSize() const
{
return dSpinBox->value();
}