-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzmpview.cpp
48 lines (41 loc) · 1.05 KB
/
zmpview.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
#include "zmpview.h"
#include "ui_zmpview.h"
#include <QGraphicsWidget>
#include <vector>
zmpview::zmpview(TGauges *Gauges, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::zmpview)
{
this->Gauges = Gauges;
ui->setupUi(this);
scene = new QGraphicsScene(this);
}
zmpview::~zmpview()
{
delete ui;
}
//class QGraphicsRectWidget : public QGraphicsWidget
//{
//public:
// void paint(QPainter *painter, const QStyleOptionGraphicsItem *,
// QWidget *)
// {
// painter->fillRect(rect(), Qt::blue);
// }
//};
void zmpview::on_pushButton_clicked()
{
double xpos = ui->xvalue->value();
double ypos = ui->yvalue->value();
int chvalue = ui->chvalue->value();
double calib = ui->calibvalue->value();
scene->addRect(xpos*20,ypos*20,50,100,QPen(Qt::black),QBrush(Qt::red));
Tgauge gauge;
gauge.xpos = xpos;
gauge.ypos = ypos;
gauge.channel = chvalue;
gauge.K_calib = calib;
Gauges->push_back(gauge);
ui->graphicsView->setScene(scene);
ui->graphicsView->scene()->update();
}