-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcircleinfo.cpp
38 lines (33 loc) · 874 Bytes
/
circleinfo.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
#include "circleinfo.h"
#include "ui_circleinfo.h"
CircleInfo::CircleInfo(QWidget *parent) :
QFrame(parent),
ui(new Ui::CircleInfo)
{
ui->setupUi(this);
}
CircleInfo::~CircleInfo()
{
delete ui;
}
void CircleInfo::setCircle(Circle *value)
{
circle = value;
if (circle){
ui->circlePoint1->setText(QString::number(circle->getX()));
ui->circlePoint2->setText(QString::number(circle->getY()));
ui->circleRadius->setText(QString::number(circle->getR()));
} else {
ui->circlePoint1->clear();
ui->circlePoint2->clear();
ui->circleRadius->clear();
}
}
void CircleInfo::on_applyBtn_clicked()
{
if (!circle) return;
circle->setX(ui->circlePoint1->text().toInt());
circle->setY(ui->circlePoint2->text().toInt());
circle->setR(ui->circleRadius->text().toInt());
circle->reDraw();
}