dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
positionfield.h
Go to the documentation of this file.
1 
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 
27 #ifndef POSITIONFIELD_H
28 #define POSITIONFIELD_H
29 
30 #include <QWidget>
31 #include <QGraphicsView>
32 #include <QtSvg/QSvgRenderer>
33 #include <QtSvg/QGraphicsSvgItem>
34 
35 namespace Ui {
36 class PositionField;
37 }
38 
39 class PositionField : public QGraphicsView
40 {
41  Q_OBJECT
42 
43 public:
44  explicit PositionField(QWidget *parent = nullptr);
46  void paint();
47 
48 protected:
49  void mouseMoveEvent(QMouseEvent *event);
50  void mousePressEvent(QMouseEvent *event);
51  void paintEvent(QPaintEvent *event);
52  void resizeEvent(QResizeEvent *event);
53 
54 signals:
55  void positionClicked(double north, double east);
56 
57 public slots:
58  void updateDesiredIndicator(double north, double east);
59  void updateActualIndicator(double north, double east);
60 
61 private:
62  QSvgRenderer *m_renderer;
63  QGraphicsSvgItem *m_background;
64  QGraphicsSvgItem *m_positiondesired;
65  QGraphicsSvgItem *m_positionactual;
66 };
67 
68 #endif // POSITIONFIELD_H
69 
void mousePressEvent(QMouseEvent *event)
Redirect mouse move clicks to control position.
void updateDesiredIndicator(double north, double east)
Update aircraft position on image (values go from -1 to 1)
void updateActualIndicator(double north, double east)
void paintEvent(QPaintEvent *event)
void mouseMoveEvent(QMouseEvent *event)
Redirect mouse move events to control position.
void resizeEvent(QResizeEvent *event)
PositionField(QWidget *parent=nullptr)
Constructor for JoystickControl widget. Sets up the image of a joystick.
void positionClicked(double north, double east)