├── .gitignore
├── LICENSE
├── Makefile
├── README.md
├── TestWin.cpp
├── TestWin.h
├── main.cpp
├── qFlightInstruments.cpp
├── qFlightInstruments.h
├── qFlightInstruments.pro
└── screen_shot.png
/.gitignore:
--------------------------------------------------------------------------------
1 | Makefile
2 | *.user
3 | qFlightInstruments
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
341 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | #############################################################################
2 | # Makefile for building: qFlightInstruments
3 | # Generated by qmake (3.0) (Qt 5.5.1)
4 | # Project: qFlightInstruments.pro
5 | # Template: app
6 | # Command: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake -o Makefile qFlightInstruments.pro
7 | #############################################################################
8 |
9 | MAKEFILE = Makefile
10 |
11 | ####### Compiler, tools and options
12 |
13 | CC = gcc
14 | CXX = g++
15 | DEFINES = -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
16 | CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
17 | CXXFLAGS = -m64 -pipe -std=c++11 -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
18 | INCPATH = -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64
19 | QMAKE = /usr/lib/x86_64-linux-gnu/qt5/bin/qmake
20 | DEL_FILE = rm -f
21 | CHK_DIR_EXISTS= test -d
22 | MKDIR = mkdir -p
23 | COPY = cp -f
24 | COPY_FILE = cp -f
25 | COPY_DIR = cp -f -R
26 | INSTALL_FILE = install -m 644 -p
27 | INSTALL_PROGRAM = install -m 755 -p
28 | INSTALL_DIR = cp -f -R
29 | DEL_FILE = rm -f
30 | SYMLINK = ln -f -s
31 | DEL_DIR = rmdir
32 | MOVE = mv -f
33 | TAR = tar -cf
34 | COMPRESS = gzip -9f
35 | DISTNAME = qFlightInstruments1.0.0
36 | DISTDIR = /home_data/bushuhui-data/msdk/my_progs/my_selected/best_selected/qFlightInstruments/.tmp/qFlightInstruments1.0.0
37 | LINK = g++
38 | LFLAGS = -m64 -Wl,-O1
39 | LIBS = $(SUBLIBS) -L/usr/X11R6/lib64 -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
40 | AR = ar cqs
41 | RANLIB =
42 | SED = sed
43 | STRIP = strip
44 |
45 | ####### Output directory
46 |
47 | OBJECTS_DIR = ./
48 |
49 | ####### Files
50 |
51 | SOURCES = main.cpp \
52 | TestWin.cpp \
53 | qFlightInstruments.cpp moc_qFlightInstruments.cpp
54 | OBJECTS = main.o \
55 | TestWin.o \
56 | qFlightInstruments.o \
57 | moc_qFlightInstruments.o
58 | DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
59 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \
60 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \
61 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf \
62 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \
63 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \
64 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \
65 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \
66 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \
67 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
68 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \
69 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
70 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \
71 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \
72 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \
73 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \
74 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri \
75 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \
76 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \
77 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \
78 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \
79 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri \
80 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \
81 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \
82 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \
83 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri \
84 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \
85 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \
86 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \
87 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \
88 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri \
89 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \
90 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \
91 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \
92 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \
93 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
94 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \
95 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \
96 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \
97 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \
98 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf \
99 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \
100 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \
101 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
102 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \
103 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \
104 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \
105 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \
106 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \
107 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \
108 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \
109 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf \
110 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \
111 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \
112 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \
113 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \
114 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \
115 | qFlightInstruments.pro qFlightInstruments.h \
116 | TestWin.h main.cpp \
117 | TestWin.cpp \
118 | qFlightInstruments.cpp
119 | QMAKE_TARGET = qFlightInstruments
120 | DESTDIR = #avoid trailing-slash linebreak
121 | TARGET = qFlightInstruments
122 |
123 |
124 | first: all
125 | ####### Implicit rules
126 |
127 | .SUFFIXES: .o .c .cpp .cc .cxx .C
128 |
129 | .cpp.o:
130 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
131 |
132 | .cc.o:
133 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
134 |
135 | .cxx.o:
136 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
137 |
138 | .C.o:
139 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
140 |
141 | .c.o:
142 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
143 |
144 | ####### Build rules
145 |
146 | $(TARGET): $(OBJECTS)
147 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
148 |
149 | Makefile: qFlightInstruments.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
150 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf \
151 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf \
152 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf \
153 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf \
154 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf \
155 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf \
156 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf \
157 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri \
158 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
159 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri \
160 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
161 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri \
162 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri \
163 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri \
164 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri \
165 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri \
166 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri \
167 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri \
168 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri \
169 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri \
170 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri \
171 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri \
172 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri \
173 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \
174 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri \
175 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri \
176 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \
177 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri \
178 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri \
179 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri \
180 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri \
181 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri \
182 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri \
183 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri \
184 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
185 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri \
186 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri \
187 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf \
188 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \
189 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf \
190 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \
191 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \
192 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
193 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf \
194 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf \
195 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf \
196 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf \
197 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf \
198 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf \
199 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf \
200 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf \
201 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf \
202 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf \
203 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf \
204 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf \
205 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf \
206 | qFlightInstruments.pro \
207 | /usr/lib/x86_64-linux-gnu/libQt5Widgets.prl \
208 | /usr/lib/x86_64-linux-gnu/libQt5Gui.prl \
209 | /usr/lib/x86_64-linux-gnu/libQt5Core.prl
210 | $(QMAKE) -o Makefile qFlightInstruments.pro
211 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf:
212 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/unix.conf:
213 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/linux.conf:
214 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/sanitize.conf:
215 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base.conf:
216 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/gcc-base-unix.conf:
217 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-base.conf:
218 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/common/g++-unix.conf:
219 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/qconfig.pri:
220 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri:
221 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent.pri:
222 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_concurrent_private.pri:
223 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core.pri:
224 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_core_private.pri:
225 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus.pri:
226 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_dbus_private.pri:
227 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_eglfs_device_lib_private.pri:
228 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui.pri:
229 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_gui_private.pri:
230 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network.pri:
231 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_network_private.pri:
232 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl.pri:
233 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_opengl_private.pri:
234 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions.pri:
235 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri:
236 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri:
237 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport.pri:
238 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_printsupport_private.pri:
239 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql.pri:
240 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_sql_private.pri:
241 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_svg.pri:
242 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib.pri:
243 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_testlib_private.pri:
244 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets.pri:
245 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_widgets_private.pri:
246 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri:
247 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml.pri:
248 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_lib_xml_private.pri:
249 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_functions.prf:
250 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf:
251 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf:
252 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf:
253 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf:
254 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf:
255 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resolve_config.prf:
256 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_post.prf:
257 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/warn_on.prf:
258 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt.prf:
259 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/resources.prf:
260 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/moc.prf:
261 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/opengl.prf:
262 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/uic.prf:
263 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/unix/thread.prf:
264 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/testcase_targets.prf:
265 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exceptions.prf:
266 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/yacc.prf:
267 | /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/lex.prf:
268 | qFlightInstruments.pro:
269 | /usr/lib/x86_64-linux-gnu/libQt5Widgets.prl:
270 | /usr/lib/x86_64-linux-gnu/libQt5Gui.prl:
271 | /usr/lib/x86_64-linux-gnu/libQt5Core.prl:
272 | qmake: FORCE
273 | @$(QMAKE) -o Makefile qFlightInstruments.pro
274 |
275 | qmake_all: FORCE
276 |
277 |
278 | all: Makefile $(TARGET)
279 |
280 | dist: distdir FORCE
281 | (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
282 |
283 | distdir: FORCE
284 | @test -d $(DISTDIR) || mkdir -p $(DISTDIR)
285 | $(COPY_FILE) --parents $(DIST) $(DISTDIR)/
286 | $(COPY_FILE) --parents qFlightInstruments.h TestWin.h $(DISTDIR)/
287 | $(COPY_FILE) --parents main.cpp TestWin.cpp qFlightInstruments.cpp $(DISTDIR)/
288 |
289 |
290 | clean: compiler_clean
291 | -$(DEL_FILE) $(OBJECTS)
292 | -$(DEL_FILE) *~ core *.core
293 |
294 |
295 | distclean: clean
296 | -$(DEL_FILE) $(TARGET)
297 | -$(DEL_FILE) Makefile
298 |
299 |
300 | ####### Sub-libraries
301 |
302 | mocclean: compiler_moc_header_clean compiler_moc_source_clean
303 |
304 | mocables: compiler_moc_header_make_all compiler_moc_source_make_all
305 |
306 | check: first
307 |
308 | compiler_rcc_make_all:
309 | compiler_rcc_clean:
310 | compiler_moc_header_make_all: moc_qFlightInstruments.cpp
311 | compiler_moc_header_clean:
312 | -$(DEL_FILE) moc_qFlightInstruments.cpp
313 | moc_qFlightInstruments.cpp: qFlightInstruments.h
314 | /usr/lib/x86_64-linux-gnu/qt5/bin/moc $(DEFINES) -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I/home_data/bushuhui-data/msdk/my_progs/my_selected/best_selected/qFlightInstruments -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/c++/5 -I/usr/include/x86_64-linux-gnu/c++/5 -I/usr/include/c++/5/backward -I/usr/lib/gcc/x86_64-linux-gnu/5/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include qFlightInstruments.h -o moc_qFlightInstruments.cpp
315 |
316 | compiler_moc_source_make_all:
317 | compiler_moc_source_clean:
318 | compiler_uic_make_all:
319 | compiler_uic_clean:
320 | compiler_yacc_decl_make_all:
321 | compiler_yacc_decl_clean:
322 | compiler_yacc_impl_make_all:
323 | compiler_yacc_impl_clean:
324 | compiler_lex_make_all:
325 | compiler_lex_clean:
326 | compiler_clean: compiler_moc_header_clean
327 |
328 | ####### Compile
329 |
330 | main.o: main.cpp qFlightInstruments.h \
331 | TestWin.h
332 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
333 |
334 | TestWin.o: TestWin.cpp TestWin.h \
335 | qFlightInstruments.h
336 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o TestWin.o TestWin.cpp
337 |
338 | qFlightInstruments.o: qFlightInstruments.cpp qFlightInstruments.h
339 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qFlightInstruments.o qFlightInstruments.cpp
340 |
341 | moc_qFlightInstruments.o: moc_qFlightInstruments.cpp
342 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_qFlightInstruments.o moc_qFlightInstruments.cpp
343 |
344 | ####### Install
345 |
346 | install: FORCE
347 |
348 | uninstall: FORCE
349 |
350 | FORCE:
351 |
352 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Qt Flight instrument widgets
2 |
3 | This program is a pure Qt implementation of flight instrument widgets, including attitude display indicator (ADI), compass, and list viewer. These widgets are wrote in single .h/.cpp, therefore is easy to add to your project. In addition it is easy to modify.
4 |
5 | The source is based on part of source code (https://github.com/cmex81/qAttitudeIndicator). We improve their implementation and make it clear to read.
6 |
7 |
8 | ## Requirements:
9 | * Qt4 (sudo apt-get install libqt4-core libqt4-dev)
10 |
11 |
12 | ## Compile:
13 | `qmake qFlightInstruments.pro`
14 |
15 | `make`
16 |
17 |
18 | ## Usage:
19 | ```
20 | ./qFlightInstruments
21 |
22 | Keyboard:
23 | UP - Pitch +
24 | DOWN - Pitch -
25 | LEFT - Roll -
26 | RIGHT - Roll +
27 | A - Yaw +
28 | D - Yaw -
29 | W - Alt +
30 | S - Alt -
31 | J - H +
32 | K - H -
33 | ```
34 |
35 |
36 |
37 | ## Plateform:
38 | Only test on Linux Mint 16 64-bit.
39 |
40 |
41 |
42 | ## Screenshot:
43 | -
44 |
45 |
46 |
47 | ## Project homepage:
48 | http://www.adv-ci.com/blog/source/qflightinstruments/
49 |
--------------------------------------------------------------------------------
/TestWin.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 |
10 | #include "TestWin.h"
11 |
12 |
13 | TestWin::TestWin(QWidget *parent) : QWidget(parent)
14 | {
15 | // setup layout
16 | setupLayout();
17 |
18 | // set help message
19 | QString szHelp =
20 | QString("Demo usage:\n") +
21 | QString("----------------------------\n") +
22 | QString("UP - Pitch +\n") +
23 | QString("DOWN - Pitch -\n") +
24 | QString("LEFT - Roll -\n") +
25 | QString("RIGHT - Roll +\n") +
26 | QString("A - Yaw +\n") +
27 | QString("D - Yaw -\n") +
28 | QString("W - Alt +\n") +
29 | QString("S - Alt -\n") +
30 | QString("J - H +\n") +
31 | QString("K - H -\n");
32 | m_helpMsg->setText(szHelp);
33 | m_helpMsg->setFont(QFont("DejaVu Sans YuanTi Mono", 10));
34 |
35 | // set default info
36 | m_infoList->getData()["roll"] = QString("%1").arg(m_ADI->getRoll());
37 | m_infoList->getData()["pitch"] = QString("%1").arg(m_ADI->getPitch());
38 | m_infoList->getData()["yaw"] = QString("%1").arg(m_Compass->getYaw());
39 | m_infoList->getData()["alt"] = QString("%1").arg(m_Compass->getAlt());
40 | m_infoList->getData()["H"] = QString("%1").arg(m_Compass->getH());
41 | m_infoList->listReload();
42 |
43 | // set window minimum size
44 | this->setMinimumSize(800, 600);
45 |
46 | // set focus to this window
47 | this->setFocus();
48 |
49 | // window title
50 | setWindowTitle("Demo of Flight Instruments");
51 | }
52 |
53 | TestWin::~TestWin()
54 | {
55 |
56 | }
57 |
58 | int TestWin::setupLayout(void)
59 | {
60 | // right pannel
61 | m_helpMsg = new QTextEdit(this);
62 | m_helpMsg->setReadOnly(true);
63 | m_helpMsg->setFocusPolicy(Qt::NoFocus);
64 |
65 | // left pannel
66 | QWidget *wLeftPanel = new QWidget(this);
67 | QVBoxLayout *vl = new QVBoxLayout(wLeftPanel);
68 | wLeftPanel->setLayout(vl);
69 | wLeftPanel->setFocusPolicy(Qt::NoFocus);
70 |
71 | m_ADI = new QADI(this);
72 | m_Compass = new QCompass(this);
73 | m_infoList = new QKeyValueListView(this);
74 |
75 | vl->addWidget(m_ADI, 0, Qt::AlignTop|Qt::AlignHCenter);
76 | vl->addWidget(m_Compass, 0, Qt::AlignTop|Qt::AlignHCenter);
77 | vl->addWidget(m_infoList, 2, 0);
78 | vl->setMargin(0);
79 | vl->setSpacing(4);
80 |
81 | // overall layout
82 | QHBoxLayout *hl = new QHBoxLayout(this);
83 | this->setLayout(hl);
84 |
85 | hl->addWidget(m_helpMsg, 1);
86 | hl->addWidget(wLeftPanel, 0);
87 |
88 | return 0;
89 | }
90 |
91 |
92 | void TestWin::keyPressEvent(QKeyEvent *event)
93 | {
94 | int key;
95 | double v;
96 |
97 | key = event->key();
98 |
99 | if( key == Qt::Key_Up ) {
100 | v = m_ADI->getPitch();
101 | m_ADI->setPitch(v+1.0);
102 | } else if ( key == Qt::Key_Down ) {
103 | v = m_ADI->getPitch();
104 | m_ADI->setPitch(v-1.0);
105 | } else if ( key == Qt::Key_Left ) {
106 | v = m_ADI->getRoll();
107 | m_ADI->setRoll(v-1.0);
108 | } else if ( key == Qt::Key_Right ) {
109 | v = m_ADI->getRoll();
110 | m_ADI->setRoll(v+1.0);
111 | } else if ( key == Qt::Key_A ) {
112 | v = m_Compass->getYaw();
113 | m_Compass->setYaw(v+1.0);
114 | } else if ( key == Qt::Key_D ) {
115 | v = m_Compass->getYaw();
116 | m_Compass->setYaw(v-1.0);
117 | } else if ( key == Qt::Key_W ) {
118 | v = m_Compass->getAlt();
119 | m_Compass->setAlt(v+1.0);
120 | } else if ( key == Qt::Key_S ) {
121 | v = m_Compass->getAlt();
122 | m_Compass->setAlt(v-1.0);
123 | } else if ( key == Qt::Key_J ) {
124 | v = m_Compass->getH();
125 | m_Compass->setH(v+1.0);
126 | } else if ( key == Qt::Key_K ) {
127 | v = m_Compass->getH();
128 | m_Compass->setH(v-1.0);
129 | }
130 |
131 | m_infoList->getData()["roll"] = QString("%1").arg(m_ADI->getRoll());
132 | m_infoList->getData()["pitch"] = QString("%1").arg(m_ADI->getPitch());
133 | m_infoList->getData()["yaw"] = QString("%1").arg(m_Compass->getYaw());
134 | m_infoList->getData()["alt"] = QString("%1").arg(m_Compass->getAlt());
135 | m_infoList->getData()["H"] = QString("%1").arg(m_Compass->getH());
136 | m_infoList->listReload();
137 | }
138 |
139 | void TestWin::mousePressEvent(QMouseEvent *event)
140 | {
141 | QWidget::mousePressEvent(event);
142 | }
143 |
144 | void TestWin::resizeEvent(QResizeEvent *event)
145 | {
146 | QWidget::resizeEvent(event);
147 | }
148 |
149 |
--------------------------------------------------------------------------------
/TestWin.h:
--------------------------------------------------------------------------------
1 | #ifndef __TEST_WIN_H__
2 | #define __TEST_WIN_H__
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "qFlightInstruments.h"
9 |
10 |
11 | class TestWin : public QWidget
12 | {
13 | public:
14 | TestWin(QWidget *parent = NULL);
15 | virtual ~TestWin();
16 |
17 | virtual int setupLayout(void);
18 |
19 |
20 | protected:
21 | void keyPressEvent(QKeyEvent *event);
22 | void mousePressEvent(QMouseEvent *event);
23 | void resizeEvent(QResizeEvent *event);
24 |
25 | protected:
26 | QADI *m_ADI;
27 | QCompass *m_Compass;
28 | QKeyValueListView *m_infoList;
29 |
30 | QTextEdit *m_helpMsg;
31 | };
32 |
33 | #endif // end of __TeST_WIN_H__
34 |
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | #include "qFlightInstruments.h"
7 | #include "TestWin.h"
8 |
9 | int main(int argc, char *argv[])
10 | {
11 | QApplication a(argc, argv);
12 |
13 | TestWin testWin;
14 |
15 | testWin.show();
16 |
17 | return a.exec();
18 | }
19 |
--------------------------------------------------------------------------------
/qFlightInstruments.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #include "qFlightInstruments.h"
12 |
13 |
14 | ////////////////////////////////////////////////////////////////////////////////
15 | ////////////////////////////////////////////////////////////////////////////////
16 |
17 |
18 | QADI::QADI(QWidget *parent)
19 | : QWidget(parent)
20 | {
21 | connect(this, SIGNAL(canvasReplot(void)), this, SLOT(canvasReplot_slot(void)));
22 |
23 | m_sizeMin = 200;
24 | m_sizeMax = 600;
25 | m_offset = 2;
26 | m_size = m_sizeMin - 2*m_offset;
27 |
28 | setMinimumSize(m_sizeMin, m_sizeMin);
29 | setMaximumSize(m_sizeMax, m_sizeMax);
30 | resize(m_sizeMin, m_sizeMin);
31 |
32 | setFocusPolicy(Qt::NoFocus);
33 |
34 | m_roll = 0.0;
35 | m_pitch = 0.0;
36 | }
37 |
38 | QADI::~QADI()
39 | {
40 |
41 | }
42 |
43 |
44 | void QADI::canvasReplot_slot(void)
45 | {
46 | update();
47 | }
48 |
49 |
50 | void QADI::resizeEvent(QResizeEvent *event)
51 | {
52 | m_size = qMin(width(),height()) - 2*m_offset;
53 | }
54 |
55 | void QADI::paintEvent(QPaintEvent *)
56 | {
57 | QPainter painter(this);
58 |
59 | QBrush bgSky(QColor(48,172,220));
60 | QBrush bgGround(QColor(247,168,21));
61 |
62 | QPen whitePen(Qt::white);
63 | QPen blackPen(Qt::black);
64 | QPen pitchPen(Qt::white);
65 | QPen pitchZero(Qt::green);
66 |
67 | whitePen.setWidth(2);
68 | blackPen.setWidth(2);
69 | pitchZero.setWidth(3);
70 |
71 | painter.setRenderHint(QPainter::Antialiasing);
72 |
73 | painter.translate(width() / 2, height() / 2);
74 | painter.rotate(m_roll);
75 |
76 | // FIXME: AHRS output left-hand values
77 | double pitch_tem = -m_pitch;
78 |
79 | // draw background
80 | {
81 | int y_min, y_max;
82 |
83 | y_min = m_size/2*-40.0/45.0;
84 | y_max = m_size/2* 40.0/45.0;
85 |
86 | int y = m_size/2*pitch_tem/45.;
87 | if( y < y_min ) y = y_min;
88 | if( y > y_max ) y = y_max;
89 |
90 | int x = sqrt(m_size*m_size/4 - y*y);
91 | qreal gr = atan((double)(y)/x);
92 | gr = gr * 180./3.1415926;
93 |
94 | painter.setPen(blackPen);
95 | painter.setBrush(bgSky);
96 | painter.drawChord(-m_size/2, -m_size/2, m_size, m_size,
97 | gr*16, (180-2*gr)*16);
98 |
99 | painter.setBrush(bgGround);
100 | painter.drawChord(-m_size/2, -m_size/2, m_size, m_size,
101 | gr*16, -(180+2*gr)*16);
102 | }
103 |
104 | // set mask
105 | QRegion maskRegion(-m_size/2, -m_size/2, m_size, m_size, QRegion::Ellipse);
106 | painter.setClipRegion(maskRegion);
107 |
108 |
109 | // draw pitch lines & marker
110 | {
111 | int x, y, x1, y1;
112 | int textWidth;
113 | double p, r;
114 | int ll = m_size/8, l;
115 |
116 | int fontSize = 8;
117 | QString s;
118 |
119 | pitchPen.setWidth(2);
120 | painter.setFont(QFont("", fontSize));
121 |
122 |
123 | // draw lines
124 | for(int i=-9; i<=9; i++) {
125 | p = i*10;
126 |
127 | s = QString("%1").arg(-p);
128 |
129 | if( i % 3 == 0 )
130 | l = ll;
131 | else
132 | l = ll/2;
133 |
134 | if( i == 0 ) {
135 | painter.setPen(pitchZero);
136 | l = l * 1.8;
137 | } else {
138 | painter.setPen(pitchPen);
139 | }
140 |
141 | y = m_size/2*p/45.0 - m_size/2*pitch_tem/45.;
142 | x = l;
143 |
144 | r = sqrt(x*x + y*y);
145 | if( r > m_size/2 ) continue;
146 |
147 | painter.drawLine(QPointF(-l, 1.0*y), QPointF(l, 1.0*y));
148 |
149 | textWidth = 100;
150 |
151 | if( i % 3 == 0 && i != 0 ) {
152 | painter.setPen(QPen(Qt::white));
153 |
154 | x1 = -x-2-textWidth;
155 | y1 = y - fontSize/2 - 1;
156 | painter.drawText(QRectF(x1, y1, textWidth, fontSize+2),
157 | Qt::AlignRight|Qt::AlignVCenter, s);
158 | }
159 | }
160 |
161 | // draw marker
162 | int markerSize = m_size/20;
163 | float fx1, fy1, fx2, fy2, fx3, fy3;
164 |
165 | painter.setBrush(QBrush(Qt::red));
166 | painter.setPen(Qt::NoPen);
167 |
168 | fx1 = markerSize;
169 | fy1 = 0;
170 | fx2 = fx1 + markerSize;
171 | fy2 = -markerSize/2;
172 | fx3 = fx1 + markerSize;
173 | fy3 = markerSize/2;
174 |
175 | QPointF points[3] = {
176 | QPointF(fx1, fy1),
177 | QPointF(fx2, fy2),
178 | QPointF(fx3, fy3)
179 | };
180 | painter.drawPolygon(points, 3);
181 |
182 | QPointF points2[3] = {
183 | QPointF(-fx1, fy1),
184 | QPointF(-fx2, fy2),
185 | QPointF(-fx3, fy3)
186 | };
187 | painter.drawPolygon(points2, 3);
188 | }
189 |
190 | // draw roll degree lines
191 | {
192 | int nRollLines = 36;
193 | float rotAng = 360.0 / nRollLines;
194 | int rollLineLeng = m_size/25;
195 | double fx1, fy1, fx2, fy2;
196 | int fontSize = 8;
197 | QString s;
198 |
199 | blackPen.setWidth(1);
200 | painter.setPen(blackPen);
201 | painter.setFont(QFont("", fontSize));
202 |
203 | for(int i=0; ikey()) {
256 | case Qt::Key_Left:
257 | m_roll -= 1.0;
258 | break;
259 | case Qt::Key_Right:
260 | m_roll += 1.0;
261 | break;
262 | case Qt::Key_Down:
263 | if(m_pitch>-90.)
264 | m_pitch -=1.0;
265 | break;
266 | case Qt::Key_Up:
267 | if(m_pitch<90.)
268 | m_pitch +=1.0;
269 | break;
270 | default:
271 | QWidget::keyPressEvent(event);
272 | break;
273 | }
274 |
275 | update();
276 | }
277 |
278 |
279 | ////////////////////////////////////////////////////////////////////////////////
280 | ////////////////////////////////////////////////////////////////////////////////
281 |
282 |
283 | QCompass::QCompass(QWidget *parent)
284 | : QWidget(parent)
285 | {
286 | connect(this, SIGNAL(canvasReplot(void)), this, SLOT(canvasReplot_slot(void)));
287 |
288 | m_sizeMin = 200;
289 | m_sizeMax = 600;
290 | m_offset = 2;
291 | m_size = m_sizeMin - 2*m_offset;
292 |
293 | setMinimumSize(m_sizeMin, m_sizeMin);
294 | setMaximumSize(m_sizeMax, m_sizeMax);
295 | resize(m_sizeMin, m_sizeMin);
296 |
297 | setFocusPolicy(Qt::NoFocus);
298 |
299 | m_yaw = 0.0;
300 | m_alt = 0.0;
301 | m_h = 0.0;
302 | }
303 |
304 | QCompass::~QCompass()
305 | {
306 |
307 | }
308 |
309 |
310 | void QCompass::canvasReplot_slot(void)
311 | {
312 | update();
313 | }
314 |
315 | void QCompass::resizeEvent(QResizeEvent *event)
316 | {
317 | m_size = qMin(width(),height()) - 2*m_offset;
318 | }
319 |
320 | void QCompass::paintEvent(QPaintEvent *)
321 | {
322 | QPainter painter(this);
323 |
324 | QBrush bgGround(QColor(48,172,220));
325 |
326 | QPen whitePen(Qt::white);
327 | QPen blackPen(Qt::black);
328 | QPen redPen(Qt::red);
329 | QPen bluePen(Qt::blue);
330 | QPen greenPen(Qt::green);
331 |
332 | whitePen.setWidth(1);
333 | blackPen.setWidth(2);
334 | redPen.setWidth(2);
335 | bluePen.setWidth(2);
336 | greenPen.setWidth(2);
337 |
338 | painter.setRenderHint(QPainter::Antialiasing);
339 |
340 | painter.translate(width() / 2, height() / 2);
341 |
342 |
343 | // draw background
344 | {
345 | painter.setPen(blackPen);
346 | painter.setBrush(bgGround);
347 |
348 | painter.drawEllipse(-m_size/2, -m_size/2, m_size, m_size);
349 | }
350 |
351 |
352 | // draw yaw lines
353 | {
354 | int nyawLines = 36;
355 | float rotAng = 360.0 / nyawLines;
356 | int yawLineLeng = m_size/25;
357 | double fx1, fy1, fx2, fy2;
358 | int fontSize = 8;
359 | QString s;
360 |
361 | blackPen.setWidth(1);
362 | painter.setPen(blackPen);
363 |
364 | for(int i=0; ikey()) {
511 | case Qt::Key_Left:
512 | m_yaw -= 1.0;
513 | break;
514 | case Qt::Key_Right:
515 | m_yaw += 1.0;
516 | break;
517 | case Qt::Key_Down:
518 | m_alt -= 1.0;
519 | break;
520 | case Qt::Key_Up:
521 | m_alt += 1.0;
522 | break;
523 | case Qt::Key_W:
524 | m_h += 1.0;
525 | break;
526 | case Qt::Key_S:
527 | m_h -= 1.0;
528 | break;
529 |
530 | default:
531 | QWidget::keyPressEvent(event);
532 | break;
533 | }
534 |
535 | update();
536 | }
537 |
538 |
539 | ////////////////////////////////////////////////////////////////////////////////
540 | ////////////////////////////////////////////////////////////////////////////////
541 |
542 |
543 | QKeyValueListView::QKeyValueListView(QWidget *parent) : QTableWidget(parent)
544 | {
545 | connect(this, SIGNAL(listUpdate(void)), this, SLOT(listUpdate_slot(void)));
546 |
547 | m_mutex = new QMutex();
548 |
549 | // set row & column numbers
550 | setRowCount(0);
551 | setColumnCount(2);
552 |
553 | // set no headers
554 | //verticalHeader()->hide();
555 | //horizontalHeader()->hide();
556 | QStringList htb = {"Name", "Value"};
557 | this->setHorizontalHeaderLabels(htb);
558 |
559 | // set last section is stretch-able
560 | QHeaderView *HorzHdr = horizontalHeader();
561 | HorzHdr->setStretchLastSection(true);
562 | HorzHdr->resizeSection(0, 80); // set first column width
563 |
564 | // disable table edit & focus
565 | setEditTriggers(QTableWidget::NoEditTriggers);
566 | setFocusPolicy(Qt::NoFocus);
567 | }
568 |
569 | QKeyValueListView::~QKeyValueListView()
570 | {
571 | delete m_mutex;
572 | }
573 |
574 | void QKeyValueListView::listUpdate_slot(void)
575 | {
576 | int i, n;
577 | ListMap::iterator it;
578 |
579 | QColor clCL1, clCL2;
580 | QColor clB1, clB2;
581 |
582 | int fontSize = 8;
583 | int rowHeight = 20;
584 |
585 | clCL1 = QColor(0x00, 0x00, 0xFF);
586 | clCL2 = QColor(0x00, 0x00, 0x00);
587 | clB1 = QColor(0xFF, 0xFF, 0xFF);
588 | clB2 = QColor(0xE0, 0xE0, 0xE0);
589 |
590 | m_mutex->lock();
591 |
592 | n = m_data.size();
593 | setRowCount(n);
594 | setColumnCount(2);
595 |
596 | for(i=0, it=m_data.begin(); it!=m_data.end(); i++, it++) {
597 | // set name cell
598 | if( this->item(i, 0) != NULL ) {
599 | this->item(i, 0)->setText(it.key());
600 | } else {
601 | QTableWidgetItem* item = new QTableWidgetItem();
602 | item->setText(it.key());
603 |
604 | item->setTextColor(clCL1);
605 | if( i % 2 == 0 ) item->setBackgroundColor(clB1);
606 | else item->setBackgroundColor(clB2);
607 |
608 | item->setFont(QFont("", fontSize));
609 |
610 | this->setItem(i, 0, item);
611 | }
612 |
613 | // set value cell
614 | if( this->item(i, 1) != NULL ) {
615 | this->item(i, 1)->setText(it.value());
616 | } else {
617 | QTableWidgetItem* item = new QTableWidgetItem();
618 | item->setText(it.value());
619 |
620 | item->setTextColor(clCL2);
621 | if( i % 2 == 0 ) item->setBackgroundColor(clB1);
622 | else item->setBackgroundColor(clB2);
623 |
624 | item->setFont(QFont("", fontSize));
625 |
626 | this->setItem(i, 1, item);
627 | }
628 |
629 | setRowHeight(i, rowHeight);
630 | }
631 |
632 | m_mutex->unlock();
633 | }
634 |
--------------------------------------------------------------------------------
/qFlightInstruments.h:
--------------------------------------------------------------------------------
1 | #ifndef __QFLIGHTINSTRUMENTS_H__
2 | #define __QFLIGHTINSTRUMENTS_H__
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | ////////////////////////////////////////////////////////////////////////////////
11 | ////////////////////////////////////////////////////////////////////////////////
12 |
13 | ///
14 | /// \brief The Attitude indicator class
15 | ///
16 | class QADI : public QWidget
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | QADI(QWidget *parent = 0);
22 | ~QADI();
23 |
24 | ///
25 | /// \brief Set roll & pitch values (in degree)
26 | /// \param r - roll
27 | /// \param p - pitch
28 | ///
29 | void setData(double r, double p) {
30 | m_roll = r;
31 | m_pitch = p;
32 | if( m_roll < -180 ) m_roll = -180;
33 | if( m_roll > 180 ) m_roll = 180;
34 | if( m_pitch < -90 ) m_pitch = -90;
35 | if( m_pitch > 90 ) m_pitch = 90;
36 |
37 | emit canvasReplot();
38 | }
39 |
40 | ///
41 | /// \brief Set roll angle (in degree)
42 | /// \param val - roll
43 | ///
44 | void setRoll(double val) {
45 | m_roll = val;
46 | if( m_roll < -180 ) m_roll = -180;
47 | if( m_roll > 180 ) m_roll = 180;
48 |
49 | emit canvasReplot();
50 | }
51 |
52 | ///
53 | /// \brief Set pitch value (in degree)
54 | /// \param val
55 | ///
56 | void setPitch(double val) {
57 | m_pitch = val;
58 | if( m_pitch < -90 ) m_pitch = -90;
59 | if( m_pitch > 90 ) m_pitch = 90;
60 |
61 | emit canvasReplot();
62 | }
63 |
64 | ///
65 | /// \brief Get roll angle (in degree)
66 | /// \return roll angle
67 | ///
68 | double getRoll() {return m_roll;}
69 |
70 | ///
71 | /// \brief Get pitch angle (in degree)
72 | /// \return pitch angle
73 | ///
74 | double getPitch(){return m_pitch;}
75 |
76 |
77 | signals:
78 | void canvasReplot(void);
79 |
80 | protected slots:
81 | void canvasReplot_slot(void);
82 |
83 | protected:
84 | void paintEvent(QPaintEvent *event);
85 | void resizeEvent(QResizeEvent *event);
86 | void keyPressEvent(QKeyEvent *event);
87 |
88 | protected:
89 | int m_sizeMin, m_sizeMax; ///< widget's min/max size (in pixel)
90 | int m_size, m_offset; ///< current size & offset
91 |
92 | double m_roll; ///< roll angle (in degree)
93 | double m_pitch; ///< pitch angle (in degree)
94 | };
95 |
96 | ////////////////////////////////////////////////////////////////////////////////
97 | ////////////////////////////////////////////////////////////////////////////////
98 |
99 | ///
100 | /// \brief The Compass & altitude display class
101 | ///
102 | class QCompass : public QWidget
103 | {
104 | Q_OBJECT
105 |
106 | public:
107 | QCompass(QWidget *parent = 0);
108 | ~QCompass();
109 |
110 | ///
111 | /// \brief Set all data (yaw, alt, height)
112 | ///
113 | /// \param y - yaw ( in degree)
114 | /// \param a - altitude ( in m)
115 | /// \param h - height from ground (in m)
116 | ///
117 | void setData(double y, double a, double h) {
118 | m_yaw = y;
119 | m_alt = a;
120 | m_h = h;
121 |
122 | if( m_yaw < 0 ) m_yaw = 360 + m_yaw;
123 | if( m_yaw > 360 ) m_yaw = m_yaw - 360;
124 |
125 | emit canvasReplot();
126 | }
127 |
128 | ///
129 | /// \brief Set yaw angle (in degree)
130 | /// \param val - yaw angle (in degree)
131 | ///
132 | void setYaw(double val) {
133 | m_yaw = val;
134 | if( m_yaw < 0 ) m_yaw = 360 + m_yaw;
135 | if( m_yaw > 360 ) m_yaw = m_yaw - 360;
136 |
137 | emit canvasReplot();
138 | }
139 |
140 | ///
141 | /// \brief Set altitude value
142 | /// \param val - altitude (in m)
143 | ///
144 | void setAlt(double val) {
145 | m_alt = val;
146 |
147 | emit canvasReplot();
148 | }
149 |
150 | ///
151 | /// \brief Set height from ground
152 | /// \param val - height (in m)
153 | ///
154 | void setH(double val) {
155 | m_h = val;
156 |
157 | emit canvasReplot();
158 | }
159 |
160 | ///
161 | /// \brief Get yaw angle
162 | /// \return yaw angle (in degree)
163 | ///
164 | double getYaw() {return m_yaw;}
165 |
166 | ///
167 | /// \brief Get altitude value
168 | /// \return altitude (in m)
169 | ///
170 | double getAlt() {return m_alt;}
171 |
172 | ///
173 | /// \brief Get height from ground
174 | /// \return height from ground (in m)
175 | ///
176 | double getH() {return m_h;}
177 |
178 | signals:
179 | void canvasReplot(void);
180 |
181 | protected slots:
182 | void canvasReplot_slot(void);
183 |
184 | protected:
185 | void paintEvent(QPaintEvent *event);
186 | void resizeEvent(QResizeEvent *event);
187 | void keyPressEvent(QKeyEvent *event);
188 |
189 | protected:
190 | int m_sizeMin, m_sizeMax; ///< widget min/max size (in pixel)
191 | int m_size, m_offset; ///< widget size and offset size
192 |
193 | double m_yaw; ///< yaw angle (in degree)
194 | double m_alt; ///< altitude (in m)
195 | double m_h; ///< height from ground (in m)
196 | };
197 |
198 |
199 | ////////////////////////////////////////////////////////////////////////////////
200 | ////////////////////////////////////////////////////////////////////////////////
201 |
202 | typedef QMap ListMap;
203 |
204 | ///
205 | /// \brief The List view class, it will display key-value pair in lines
206 | ///
207 | class QKeyValueListView : public QTableWidget
208 | {
209 | public:
210 | Q_OBJECT
211 |
212 | public:
213 | QKeyValueListView(QWidget *parent = 0);
214 | virtual ~QKeyValueListView();
215 |
216 | ///
217 | /// \brief Set list data
218 | /// \param d - list data
219 | ///
220 | void setData(ListMap &d) {
221 | m_data = d;
222 | emit listUpdate();
223 | }
224 |
225 | ///
226 | /// \brief Get list data
227 | /// \param d - list data obj
228 | ///
229 | ListMap& getData(void) {
230 | return m_data;
231 | }
232 |
233 | void beginSetData(void) {
234 | m_mutex->lock();
235 | }
236 |
237 | void endSetData(void) {
238 | m_mutex->unlock();
239 | }
240 |
241 | ///
242 | /// \brief Reloat data to table widget
243 | ///
244 | void listReload(void) {
245 | emit listUpdate();
246 | }
247 |
248 | signals:
249 | void listUpdate(void);
250 |
251 | protected slots:
252 | void listUpdate_slot(void);
253 |
254 | protected:
255 | ListMap m_data;
256 | QMutex *m_mutex;
257 | };
258 |
259 | #endif // end of __QFLIGHTINSTRUMENTS_H__
260 |
--------------------------------------------------------------------------------
/qFlightInstruments.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2011-06-14T09:29:57
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui widgets
8 |
9 |
10 | TARGET = qFlightInstruments
11 | TEMPLATE = app
12 |
13 | QMAKE_CXXFLAGS += -std=c++11
14 |
15 | SOURCES += main.cpp \
16 | TestWin.cpp \
17 | qFlightInstruments.cpp \
18 |
19 |
20 | HEADERS += qFlightInstruments.h \
21 | TestWin.h
22 |
23 |
--------------------------------------------------------------------------------
/screen_shot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bushuhui/qFlightInstruments/3b2fd0f541775f7c1d5ac20b8d98f373fbedc17c/screen_shot.png
--------------------------------------------------------------------------------