1 #include <qwt_dial.h> 2 #include <qwt_dial_needle.h> 3 4 class AttitudeIndicatorNeedle: public QwtDialNeedle 5 { 6 public: 7 AttitudeIndicatorNeedle(const QColor &); 8 9 virtual void draw(QPainter *, const QPoint &, int length, 10 double direction, QPalette::ColorGroup) const; 11 }; 12 13 class AttitudeIndicator: public QwtDial 14 { 15 Q_OBJECT 16 17 public: 18 AttitudeIndicator(QWidget *parent = NULL); 19 angle()20 double angle() const { return value(); } gradient()21 double gradient() const { return d_gradient; } 22 23 public slots: 24 void setGradient(double); setAngle(double angle)25 void setAngle(double angle) { setValue(angle); } 26 27 protected: 28 virtual void keyPressEvent(QKeyEvent *); 29 30 virtual void drawScale(QPainter *, const QPoint ¢er, 31 int radius, double origin, double arcMin, double arcMax) const; 32 33 virtual void drawScaleContents(QPainter *painter, 34 const QPoint ¢er, int radius) const; 35 36 private: 37 double d_gradient; 38 }; 39