QFlightInstruments
QFlightInstruments is a Qt library containing flight instruments widgets.
qfi_ALT.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_ALT_H
23 #define QFI_ALT_H
24 
26 
27 #include <QGraphicsView>
28 #include <QGraphicsSvgItem>
29 
31 
35 class qfi_ALT : public QGraphicsView
36 {
37  Q_OBJECT
38 
39 public:
40 
42  qfi_ALT( QWidget *parent = Q_NULLPTR );
43 
45  virtual ~qfi_ALT();
46 
48  void reinit();
49 
51  void redraw();
52 
54  void setAltitude( double altitude );
55 
57  void setPressure( double aressure );
58 
59 protected:
60 
62  void resizeEvent( QResizeEvent *event );
63 
64 private:
65 
66  QGraphicsScene *_scene;
67 
68  QGraphicsSvgItem *_itemFace_1;
69  QGraphicsSvgItem *_itemFace_2;
70  QGraphicsSvgItem *_itemFace_3;
71  QGraphicsSvgItem *_itemHand_1;
72  QGraphicsSvgItem *_itemHand_2;
73  QGraphicsSvgItem *_itemCase;
74 
75  double _altitude;
76  double _pressure;
77 
78  double _scaleX;
79  double _scaleY;
80 
81  const int _originalHeight;
82  const int _originalWidth;
83 
84  QPointF _originalAltCtr;
85 
86  const int _face1Z;
87  const int _face2Z;
88  const int _face3Z;
89  const int _hand1Z;
90  const int _hand2Z;
91  const int _caseZ;
92 
93  void init();
94 
95  void reset();
96 
97  void updateView();
98 };
99 
101 
102 #endif // QFI_ALT_H
qfi_ALT::reinit
void reinit()
Definition: qfi_ALT.cpp:89
qfi_ALT::~qfi_ALT
virtual ~qfi_ALT()
Definition: qfi_ALT.cpp:75
qfi_ALT::redraw
void redraw()
Definition: qfi_ALT.cpp:101
qfi_ALT::setPressure
void setPressure(double aressure)
Definition: qfi_ALT.cpp:118
qfi_ALT::setAltitude
void setAltitude(double altitude)
Definition: qfi_ALT.cpp:111
qfi_ALT
Barometric Altimeter widget class.
Definition: qfi_ALT.h:35
qfi_ALT::qfi_ALT
qfi_ALT(QWidget *parent=Q_NULLPTR)
Definition: qfi_ALT.cpp:33