QFlightInstruments
QFlightInstruments is a Qt library containing flight instruments widgets.
qfi_ASI.h
1 /****************************************************************************//*
2  * Copyright (C) 2021 Marek M. Cel
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom
9  * the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  ******************************************************************************/
22 #ifndef QFI_ASI_H
23 #define QFI_ASI_H
24 
26 
27 #include <QGraphicsView>
28 #include <QGraphicsSvgItem>
29 
31 
35 class qfi_ASI : public QGraphicsView
36 {
37  Q_OBJECT
38 
39 public:
40 
42  qfi_ASI( QWidget *parent = Q_NULLPTR );
43 
45  virtual ~qfi_ASI();
46 
48  void reinit();
49 
51  void redraw();
52 
54  void setAirspeed( double airspeed );
55 
56 protected:
57 
59  void resizeEvent( QResizeEvent *event );
60 
61 private:
62 
63  QGraphicsScene *_scene;
64 
65  QGraphicsSvgItem *_itemFace;
66  QGraphicsSvgItem *_itemHand;
67  QGraphicsSvgItem *_itemCase;
68 
69  double _airspeed;
70 
71  double _scaleX;
72  double _scaleY;
73 
74  const int _originalHeight;
75  const int _originalWidth;
76 
77  QPointF _originalAsiCtr;
78 
79  const int _faceZ;
80  const int _handZ;
81  const int _caseZ;
82 
83  void init();
84 
85  void reset();
86 
87  void updateView();
88 };
89 
91 
92 #endif // QFI_ASI_H
qfi_ASI
Airspeed Indicator widget class.
Definition: qfi_ASI.h:35
qfi_ASI::~qfi_ASI
virtual ~qfi_ASI()
Definition: qfi_ASI.cpp:68
qfi_ASI::setAirspeed
void setAirspeed(double airspeed)
Definition: qfi_ASI.cpp:104
qfi_ASI::qfi_ASI
qfi_ASI(QWidget *parent=Q_NULLPTR)
Definition: qfi_ASI.cpp:33
qfi_ASI::reinit
void reinit()
Definition: qfi_ASI.cpp:82
qfi_ASI::redraw
void redraw()
Definition: qfi_ASI.cpp:94