first import
[mardrone] / mardrone / 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     qDebug() << "Gauge::Gauge()";
11 }
12 #if 1
13 void Gauge::paint(QPainter *painter,
14                            const QStyleOptionGraphicsItem *option,
15                            QWidget *widget)
16  {
17
18  }
19 #endif
20 void Gauge::setValue(float val_)
21 {
22     m_value=val_;
23     update(boundingRect()); // Value updated, schedule redtaw
24 };
25 float Gauge::value()
26 {
27     return m_value;
28 };
29
30 QRectF Gauge::boundingRect() const
31     {
32         return QRectF(0.0,0.0,size().width(),size().height());
33     }