Sync refactoring for multiple platforms
[mardrone] / mardrone / gauges / gauge.cpp
1 #include "gauge.h"
2 #include "qgraphicswidget.h"
3 #include "QGraphicsItem"
4 #include <QPainter>
5 #include <QDebug>
6
7 Gauge::Gauge(QGraphicsItem *parent) :
8     QGraphicsWidget(parent)
9 {
10     m_textSize=20;
11     m_tickMinor=0;
12     m_scale=1.0;
13 }
14 #if 1
15 void Gauge::paint(QPainter *painter,
16                            const QStyleOptionGraphicsItem *option,
17                            QWidget *widget)
18  {
19 //     qDebug() << "Gauge::paint";
20      painter->setBrush(Qt::blue);
21      painter->drawRoundedRect(QRectF(0.0,0.0, size().width(),size().height()), 5,5);
22  }
23 #endif
24 void Gauge::setValue(float val_)
25 {
26     m_value=val_;
27     update(boundingRect()); // Value updated, schedule redtaw
28 };
29 float Gauge::value()
30 {
31     return m_value;
32 };
33 void Gauge::setValue2(float val_)
34 {
35     m_value2=val_;
36     update(boundingRect()); // Value updated, schedule redtaw
37 };
38 float Gauge::value2()
39 {
40     return m_value2;
41 };
42
43
44 QRectF Gauge::boundingRect() const
45     {
46 //        qDebug() << "GaugeBand::boundingRect()" << size().width() << size().height();
47         return QRectF(0.0,0.0,size().width(),size().height());
48     }