-
Notifications
You must be signed in to change notification settings - Fork 1
/
lineinfo.cpp
40 lines (36 loc) · 1.07 KB
/
lineinfo.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
#include "lineinfo.h"
#include "ui_lineinfo.h"
LineInfo::LineInfo(QWidget *parent) :
QFrame(parent),
ui(new Ui::LineInfo)
{
ui->setupUi(this);
}
LineInfo::~LineInfo()
{
delete ui;
}
void LineInfo::setLine(Line *line)
{
this->line = line;
if (line){
ui->lineEditPoint1x->setText(QString::number(line->getX1()));
ui->lineEditPoint1y->setText(QString::number(line->getY1()));
ui->lineEditPoint2x->setText(QString::number(line->getX2()));
ui->lineEditPoint2y->setText(QString::number(line->getY2()));
} else {
ui->lineEditPoint1x->clear();
ui->lineEditPoint1y->clear();
ui->lineEditPoint2x->clear();
ui->lineEditPoint2y->clear();
}
}
void LineInfo::on_applyBtn_clicked()
{
if (!line) return;
line->setX1(ui->lineEditPoint1x->text().toInt());
line->setY1(ui->lineEditPoint1y->text().toInt());
line->setX2(ui->lineEditPoint2x->text().toInt());
line->setY2(ui->lineEditPoint2y->text().toInt());
line->reDraw();
}