5 #include <QtCore/QtPlugin>
19 stationary_o = QImage(data_dir +
"stationary.svg");
20 background_o = QPixmap(stationary_o.size());
21 rotate_o = QImage(data_dir +
"rotate.svg");
22 dial_o = QImage(data_dir +
"dial.svg");
23 background = background_o;
24 stationary = stationary_o;
38 if (myvalue!=rollangle)
46 if (myvalue!=pitchangle)
54 QPoint point=QPoint(0,0);
56 transform.translate(background.width()/2.0,background.height()/2.0);
57 transform.rotate(-rollangle*180.0/M_PI);
58 transform.translate(0,-pitchangle*180.0/M_PI*3.5);
59 transform.translate(-background.width()/2.0,-background.height()/2.0);
61 QPainter painter(
this);
63 painter.setClipRect(0,0,background.width(),background.height());
65 painter.setTransform(transform);
66 painter.translate(0,-background.height()/2.0-background.height()*0.0328947368421);
67 painter.drawImage(0,0, rotate);
69 transform.translate(background.width()/2.0,background.height()/2.0);
70 transform.translate(0,pitchangle*180.0/M_PI*3.5);
71 transform.translate(-background.width()/2.0,-background.height()/2.0);
72 painter.setTransform(transform);
74 painter.drawImage(0,0, dial);
76 painter.drawImage( point,stationary);
81 QWidget::resizeEvent(event);
83 background = background_o.scaled(size(),Qt::KeepAspectRatio);
84 stationary = stationary_o.scaled(size(),Qt::KeepAspectRatio);
85 dial = dial_o.scaled(size(),Qt::KeepAspectRatio);
86 rotate = rotate_o.scaledToWidth(dial.width()*1.01315789474);
void setRollAngle(double myvalue)
ArtificialHorizon(QWidget *parent=NULL)
void paintEvent(QPaintEvent *)
void setPitchAngle(double myval)
ArtificialHorizon * newInstance()
void setDataDir(QString const &data_dir)
void resizeEvent(QResizeEvent *event)