QFlightInstruments
QFlightInstruments is a Qt library containing flight instruments widgets.
qfi_HI.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_HI_H
23 #define QFI_HI_H
24 
26 
27 #include <QGraphicsView>
28 #include <QGraphicsSvgItem>
29 
31 
35 class qfi_HI : public QGraphicsView
36 {
37  Q_OBJECT
38 
39 public:
40 
42  qfi_HI( QWidget *parent = Q_NULLPTR );
43 
45  virtual ~qfi_HI();
46 
48  void reinit();
49 
51  void redraw();
52 
54  void setHeading( double heading );
55 
56 protected:
57 
59  void resizeEvent( QResizeEvent *event );
60 
61 private:
62 
63  QGraphicsScene *_scene;
64 
65  QGraphicsSvgItem *_itemFace;
66  QGraphicsSvgItem *_itemCase;
67 
68  double _heading;
69 
70  double _scaleX;
71  double _scaleY;
72 
73  const int _originalHeight;
74  const int _originalWidth;
75 
76  QPointF _originalHsiCtr;
77 
78  const int _faceZ;
79  const int _caseZ;
80 
81  void init();
82 
83  void reset();
84 
85  void updateView();
86 };
87 
89 
90 #endif // QFI_HI_H
qfi_HI::setHeading
void setHeading(double heading)
Definition: qfi_HI.cpp:102
qfi_HI
Horizontal Indicator widget class.
Definition: qfi_HI.h:35
qfi_HI::qfi_HI
qfi_HI(QWidget *parent=Q_NULLPTR)
Definition: qfi_HI.cpp:33
qfi_HI::redraw
void redraw()
Definition: qfi_HI.cpp:92
qfi_HI::~qfi_HI
virtual ~qfi_HI()
Definition: qfi_HI.cpp:66
qfi_HI::reinit
void reinit()
Definition: qfi_HI.cpp:80