├── .gitignore
├── LICENSE
├── README.md
├── src
├── ReadMe.txt
├── SerialPort.pro
├── SerialPort.pro.user
├── chart.cpp
├── chart.h
├── console.cpp
├── console.h
├── digitlineedit.cpp
├── digitlineedit.h
├── icon.ico
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
├── readme
├── resrc.qrc
├── settingsdialog.cpp
├── settingsdialog.h
├── settingsdialog.ui
├── varlabel.cpp
└── varlabel.h
└── win_64_deploy
├── Qt5Core.dll
├── Qt5Gui.dll
├── Qt5SerialPort.dll
├── Qt5Svg.dll
├── Qt5Widgets.dll
├── QtDemo.exe
├── SavedData
├── JLU2019-04-27_07-37-23-540.csv
└── readme
├── SavedImage
├── JLU2019-04-27_11-24-15-574.png
├── JLU2019-04-27_11-24-33-755.png
└── readme
├── config.ini
├── iconengines
├── qsvgicon.dll
└── readme
├── platforms
├── qwindows.dll
└── readme
├── readme
└── styles
├── qwindowsvistastyle.dll
└── readme
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # QtDemo
2 | 串口波形显示助手
3 |
4 | /*************************************************程序说明文档 版本1.01***********************************************/
5 |
6 | 1.Qt上位机,由串口完成数据通信,分为波形显示面板、基本收发面板和位于底部的串口状态信息面板三部分构成。
7 | 2.串口状态信息面板可选择端口(COM口)及波特率,刷新按钮用于检测此时计算机的所有串口并更新,打开按钮用于
8 | 打开和关闭串口。RX与TX标签显示串口通信的收发字节数,也可用于判断串口通信是否正在进行,而LineEdit为系统控制辅助显示。
9 | 3.基本收发面板用于基本的数据接收,支持发送与接收的ASCII(其实是GBK)与HEX形式发送,对应的按钮功能“顾名思义”即可。特别地,发送框中按下[Ctrl]+[Enter]可快速发送。
10 | 4.波形显示面板用于图形化显示下位机发送来的参数,最多支持20个变量的显示,且变量类型均应为float(IEEE754标准)。
11 | 5.单击波形显示面板“变量”区的各变量名可设置各个变量显示与否,下方的LineEdit用于显示对应变量在当前光标下的实时值(如无光标则默认显示最新值)。
12 | 6.波形显示面板“控制”区的各控件功能“顾名思义”即可,其中“截图”和“保存数据”会在当前程序目录下新建“/SavedData”和“/SavedImage”文件夹。
13 | 7.波形显示面板“控制”区的“设置”按钮会弹出设置框,在该设置框的设置应用后,会自动记录到ini文件中,作为下次程序启动的参数信息。
14 |
15 |
16 | *通讯协议说明:
17 | 用户每发送一组参数时,应加上帧识别码以形成完成的一帧数据,用以提高通信的可靠性,具体格式如下
18 |
19 | 0x44+0x77+用户数据长度位+用户数据报文 + 用户数据校验位,其中0x44和0x77为帧头,检验为异或校验。
20 |
21 | 参考补帧格式代码如下(以下代码为C#示例,具体代码视语言类型和单片机型号而定)
22 | //UserParam 为用户要发送的参数,类型为string,里面按序存放了float型的用户数据
23 | byte data[UserParam.Length+4];
24 | data[0] = 0x44;
25 | data[1] = 0x77;
26 | data[2] = Convert.ToByte(UserParam.Length);
27 |
28 | byte check = 0;
29 | for (int i = 0; i < UserParam.Length; i++)
30 | {
31 | data[4 + i] = Convert.ToByte(UserParam[i]);
32 | check ^= Convert.ToByte(UserParam[i]);
33 | }
34 | data[UserParam.Length+3] = check;
35 | send(data); //发送函数自行定义
36 |
37 | *另,本程序还有很多不完善的地方,水平有限,见谅。
38 |
39 | *本程序由吉林大学某一枚菜鸡个人制作,版权声明无,欢迎免费传播及使用本程序,但您有义务报告在使用发现的BUG。或当您有任何问题,请一并联系
40 | 邮箱LeoWootsi@outlook.com。
41 |
42 |
43 | 版本更新说明:
44 | v1.00 UI界面完成及基本功能完成
45 | v1.01 修正了 程序可能会显得人性化的 BUG ,hhhh
46 |
47 | /****************************************************************************************************************************/
48 |
--------------------------------------------------------------------------------
/src/ReadMe.txt:
--------------------------------------------------------------------------------
1 | //欢迎您加入QQ群(967587625)共同学习交流
2 | /*************************************************程序说明文档 版本1.01***********************************************/
3 |
4 | 1.Qt上位机,由串口完成数据通信,分为波形显示面板、基本收发面板和位于底部的串口状态信息面板三部分构成。
5 | 2.串口状态信息面板可选择端口(COM口)及波特率,刷新按钮用于检测此时计算机的所有串口并更新,打开按钮用于
6 | 打开和关闭串口。RX与TX标签显示串口通信的收发字节数,也可用于判断串口通信是否正在进行,而LineEdit为系统控制辅助显示。
7 | 3.基本收发面板用于基本的数据接收,支持发送与接收的ASCII(其实是GBK)与HEX形式发送,对应的按钮功能“顾名思义”即可。特别地,发送框中按下[Ctrl]+[Enter]可快速发送。
8 | 4.波形显示面板用于图形化显示下位机发送来的参数,最多支持20个变量的显示,且变量类型均应为float(IEEE754标准)。
9 | 5.单击波形显示面板“变量”区的各变量名可设置各个变量显示与否,下方的LineEdit用于显示对应变量在当前光标下的实时值(如无光标则默认显示最新值)。
10 | 6.波形显示面板“控制”区的各控件功能“顾名思义”即可,其中“截图”和“保存数据”会在当前程序目录下新建“/SavedData”和“/SavedImage”文件夹。
11 | 7.波形显示面板“控制”区的“设置”按钮会弹出设置框,在该设置框的设置应用后,会自动记录到ini文件中,作为下次程序启动的参数信息。
12 |
13 |
14 | *通讯协议说明:
15 | 用户每发送一组参数时,应加上帧识别码以形成完成的一帧数据,用以提高通信的可靠性,具体格式如下
16 |
17 | 0x44+0x77+用户数据长度位+用户数据报文 + 用户数据校验位,其中0x44和0x77为帧头,检验为异或校验。
18 |
19 | 参考补帧格式代码如下(以下代码为C#示例,具体代码视语言类型和单片机型号而定)
20 | //UserParam 为用户要发送的参数,类型为string,里面按序存放了float型的用户数据
21 | byte data[UserParam.Length+4];
22 | data[0] = 0x44;
23 | data[1] = 0x77;
24 | data[2] = Convert.ToByte(UserParam.Length);
25 |
26 | byte check = 0;
27 | for (int i = 0; i < UserParam.Length; i++)
28 | {
29 | data[4 + i] = Convert.ToByte(UserParam[i]);
30 | check ^= Convert.ToByte(UserParam[i]);
31 | }
32 | data[UserParam.Length+3] = check;
33 | send(data); //发送函数自行定义
34 |
35 | *另,本程序还有很多不完善的地方,水平有限,见谅。
36 |
37 | *本程序由吉林大学某一枚菜鸡个人制作,版权声明无,欢迎免费传播及使用本程序,但您有义务报告在使用发现的BUG。或当您有任何问题,请一并联系
38 | 邮箱LeoWootsi@outlook.com,当然更直接地,欢迎您加入QQ群(967587625)共同学习交流(&扯淡) 。
39 |
40 |
41 | 版本更新说明:
42 | v1.00 UI界面完成及基本功能完成
43 | v1.01 修正了 程序可能会显得人性化的 BUG ,hhhh
44 |
45 | /****************************************************************************************************************************/
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/src/SerialPort.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2018-12-01T18:25:12
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui
8 |
9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets serialport
10 |
11 | TARGET = QtDemo
12 | TEMPLATE = app
13 | RC_ICONS = icon.ico
14 |
15 | # The following define makes your compiler emit warnings if you use
16 | # any feature of Qt which has been marked as deprecated (the exact warnings
17 | # depend on your compiler). Please consult the documentation of the
18 | # deprecated API in order to know how to port your code away from it.
19 | DEFINES += QT_DEPRECATED_WARNINGS
20 |
21 | # You can also make your code fail to compile if you use deprecated APIs.
22 | # In order to do so, uncomment the following line.
23 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
24 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
25 |
26 | CONFIG += c++11
27 |
28 | SOURCES += \
29 | main.cpp \
30 | mainwindow.cpp \
31 | console.cpp \
32 | chart.cpp \
33 | varlabel.cpp \
34 | settingsdialog.cpp \
35 | digitlineedit.cpp
36 |
37 | HEADERS += \
38 | mainwindow.h \
39 | console.h \
40 | chart.h \
41 | varlabel.h \
42 | settingsdialog.h \
43 | digitlineedit.h
44 |
45 | FORMS += \
46 | mainwindow.ui \
47 | settingsdialog.ui
48 |
49 | # Default rules for deployment.
50 | qnx: target.path = /tmp/$${TARGET}/bin
51 | else: unix:!android: target.path = /opt/$${TARGET}/bin
52 | !isEmpty(target.path): INSTALLS += target
53 |
54 | RESOURCES += \
55 | resrc.qrc
56 |
57 | DISTFILES += \
58 | ReadMe.txt
59 |
--------------------------------------------------------------------------------
/src/chart.cpp:
--------------------------------------------------------------------------------
1 | #include "chart.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 |
12 | Chart::Chart(QWidget *parent):
13 | QWidget(parent)
14 | {
15 | this->setAutoFillBackground(true);
16 | // QTimer* timer =new QTimer(this);
17 | // connect(timer,SIGNAL(timeout()),this,SLOT(drawUpdate()));
18 | // timer->start(10);
19 |
20 | for(int i=0;i<20;i++)
21 | {
22 | listYmax[i]=300;
23 | listYmin[i]=-300;
24 | }
25 | seriesColor[0]=Qt::darkYellow;
26 | seriesColor[1]=Qt::green;
27 | seriesColor[2]=Qt::blue;
28 | seriesColor[3]=Qt::darkGray;
29 | seriesColor[4]=Qt::gray;
30 | seriesColor[5]=Qt::cyan;
31 | seriesColor[6]=Qt::magenta;
32 | seriesColor[7]=Qt::yellow;
33 | seriesColor[8]=Qt::darkGreen;
34 | seriesColor[9]=Qt::darkBlue;
35 | seriesColor[10]=Qt::darkRed;
36 | seriesColor[11]=Qt::darkCyan;
37 | seriesColor[12]=Qt::darkMagenta;
38 | seriesColor[13]=Qt::darkYellow;
39 | seriesColor[14]=Qt::lightGray;
40 | seriesColor[15]=Qt::color0;
41 | seriesColor[16]=Qt::color1;
42 | seriesColor[17]=Qt::white;
43 | seriesColor[18]=Qt::white;
44 | seriesColor[19]=Qt::white;
45 | }
46 |
47 | void Chart::paintEvent(QPaintEvent *event)
48 | {
49 | Q_UNUSED(event);
50 |
51 | QPainter p(this);
52 | QPen pen(QColor::fromRgba(qRgba(255,255,255,127)), 1, Qt::DashLine);//, Qt::RoundCap, Qt::RoundJoin);
53 | p.setPen(pen);
54 | p.setRenderHint(QPainter::Antialiasing, true);
55 |
56 | int width=this->width();
57 | int widthGridStep=width/xGridNum;
58 | int height=this->height();
59 | int heightGridStep=height/yGridNum;
60 |
61 | //辅助显示信息
62 | p.drawText(width/2,height/2,m_ZoomRatio);
63 | //画栅格
64 | if(this->showGrid)
65 | {
66 | for(int i=0;i((m_tmpDrawingTime>m_ixIniLength)? m_tmpDrawingTime :m_ixIniLength);
83 |
84 |
85 | m_ixEnd=static_cast(tmpMax - m_fRollBack);
86 |
87 | m_ixStart=static_cast(m_ixEnd- m_iZoomOutRatio*1.0f / m_iZoomInRatio * m_ixIniLength);
88 |
89 | p.drawText(0,height/2,QString::number(m_ixStart));
90 | p.drawText(width-30,height/2,QString::number(m_ixEnd));
91 |
92 | //画光标
93 | if (this->showCursor)
94 | {
95 | m_ixCurrent =static_cast( m_ixStart + (m_ixEnd - m_ixStart) * m_fHoverX / width);
96 | pen.setColor(QColor::fromRgba(qRgba(255,255,0,185)));
97 | p.setPen(pen);
98 |
99 | p.drawText(static_cast(m_fHoverX),10,QString::number( m_ixCurrent));
100 | p.drawLine(static_cast(m_fHoverX),0,static_cast(m_fHoverX),height);
101 | }
102 |
103 |
104 | //遍历每条曲线并画出
105 | pen.setWidth(static_cast(thickerLine)+1);
106 | pen.setStyle(Qt::SolidLine);
107 | for (int i = 0; i < 20; i++)
108 | {
109 | if (m_flistY[i].size() == 0 || showSeris[i] == false) continue;
110 | m_pointsToDraw.clear();
111 | //装载坐标
112 | if (!changeXYToPoints(i))
113 | {
114 | continue;
115 | }
116 | //装载颜色
117 | pen.setColor(seriesColor[i]);
118 | p.setPen(pen);
119 | try
120 | {
121 | //绘制线
122 | if (m_pointsToDraw.size() == 1)
123 | continue;
124 | p.drawLines(m_pointsToDraw);
125 | }
126 | catch (int)
127 | {
128 | //发生数据溢出错误
129 | }
130 | }
131 | m_xStarPosUpdate = false;
132 |
133 | emit this->updateUi();
134 | }
135 |
136 | void Chart::mousePressEvent(QMouseEvent *e)
137 | {
138 | this->m_isRolling=true;
139 | this->m_fOldX=e->x();
140 | }
141 |
142 | void Chart::mouseReleaseEvent(QMouseEvent *e)
143 | {
144 | Q_UNUSED(e);
145 | this->m_isRolling = false;
146 | this->m_xStarPosUpdate = true;
147 | if(this->selfRefresh )
148 | this->update();
149 | }
150 |
151 | void Chart::mouseMoveEvent(QMouseEvent *e)
152 | {
153 | if (this->m_isRolling == true)
154 | {
155 | this->m_xStarPosUpdate = true;
156 | this->m_fRollBack += (e->x() - this->m_fOldX) *1.0f /this->width() * m_iZoomOutRatio / m_iZoomInRatio * m_ixIniLength;
157 | this->m_fOldX = e->x();
158 | }
159 | this->m_fHoverX = e->x();
160 |
161 | if(this->selfRefresh )
162 | this->update();
163 | }
164 |
165 | void Chart::wheelEvent(QWheelEvent *e)
166 | {
167 |
168 | if (e->delta() > 115) //放大
169 | {
170 | if (m_iZoomOutRatio == 1)
171 | {
172 | m_iZoomInRatio *= 2;
173 | m_ZoomRatio="x"+QString::number(m_iZoomInRatio);
174 | }
175 | else
176 | {
177 | m_iZoomOutRatio /= 2;
178 | m_ZoomRatio= (m_iZoomOutRatio==1)?"x1":("x1"+QString::number(m_iZoomOutRatio));
179 | }
180 | m_iZoomInRatio = (m_iZoomInRatio > 8) ? 8 : m_iZoomInRatio;
181 | }
182 | else if(e->delta() < -115) //缩小
183 | {
184 | if (m_iZoomInRatio == 1)
185 | {
186 | m_iZoomOutRatio *= 2;
187 | m_ZoomRatio="x1/"+QString::number(m_iZoomOutRatio);
188 | }
189 | else
190 | {
191 | m_iZoomInRatio /= 2;
192 | m_ZoomRatio="x"+QString::number(m_iZoomInRatio);
193 | }
194 | m_iZoomOutRatio = (m_iZoomOutRatio > 8) ? 8 : m_iZoomOutRatio;
195 | }
196 |
197 | m_xStarPosUpdate = true;
198 |
199 | if(this->selfRefresh)
200 | this->update();
201 | }
202 |
203 | void Chart::enterEvent(QEvent *e)
204 | {
205 | Q_UNUSED(e);
206 | this->setMouseTracking(true);
207 | }
208 |
209 | void Chart::leaveEvent(QEvent *e)
210 | {
211 | Q_UNUSED(e);
212 | this->setMouseTracking(false);
213 | }
214 |
215 |
216 | //确保index大于等于0小于20
217 | void Chart::addPoint(int index,float data)
218 | {
219 | index=(index<20)?index:19;
220 | if(index==0)m_flistX.append(m_drawingTime);
221 | m_flistY[index].append(data);
222 | m_drawingTime+=static_cast(index==0);
223 | }
224 |
225 | void Chart::init()
226 | {
227 | m_flistX.clear();//20个变量统一以时间为横坐标
228 | for(int i=0;i<20;i++)
229 | {
230 | m_flistY[i].clear();
231 | m_ilistFirstIndex[0]=0;
232 |
233 | }
234 |
235 | m_tmpDrawingTime=0;
236 |
237 |
238 | m_drawingTime=0;
239 | m_tmpEnd=0;
240 | /*int m_ixStartIni=0;*///初始x的start和end
241 | m_ixIniLength=512;
242 | m_ixCurrentLength=512;
243 | m_ixStart=0;//可能经过缩放和拖动的x的start和end
244 | m_ixEnd=512;
245 |
246 | m_ixCurrent=0; //光标所在x坐标
247 | m_iZoomInRatio=1;
248 | m_iZoomOutRatio=1;
249 | m_ZoomRatio="x1";
250 |
251 | m_fHoverX=0;
252 |
253 | m_fOldX=0;
254 | m_fRollBack=0;
255 | m_isRolling=false;
256 | m_xStarPosUpdate=true;
257 | }
258 |
259 | void Chart::restoreAxis()
260 | {
261 | m_iZoomInRatio=1;
262 | m_iZoomOutRatio=1;
263 | m_ZoomRatio="x1";
264 | m_isRolling=false;
265 | m_fRollBack=0;
266 | m_xStarPosUpdate=true;
267 | }
268 |
269 | bool Chart::saveData(QString *names)
270 | {
271 | QString folder = QCoreApplication::applicationDirPath() + "/SavedData";
272 | QString fileName = "/JLU" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss-zzz") + ".csv";
273 | QDir dir(folder);
274 |
275 | if (!dir.exists())
276 | {
277 | dir.mkdir(folder);
278 | }
279 |
280 | QFile file(folder+fileName);
281 | if(file.open(QIODevice::WriteOnly))
282 | {
283 | QString content;
284 |
285 | //**变量名**
286 | content.append("Time"); content.append(',');
287 | for(int i=0;i<20;i++)
288 | {
289 | content.append(names[i]);
290 | content.append(',');
291 | }
292 | content.append('\n');
293 |
294 | //**数据**
295 | int length=static_cast(m_drawingTime);
296 | int index;
297 | for(index=0;index<20;index++)
298 | if(m_flistY[index].size()==0) break;
299 | for (int i = 0; i < length; i++)
300 | {
301 | content.append(QString::number(static_cast(m_flistX[i])));
302 | content.append(',');
303 | for(int j=0;j( m_flistY[j].at(i))));
306 | content.append(',');
307 | }
308 | //先去掉多余的逗号
309 | //content.remove(content.length()-1);//这里没有去掉多余的逗号,因为去掉之后会出现不可预知的数据保存错误
310 | content.append('\n');
311 |
312 | file.write(content.toLocal8Bit());
313 | content.clear();
314 | }
315 | file.close();
316 | return true;
317 | }
318 | else
319 | {
320 | return false;
321 | }
322 |
323 | }
324 |
325 | void Chart::loadData()
326 | {
327 | this->init();
328 | QString filePath=QFileDialog::getOpenFileName(this,"open",
329 | QCoreApplication::applicationDirPath() + "/SavedData","csv(*.csv)");
330 | if(!filePath.isEmpty())
331 | {
332 | QFile file(filePath);
333 | if(file.open(QIODevice::ReadOnly))
334 | {
335 | file.readLine();//第一行 变量名 这里舍弃,也可以读入后显示,这里不做实现
336 |
337 | QString tmp;
338 | float X=0;
339 | for (; !(tmp=file.readLine()).isEmpty();)
340 | {
341 | QStringList dataStr = tmp.split(',');
342 |
343 | X = dataStr[0].toFloat();
344 | int paramCount = dataStr.size()-2;//去掉开头的时间变量/////////和多余的‘,’产生的多余数据 参见数据保存函数//
345 |
346 | m_flistX.append(X);//所有变量的时间X索引
347 |
348 | for (int j=0;j(m_tmpDrawingTime =m_drawingTime=X);
355 | }
356 |
357 | }
358 | }
359 |
360 | float Chart::yValue(int seriesIndex,int timeIndex)
361 | {
362 | return (m_flistY[seriesIndex].size()>timeIndex && timeIndex>0 &&timeIndex<=m_tmpEnd) ? m_flistY[seriesIndex].at(timeIndex) : 0;
363 | }
364 |
365 | bool Chart::changeXYToPoints(int index)
366 | {
367 | QPointF currentPointF(0,0);
368 | bool first=true;
369 |
370 | m_ilistFirstIndex[index] = (m_xStarPosUpdate) ? 0 : m_ilistFirstIndex[index];//有左滚回或缩放则取0
371 |
372 |
373 | //遍历并转换为坐标值
374 | int length = static_cast(m_drawingTime);
375 | int i;
376 | for ( i = m_ilistFirstIndex[index]; i < length; i++)
377 | {
378 | if (m_flistX[i] < m_ixStart)
379 | {
380 | m_ilistFirstIndex[index] = i;//记录最后一个到横坐标起点的XList项索引
381 | continue;
382 | }
383 |
384 | m_tmpEnd=selfRefresh?m_tmpEnd:m_ixEnd;
385 | if (m_flistX[i] > m_tmpEnd)
386 | {
387 | return true;
388 | }
389 | m_tmpEnd=static_cast(selfRefresh?m_tmpEnd:m_flistX[i]);
390 |
391 | m_flistY[index][i] = (m_flistY[index][i] > listYmax[index]) ? listYmax[index] : m_flistY[index][i];
392 | m_flistY[index][i] = (m_flistY[index][i] < listYmin[index]) ? listYmin[index] : m_flistY[index][i];
393 |
394 | //转换为像素坐标
395 | currentPointF.setX(static_cast((m_flistX[i] - m_ixStart) * this->width() *1.0f/ (m_ixEnd - m_ixStart)));
396 | currentPointF.setY(static_cast( this->height() - ((m_flistY[index][i] - listYmin[index]) * this->height() *1.0f/ (listYmax[index] - listYmin[index]))));//*_iZoomRatio;
397 |
398 | //装载坐标
399 | if(first) {m_pointsToDraw.append(currentPointF);first=false;}
400 | m_pointsToDraw.append(currentPointF);
401 | m_pointsToDraw.append(currentPointF);
402 |
403 | }
404 |
405 | return true;
406 | }
407 |
--------------------------------------------------------------------------------
/src/chart.h:
--------------------------------------------------------------------------------
1 | #ifndef CHART_H
2 | #define CHART_H
3 |
4 | #include
5 |
6 |
7 | class Chart : public QWidget
8 | {
9 | Q_OBJECT
10 | public:
11 | explicit Chart(QWidget *parent = nullptr);
12 |
13 | signals:
14 | void updateUi();
15 |
16 | protected:
17 | void paintEvent(QPaintEvent *e) override ;
18 |
19 | void mousePressEvent(QMouseEvent *e) override;
20 | void mouseReleaseEvent(QMouseEvent *e) override;
21 | void mouseMoveEvent(QMouseEvent *e) override;
22 | void wheelEvent(QWheelEvent *e) override;
23 | void enterEvent(QEvent *e) override;
24 | void leaveEvent(QEvent *e) override;
25 | //private slots:
26 | // void drawUpdate();
27 | public:
28 | QColor seriesColor[20];
29 | bool showSeris[20]={1,1,1,1,1 ,1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1};
30 | int listYmax[20]={0};
31 | int listYmin[20]={0};
32 |
33 | int xGridNum=10;
34 | int yGridNum=10;
35 |
36 | bool thickerLine =true;
37 | bool showGrid=true;
38 | bool showCursor=true;
39 | bool selfRefresh=true;
40 |
41 | void addPoint(int index,float data);
42 | void init();
43 | void restoreAxis();
44 | bool saveData(QString *names);
45 | void loadData();
46 | float yValue(int seriesIndex,int timeIndex);
47 | inline int currentCursorX(){return m_ixCurrent;}
48 | private:
49 | QVector m_flistX;//20个变量统一以时间为横坐标
50 | QVector m_flistY[20];
51 | QVector m_pointsToDraw;
52 |
53 | float m_tmpDrawingTime=0;
54 |
55 | int m_ilistFirstIndex[20]={0};
56 | float m_drawingTime=0;
57 | int m_tmpEnd=0;
58 | /*int m_ixStartIni=0;*///初始x的start和end
59 | int m_ixIniLength=512;
60 | int m_ixCurrentLength=512;
61 | int m_ixStart=0;//可能经过缩放和拖动的x的start和end
62 | int m_ixEnd=512;
63 | int m_ixCurrent=0; //光标所在x坐标
64 | int m_iZoomInRatio=1;
65 | int m_iZoomOutRatio=1;
66 | QString m_ZoomRatio="x1";
67 |
68 | float m_fHoverX=0;
69 | float m_fOldX=0;
70 | float m_fRollBack=0;
71 | bool m_isRolling=false;
72 | bool m_xStarPosUpdate=false;
73 |
74 |
75 | bool changeXYToPoints(int index);
76 |
77 | };
78 |
79 | #endif // CHART_H
80 |
--------------------------------------------------------------------------------
/src/console.cpp:
--------------------------------------------------------------------------------
1 | #include "console.h"
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | Console::Console(QWidget *parent) :
8 | QPlainTextEdit(parent)
9 | {
10 | document()->setMaximumBlockCount(100);
11 | }
12 |
13 | void Console::keyPressEvent(QKeyEvent *e)
14 | {
15 |
16 | if(e->key()==Qt::Key_Return && e->modifiers()==Qt::ControlModifier) //按住Ctrl+Enter 发送 个人习惯
17 | emit sendContent();
18 | if(hexCheck)
19 | {
20 | int key=e->key();
21 | if((key>=Qt::Key_0 && key<=Qt::Key_9)||(key>=Qt::Key_A && key<=Qt::Key_F)||key==Qt::Key_Enter||
22 | key==Qt::Key_Return||key==Qt::Key_Backspace||key==Qt::Key_Space||key==Qt::Key_Left||key==Qt::Key_Right
23 | ||key==Qt::Key_Up||key==Qt::Key_Down||key==Qt::Key_Home||key==Qt::Key_End)
24 | QPlainTextEdit::keyPressEvent(e);
25 | else
26 | e->accept();
27 | }
28 | else
29 | QPlainTextEdit::keyPressEvent(e);
30 |
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/src/console.h:
--------------------------------------------------------------------------------
1 | #ifndef CONSOLE_H
2 | #define CONSOLE_H
3 |
4 | #include
5 |
6 | class Console : public QPlainTextEdit
7 | {
8 | Q_OBJECT
9 | signals:
10 | void sendContent();
11 | public:
12 | explicit Console(QWidget *parent = nullptr);
13 | bool hexCheck=false;
14 |
15 | protected:
16 | void keyPressEvent(QKeyEvent *e) override;
17 | // void mousePressEvent(QMouseEvent *e) override;
18 | // void mouseDoubleClickEvent(QMouseEvent *e) override;
19 | };
20 |
21 |
22 | #endif // CONSOLE_H
23 |
--------------------------------------------------------------------------------
/src/digitlineedit.cpp:
--------------------------------------------------------------------------------
1 | #include "digitlineedit.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | DigitLineEdit::DigitLineEdit(QWidget *parent) :
9 | QLineEdit(parent)
10 | {
11 | //禁止中文输入
12 | setAttribute(Qt::WA_InputMethodEnabled, false);
13 | }
14 |
15 | void DigitLineEdit::keyPressEvent(QKeyEvent *e)
16 | {
17 |
18 | int key=e->key();
19 | if((key>=Qt::Key_0 && key<=Qt::Key_9) || key==Qt::Key_Comma || key==Qt::Key_Minus
20 | ||key==Qt::Key_Enter||key==Qt::Key_Return||key==Qt::Key_Backspace||key==Qt::Key_Left||key==Qt::Key_Right
21 | ||key==Qt::Key_Up||key==Qt::Key_Down||key==Qt::Key_Home||key==Qt::Key_End)
22 | QLineEdit::keyPressEvent(e);
23 | else
24 | e->accept();
25 |
26 | }
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/digitlineedit.h:
--------------------------------------------------------------------------------
1 | #ifndef DIGITLINEEDIT_H
2 | #define DIGITLINEEDIT_H
3 |
4 | #include
5 |
6 | class DigitLineEdit : public QLineEdit
7 | {
8 | public:
9 | explicit DigitLineEdit(QWidget *parent = nullptr);
10 |
11 | protected:
12 | void keyPressEvent(QKeyEvent *e) override;
13 | };
14 |
15 | #endif // DIGITLINEEDIT_H
16 |
--------------------------------------------------------------------------------
/src/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/src/icon.ico
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QApplication a(argc, argv);
7 | MainWindow w;
8 | w.show();
9 |
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/src/mainwindow.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow.h"
2 | #include "ui_mainwindow.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 |
11 | MainWindow::MainWindow(QWidget *parent) :
12 | QMainWindow(parent),
13 | ui(new Ui::MainWindow),
14 | m_serial(new QSerialPort(this)),
15 | m_iniFile(new QSettings(QCoreApplication::applicationDirPath()+"/config.ini", QSettings::IniFormat)),
16 | m_settings(new Settingsdialog)
17 | {
18 | QDir::setCurrent(QCoreApplication::applicationDirPath());
19 |
20 | ui->setupUi(this);
21 |
22 | QTextCodec::setCodecForLocale(tc);
23 |
24 | ui->baudRateCombo->setCurrentIndex(3);
25 |
26 | m_varLineEdits<val1<val2<val3<val4<val5<val6<val7
27 | <val8<val9<val10<val11<val12<val13<val14
28 | <val15<val16<val17<val18<val19<val20;
29 | m_varLabels<param1<param2<param3<param4<param5<param6<param7
30 | <param8<param9<param10<param11<param12<param13<param14
31 | <param15<param16<param17<param18<param19<param20;
32 |
33 | for(int i=0;i<20;i++)
34 | {
35 | m_varNames[i]=tr("VAR%1").arg(i+1);
36 | }
37 |
38 | this->readIni();
39 |
40 |
41 | //颜色初始化
42 | for(int i=0;i<20;i++)
43 | {
44 | m_palette.setColor(QPalette::Base,ui->chart->seriesColor[i]);
45 | m_varLineEdits[i]->setPalette(m_palette);
46 | m_varLabels[i]->setText(m_varNames[i]);
47 | }
48 |
49 | connect(ui->chart,&Chart::updateUi,this,&MainWindow::handleUpdateUi);
50 | connect(m_serial, &QSerialPort::errorOccurred, this, &MainWindow::handleError);
51 | connect(m_serial, &QSerialPort::readyRead, this, &MainWindow::readData);
52 | connect(ui->SndBtn, &QPushButton::clicked, this, &MainWindow::writeData);
53 | connect(ui->settingBtn,&QPushButton::clicked,this,&MainWindow::handleSettingBtn);
54 | connect(m_settings,&Settingsdialog::settingsChanged,this,&MainWindow::handleSettingChanged);
55 | connect(ui->SndTextEdit,&Console::sendContent,this,&MainWindow::writeData);
56 |
57 | addLabelConnections();
58 |
59 | m_settings->setEnabled(false);
60 | ui->SndBtn->setEnabled(false);
61 | this->on_detectBtn_clicked();
62 |
63 |
64 | //窗口可以最小化却不能最大化 这样处理的原因是调整各控件随窗体大小变化很麻烦,干脆让窗体大小固定
65 | this->setFixedSize(this->size());
66 | }
67 |
68 | void MainWindow::readIni()
69 | {
70 | //Color
71 | m_iniFile->beginGroup("Color");
72 | QStringList value;
73 | for(int i=0;i<20;i++)
74 | {
75 |
76 |
77 | value=m_iniFile->value(tr("VAL%1").arg(i+1),QString::number(ui->chart->seriesColor[i].red())+","+QString::number(ui->chart->seriesColor[i].green())
78 | +","+QString::number(ui->chart->seriesColor[i].blue())).toString().split(',');
79 | ui->chart->seriesColor[i].setRed(value[0].toInt());
80 | ui->chart->seriesColor[i].setGreen(value[1].toInt());
81 | ui->chart->seriesColor[i].setBlue(value[2].toInt());
82 |
83 | }
84 | m_iniFile->endGroup();
85 |
86 | //Min
87 | m_iniFile->beginGroup("Min");
88 | for(int i=0;i<20;i++)
89 | ui->chart->listYmin[i]=m_iniFile->value(tr("VAL%1").arg(i+1),ui->chart->listYmin[i]).toInt();
90 | m_iniFile->endGroup();
91 |
92 | //Max
93 | m_iniFile->beginGroup("Max");
94 | for(int i=0;i<20;i++)
95 | ui->chart->listYmax[i]=m_iniFile->value(tr("VAL%1").arg(i+1),ui->chart->listYmax[i]).toInt();
96 | m_iniFile->endGroup();
97 |
98 | //Name
99 | m_iniFile->beginGroup("Name");
100 | for(int i=0;i<20;i++)
101 | m_varNames[i]=m_iniFile->value(tr("VAL%1").arg(i+1),m_varNames[i]).toString();
102 | m_iniFile->endGroup();
103 | }
104 |
105 | void MainWindow::handleUpdateUi()
106 | {
107 |
108 | for(int i=0;i<20;i++)
109 | {
110 | m_varLineEdits[i]->setText(QString::number( //串口关闭时的显示
111 | ui->chart->showCursor?static_cast(ui->chart->yValue(i,ui->chart->currentCursorX())) : static_cast(this->m_values[i])));
112 | }
113 |
114 | }
115 | MainWindow::~MainWindow()
116 | {
117 | delete this->m_iniFile;
118 | delete this->m_settings;
119 | delete ui;
120 | }
121 |
122 | void MainWindow::openSerialPort()
123 | {
124 | m_serial->setPortName(ui->portnameCombo->currentText());
125 | m_serial->setBaudRate(static_cast(ui->baudRateCombo->currentText().toInt()));
126 | m_serial->setDataBits(static_cast(8));
127 | m_serial->setParity(static_cast(0));
128 | m_serial->setStopBits(static_cast(1));
129 | m_serial->setFlowControl(static_cast(0));
130 | if (m_serial->open(QIODevice::ReadWrite))
131 | {
132 | ui->SndBtn->setEnabled(true);
133 | ui->detectBtn->setEnabled(false);
134 | showStatusMessage(tr("打开 %1 : %2")
135 | .arg(ui->portnameCombo->currentText()).arg(ui->baudRateCombo->currentText()));
136 | ui->SndBtn->setEnabled(true);
137 |
138 | ui->openBtn->setText("关闭");
139 | ui->chart->selfRefresh=false;
140 |
141 | ui->baudRateCombo->setEnabled(false);
142 | ui->portnameCombo->setEnabled(false);
143 | } else {
144 | QMessageBox::critical(this, tr("Error"), m_serial->errorString());
145 |
146 | showStatusMessage(tr("串口打开失败"));
147 | }
148 | }
149 |
150 |
151 |
152 | void MainWindow::closeSerialPort()
153 | {
154 | if (m_serial->isOpen())
155 | m_serial->close();
156 | ui->SndBtn->setEnabled(false);
157 | ui->detectBtn->setEnabled(true);
158 | ui->openBtn->setText("打开");
159 | ui->chart->selfRefresh=true;
160 | ui->baudRateCombo->setEnabled(true);
161 | ui->portnameCombo->setEnabled(true);
162 | showStatusMessage(tr("串口关闭"));
163 | }
164 |
165 |
166 | void MainWindow::writeData()
167 | {
168 | if (ui->SndHex->isChecked()== true) //“HEX发送” 按钮
169 | {
170 | QString sndStr = ui->SndTextEdit->toPlainText().remove(' ').remove('\n').toUpper();
171 |
172 | if (sndStr.length() % 2 != 0)
173 | {
174 |
175 | QMessageBox::critical(this, tr("Error"), tr("HEX发送模式下,字符数量\n应为偶数,请注意补零!"));
176 | return;
177 | }
178 |
179 | int len = sndStr.length()/2;
180 | QByteArray tmp1(len*2,' ');
181 | QByteArray tmp2(len,' ');
182 |
183 | for (int i = 0; i < len*2; i++)
184 | {
185 | //对只读数据,at 比 []要快,因为不会导致深层次的拷贝
186 | if (sndStr.at(i) >= '0' && sndStr.at(i) <= '9')
187 | tmp1[i] = sndStr.at(i).toLatin1() - '0'; //0~9
188 | else
189 | tmp1[i] = sndStr.at(i).toLatin1() - 'A' + 10; //10~15
190 | }
191 | for(int i=0;iwrite(tmp2);
196 |
197 | Stx += static_cast(len);
198 | }
199 | else //以字符串形式发送时
200 | {
201 | QByteArray tmpQStr=tc->fromUnicode(ui->SndTextEdit->toPlainText().replace('\n',"\r\n").toUtf8());
202 | m_serial->write(tmpQStr); //写入数据
203 | Stx += static_cast(tmpQStr.length());
204 | }
205 | ui->SndCnt->setText(QString::number(Stx));
206 | }
207 |
208 | void MainWindow::readData()
209 | {
210 | const QByteArray data = m_serial->readAll();
211 |
212 | if(ui->RcvBtn->text()=="暂停" && ui->stackedWidget->currentIndex()==1)
213 | {
214 | if(ui->RcvHex->isChecked())
215 | {
216 | QString tmpQStr;
217 | char tmpByte;
218 | foreach(char byte ,data)
219 | {
220 | tmpByte=(byte&0xF0)>>4;
221 | tmpQStr += (tmpByte < 10)?tmpByte+'0':tmpByte+'A'-10;
222 |
223 | tmpByte=byte&0x0F;
224 | tmpQStr += (tmpByte < 10)?tmpByte+'0':tmpByte+'A'-10;
225 | tmpQStr += ' ';
226 | }
227 |
228 | ui->RcvTextEdit->insertPlainText(tmpQStr);
229 | }
230 | else
231 | {
232 | QString tmpQStr = tc->toUnicode(data);
233 | ui->RcvTextEdit->insertPlainText(tmpQStr);
234 | }
235 | }
236 |
237 | ui->RcvTextEdit->verticalScrollBar()->setValue(ui->RcvTextEdit->verticalScrollBar()->maximum());
238 | Srx += static_cast(data.length());
239 | ui->RcvCnt->setText(QString::number(Srx));
240 |
241 | m_mutex.lock();
242 | this->m_dataBuf.append(data);
243 | m_mutex.unlock();
244 |
245 | m_mutex.lock();
246 | this->processData();
247 | m_mutex.unlock();
248 | }
249 |
250 | void MainWindow::processData()
251 | {
252 | while (m_dataBuf.length() > 4)//至少要包含头(2字节)+长度(1字节)+校验(1字节)
253 | {
254 | //帧头0x44 0x77
255 | if (m_dataBuf.at(0) == 0x44 && m_dataBuf.at(1) == 0x77)
256 | {
257 | int len = m_dataBuf[2];//数据长度,/4之后为变量个数
258 | if (m_dataBuf.length() < len + 4) break;
259 |
260 | //数据异或校验
261 | char checksum = 0;
262 | for (int i = 0; i < len + 3; i++)//len+3表示校验之前的位置
263 | {
264 | checksum ^= m_dataBuf[i];
265 | }
266 | if (checksum != m_dataBuf[len + 3]) //如果数据校验失败,丢弃这一包数据
267 | {
268 | this->m_dataBuf.remove(0, len + 4);//从缓存中删除错误数据
269 | continue;//继续下一次循环
270 | }
271 |
272 | //刷新各变量数据
273 |
274 | int j = m_dataBuf.at(2) / 4;
275 | for (int i = 0; i < j; i++)
276 | {
277 | union {
278 | float dataFloat;
279 | char databyte[4];
280 | } data;
281 |
282 | data.databyte[0] = m_dataBuf.at(i * 4 + 3);
283 | data.databyte[1] = m_dataBuf.at(i * 4 + 4);
284 | data.databyte[2] = m_dataBuf.at(i * 4 + 5);
285 | data.databyte[3] = m_dataBuf.at(i * 4 + 6);
286 | this->m_values[i]=data.dataFloat;
287 | ui->chart->addPoint(i,data.dataFloat);
288 |
289 | }
290 |
291 | if (ui->dataRefreshBox->isChecked() && ui->stackedWidget->currentIndex()==0 )
292 | {
293 | //实时显示变量数值
294 | ui->chart->update();
295 | this->m_noFreshData=false;
296 | ui->chart->selfRefresh=false;//有新数据则由主窗口负责刷新,关闭chart自刷新
297 |
298 |
299 |
300 | }
301 |
302 | this->m_dataBuf.remove(0, len + 4);//正确分析一条数据,从缓存中移除数据。
303 | }
304 | else
305 | {//缓冲中第一个字节不属于帧,丢弃
306 | this->m_dataBuf.remove(0,1);
307 | this->m_noFreshData=true;
308 | ui->chart->selfRefresh=true;
309 | }
310 | }
311 | }
312 |
313 | void MainWindow::addLabelConnections()
314 | {
315 | connect(ui->param1,&Varlabel::clicked,this,&MainWindow::handleLabel1);
316 | connect(ui->param2,&Varlabel::clicked,this,&MainWindow::handleLabel2);
317 | connect(ui->param3,&Varlabel::clicked,this,&MainWindow::handleLabel3);
318 | connect(ui->param4,&Varlabel::clicked,this,&MainWindow::handleLabel4);
319 | connect(ui->param5,&Varlabel::clicked,this,&MainWindow::handleLabel5);
320 | connect(ui->param6,&Varlabel::clicked,this,&MainWindow::handleLabel6);
321 | connect(ui->param7,&Varlabel::clicked,this,&MainWindow::handleLabel7);
322 | connect(ui->param8,&Varlabel::clicked,this,&MainWindow::handleLabel8);
323 | connect(ui->param9,&Varlabel::clicked,this,&MainWindow::handleLabel9);
324 | connect(ui->param10,&Varlabel::clicked,this,&MainWindow::handleLabel10);
325 | connect(ui->param11,&Varlabel::clicked,this,&MainWindow::handleLabel11);
326 | connect(ui->param12,&Varlabel::clicked,this,&MainWindow::handleLabel12);
327 | connect(ui->param13,&Varlabel::clicked,this,&MainWindow::handleLabel13);
328 | connect(ui->param14,&Varlabel::clicked,this,&MainWindow::handleLabel14);
329 | connect(ui->param15,&Varlabel::clicked,this,&MainWindow::handleLabel15);
330 | connect(ui->param16,&Varlabel::clicked,this,&MainWindow::handleLabel16);
331 | connect(ui->param17,&Varlabel::clicked,this,&MainWindow::handleLabel17);
332 | connect(ui->param18,&Varlabel::clicked,this,&MainWindow::handleLabel18);
333 | connect(ui->param19,&Varlabel::clicked,this,&MainWindow::handleLabel19);
334 | connect(ui->param20,&Varlabel::clicked,this,&MainWindow::handleLabel20);
335 |
336 | }
337 |
338 | void MainWindow::handleLabel1(bool tick)
339 | {
340 | ui->chart->showSeris[0]=!ui->chart->showSeris[0];
341 |
342 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[0]);
343 | ui->val1->setPalette(m_palette);
344 | }
345 | void MainWindow::handleLabel2(bool tick)
346 | {
347 | ui->chart->showSeris[1]=!ui->chart->showSeris[1];
348 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[1]);
349 | ui->val2->setPalette(m_palette);
350 | }
351 | void MainWindow::handleLabel3(bool tick)
352 | {
353 | ui->chart->showSeris[2]=!ui->chart->showSeris[2];
354 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[2]);
355 | ui->val3->setPalette(m_palette);
356 | }
357 | void MainWindow::handleLabel4(bool tick)
358 | {
359 | ui->chart->showSeris[3]=!ui->chart->showSeris[3];
360 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[3]);
361 | ui->val4->setPalette(m_palette);
362 | }
363 | void MainWindow::handleLabel5(bool tick)
364 | {
365 | ui->chart->showSeris[4]=!ui->chart->showSeris[4];
366 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[4]);
367 | ui->val5->setPalette(m_palette);
368 | }
369 | void MainWindow::handleLabel6(bool tick)
370 | {
371 | ui->chart->showSeris[5]=!ui->chart->showSeris[5];
372 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[5]);
373 | ui->val6->setPalette(m_palette);
374 | }
375 | void MainWindow::handleLabel7(bool tick)
376 | {
377 | ui->chart->showSeris[6]=!ui->chart->showSeris[6];
378 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[6]);
379 | ui->val7->setPalette(m_palette);
380 | }
381 | void MainWindow::handleLabel8(bool tick)
382 | {
383 | ui->chart->showSeris[7]=!ui->chart->showSeris[7];
384 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[7]);
385 | ui->val8->setPalette(m_palette);
386 | }
387 | void MainWindow::handleLabel9(bool tick)
388 | {
389 | ui->chart->showSeris[8]=!ui->chart->showSeris[8];
390 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[8]);
391 | ui->val9->setPalette(m_palette);
392 | }
393 | void MainWindow::handleLabel10(bool tick)
394 | {
395 | ui->chart->showSeris[9]=!ui->chart->showSeris[9];
396 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[9]);
397 | ui->val10->setPalette(m_palette);
398 | }
399 |
400 | void MainWindow::handleLabel11(bool tick)
401 | {
402 | ui->chart->showSeris[10]=!ui->chart->showSeris[10];
403 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[10]);
404 | ui->val11->setPalette(m_palette);
405 | }
406 | void MainWindow::handleLabel12(bool tick)
407 | {
408 | ui->chart->showSeris[11]=!ui->chart->showSeris[11];
409 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[11]);
410 | ui->val12->setPalette(m_palette);
411 | }
412 | void MainWindow::handleLabel13(bool tick)
413 | {
414 | ui->chart->showSeris[12]=!ui->chart->showSeris[12];
415 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[12]);
416 | ui->val13->setPalette(m_palette);
417 | }
418 | void MainWindow::handleLabel14(bool tick)
419 | {
420 | ui->chart->showSeris[13]=!ui->chart->showSeris[13];
421 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[13]);
422 | ui->val14->setPalette(m_palette);
423 | }
424 | void MainWindow::handleLabel15(bool tick)
425 | {
426 | ui->chart->showSeris[14]=!ui->chart->showSeris[14];
427 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[14]);
428 | ui->val15->setPalette(m_palette);
429 | }
430 | void MainWindow::handleLabel16(bool tick)
431 | {
432 | ui->chart->showSeris[15]=!ui->chart->showSeris[15];
433 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[15]);
434 | ui->val16->setPalette(m_palette);
435 | }
436 | void MainWindow::handleLabel17(bool tick)
437 | {
438 | ui->chart->showSeris[16]=!ui->chart->showSeris[16];
439 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[16]);
440 | ui->val17->setPalette(m_palette);
441 | }
442 | void MainWindow::handleLabel18(bool tick)
443 | {
444 | ui->chart->showSeris[17]=!ui->chart->showSeris[17];
445 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[17]);
446 | ui->val18->setPalette(m_palette);
447 | }
448 | void MainWindow::handleLabel19(bool tick)
449 | {
450 | ui->chart->showSeris[18]=!ui->chart->showSeris[18];
451 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[18]);
452 | ui->val19->setPalette(m_palette);
453 | }
454 | void MainWindow::handleLabel20(bool tick)
455 | {
456 | ui->chart->showSeris[19]=!ui->chart->showSeris[19];
457 | m_palette.setColor(QPalette::Base, tick?Qt::white:ui->chart->seriesColor[19]);
458 | ui->val20->setPalette(m_palette);
459 | }
460 |
461 |
462 | void MainWindow::handleSettingBtn()
463 | {
464 | //先传递m_settings显示所需的必要参数 再显示
465 | m_settings->setInitValue(ui->chart->seriesColor,ui->chart->listYmax,ui->chart->listYmin,m_varNames);
466 | m_settings->setEnabled(true);
467 | m_settings->show();
468 | }
469 |
470 | void MainWindow::handleError(QSerialPort::SerialPortError error)
471 | {
472 | if (error == QSerialPort::ResourceError) {
473 | QMessageBox::critical(this, tr("Critical Error"), m_serial->errorString());
474 | closeSerialPort();
475 | }
476 | }
477 |
478 | void MainWindow::handleSettingChanged(QColor *colors, int *mins, int *maxs, QString *names)
479 | {
480 | for(int i=0;i<20;i++)
481 | {
482 | ui->chart->seriesColor[i]=colors[i];
483 | ui->chart->listYmin[i]=mins[i];
484 | ui->chart->listYmax[i]=maxs[i];
485 | m_varNames[i]=names[i];
486 | if(ui->chart->showSeris[i])
487 | {
488 | m_palette.setColor(QPalette::Base,ui->chart->seriesColor[i]);
489 | m_varLineEdits[i]->setPalette(m_palette);
490 | }
491 | m_varLabels[i]->setText(m_varNames[i]);
492 | }
493 | m_settings->setEnabled(false);
494 | m_settings->close();
495 | }
496 |
497 | void MainWindow::on_pushButton_5_clicked()
498 | {
499 | ui->stackedWidget->setCurrentIndex(0);
500 | }
501 |
502 | void MainWindow::on_pushButton_6_clicked()
503 | {
504 | ui->stackedWidget->setCurrentIndex(1);
505 | }
506 |
507 | void MainWindow::showStatusMessage(const QString &message)
508 | {
509 | ui->statusLineEdit->setText(message);
510 | }
511 |
512 | void MainWindow::closeEvent(QCloseEvent *e)
513 | {
514 |
515 | if(this->m_settings->isEnabled())this->m_settings->close();
516 | for(int i=0;i<20;i++)
517 | {
518 | m_iniFile->beginGroup("Color");
519 | m_iniFile->setValue(tr("VAL%1").arg(i+1),QString::number(ui->chart->seriesColor[i].red())+","+QString::number(ui->chart->seriesColor[i].green())
520 | +","+QString::number(ui->chart->seriesColor[i].blue()));
521 | m_iniFile->endGroup();
522 | m_iniFile->beginGroup("Min");
523 | m_iniFile->setValue(tr("VAL%1").arg(i+1),ui->chart->listYmin[i]);
524 | m_iniFile->endGroup();
525 | m_iniFile->beginGroup("Max");
526 | m_iniFile->setValue(tr("VAL%1").arg(i+1),ui->chart->listYmax[i]);
527 | m_iniFile->endGroup();
528 | m_iniFile->beginGroup("Name");
529 | m_iniFile->setValue(tr("VAL%1").arg(i+1),m_varNames[i]);
530 | m_iniFile->endGroup();
531 |
532 |
533 | }
534 | QMainWindow::closeEvent(e);
535 | }
536 |
537 | void MainWindow::on_openBtn_clicked()
538 | {
539 | if(ui->openBtn->text()=="打开")
540 | {
541 | this->openSerialPort();
542 | }
543 | else
544 | {
545 | this->closeSerialPort();
546 | }
547 | }
548 |
549 | void MainWindow::on_detectBtn_clicked()
550 | {
551 | QString info;
552 | const auto infos = QSerialPortInfo::availablePorts();
553 | QStringList allPorts;
554 | for (const QSerialPortInfo &info : infos) {
555 | allPorts << info.portName();
556 |
557 | }
558 |
559 | for (int i = 0; i < ui->portnameCombo->count(); i++)
560 | {
561 | QString ex = ui->portnameCombo->itemText(i);
562 | if (allPorts.contains(ex) == false)
563 | {
564 | info += ui->portnameCombo->itemText(i) + "移除";
565 | ui->portnameCombo->removeItem(i);
566 | i--;
567 | }
568 | }
569 | foreach (QString s , allPorts)
570 | {
571 | int i=ui->portnameCombo->count();
572 | for(;i!=0;i--)
573 | if(ui->portnameCombo->itemText(i-1) == s) break;
574 | if (i==0)
575 | {
576 | ui->portnameCombo->addItem(s);
577 | info += "新添" + s;
578 | }
579 | }
580 |
581 | if (ui->portnameCombo->currentIndex() == -1 && ui->portnameCombo->count() != 0)
582 | {
583 | ui->portnameCombo->setCurrentIndex(0);
584 | }
585 | if(ui->portnameCombo->count() == 0)
586 | {
587 | info += ("没有可用串口");
588 | }
589 | this->showStatusMessage(info);
590 | }
591 |
592 | void MainWindow::on_RcvBtn_clicked()
593 | {
594 | if(ui->RcvBtn->text()=="暂停")
595 | ui->RcvBtn->setText("显示");
596 | else
597 | ui->RcvBtn->setText("暂停");
598 | }
599 |
600 | void MainWindow::on_SndClrBtn_clicked()
601 | {
602 | ui->SndTextEdit->clear();
603 | }
604 |
605 | void MainWindow::on_RcvClrBtn_clicked()
606 | {
607 | ui->RcvTextEdit->clear();
608 | }
609 |
610 |
611 |
612 | void MainWindow::on_SndHex_clicked()
613 | {
614 | ui->SndTextEdit->hexCheck=true;
615 | ui->SndTextEdit->clear();
616 | //不支持非拉丁语输入
617 | ui->SndTextEdit->setAttribute(Qt::WA_InputMethodEnabled, false);
618 | }
619 |
620 | void MainWindow::on_SndASCII_clicked()
621 | {
622 | ui->SndTextEdit->hexCheck=false;
623 | ui->SndTextEdit->clear();
624 | //支持拉丁语输入
625 | ui->SndTextEdit->setAttribute(Qt::WA_InputMethodEnabled, true);
626 | }
627 |
628 |
629 |
630 | void MainWindow::on_dataRefreshBox_clicked(bool checked)
631 | {
632 | //只有当串口无(新的)绘图数据或关闭主窗口刷新的时候才会启用 图表自刷新
633 | ui->chart->selfRefresh= !checked || this->m_noFreshData|| !m_serial->isOpen();
634 | ui->chart->update();
635 | }
636 |
637 | void MainWindow::on_gridBox_clicked(bool checked)
638 | {
639 | ui->chart->showGrid=checked;
640 | ui->chart->update();
641 | }
642 |
643 | void MainWindow::on_cursorBox_clicked(bool checked)
644 | {
645 | ui->chart->showCursor=checked;
646 | ui->chart->update();
647 | }
648 |
649 | void MainWindow::on_dataClearBtn_clicked()
650 | {
651 | ui->chart->init();
652 | }
653 |
654 | void MainWindow::on_axisRestoreBtn_clicked()
655 | {
656 | ui->chart->restoreAxis();
657 | }
658 |
659 | void MainWindow::on_dataSaveBtn_clicked()
660 | {
661 |
662 | if(ui->chart->saveData(m_varNames))
663 | {
664 | this->showStatusMessage("保存成功");
665 | }
666 | else
667 | this->showStatusMessage("保存失败");
668 |
669 | }
670 |
671 | void MainWindow::on_dataLoadBtn_clicked()
672 | {
673 | m_serial->close();
674 | ui->chart->loadData();
675 | }
676 |
677 | void MainWindow::on_prtScBtn_clicked()
678 | {
679 |
680 | QString folder = QCoreApplication::applicationDirPath() + "/SavedImage";
681 | QString fileName = "/JLU" + QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss-zzz") + ".png";
682 | QDir dir(folder);
683 |
684 | if (!dir.exists())
685 | {
686 | dir.mkdir(folder);
687 | }
688 | QPixmap p = this->grab(QRect(0,0,width(),height()));
689 |
690 | if(p.save(folder + fileName,"png"))
691 | {
692 | this->showStatusMessage("保存成功");
693 | }
694 | else
695 | {
696 | this->showStatusMessage("保存失败");
697 | }
698 |
699 | }
700 |
701 |
702 | void MainWindow::on_pushButton_7_clicked()
703 | {
704 | ui->stackedWidget->setCurrentIndex(2);
705 | QFile file(":/info/ReadMe.txt");
706 | file.open(QIODevice::ReadOnly);
707 | ui->readMe->setPlainText(file.readAll());
708 | ui->readMe->setReadOnly(true);
709 | }
710 |
--------------------------------------------------------------------------------
/src/mainwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOW_H
2 | #define MAINWINDOW_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include "console.h"
11 | #include "varlabel.h"
12 | #include "settingsdialog.h"
13 |
14 |
15 | namespace Ui
16 | {
17 | class MainWindow;
18 | }
19 |
20 | class MainWindow : public QMainWindow
21 | {
22 | Q_OBJECT
23 |
24 | public:
25 | explicit MainWindow(QWidget *parent = nullptr);
26 | ~MainWindow()override;
27 | void showStatusMessage(const QString &);
28 |
29 | protected:
30 | void closeEvent(QCloseEvent *e)override;
31 | private slots:
32 | void on_pushButton_5_clicked();
33 | void on_pushButton_6_clicked();
34 |
35 | void openSerialPort();
36 | void closeSerialPort();
37 | // void about();
38 | void writeData();
39 | void readData();
40 |
41 | void handleError(QSerialPort::SerialPortError error);
42 | void handleSettingBtn();
43 | void handleSettingChanged(QColor *colors,int *mins,int *maxs,QString *names);
44 |
45 | void on_openBtn_clicked();
46 |
47 | void on_detectBtn_clicked();
48 |
49 | void on_RcvBtn_clicked();
50 |
51 | void on_SndClrBtn_clicked();
52 |
53 | void on_RcvClrBtn_clicked();
54 |
55 |
56 | void on_SndHex_clicked();
57 |
58 | void on_SndASCII_clicked();
59 |
60 |
61 | void on_dataRefreshBox_clicked(bool checked);
62 |
63 | void on_gridBox_clicked(bool checked);
64 |
65 | void on_cursorBox_clicked(bool checked);
66 |
67 | void on_dataClearBtn_clicked();
68 |
69 | void on_axisRestoreBtn_clicked();
70 |
71 | void on_dataSaveBtn_clicked();
72 |
73 | void on_dataLoadBtn_clicked();
74 |
75 | void on_prtScBtn_clicked();
76 |
77 | void on_pushButton_7_clicked();
78 |
79 | private:
80 | Ui::MainWindow *ui;
81 | QSerialPort *m_serial = nullptr;
82 | QTextCodec *tc = QTextCodec::codecForName("System");
83 | quint64 Stx=0;
84 | quint64 Srx=0;
85 |
86 | bool m_noFreshData=true;
87 | float m_values[20]={0};
88 | QMutex m_mutex;
89 | QByteArray m_dataBuf;
90 | QPalette m_palette ;
91 | QSettings *m_iniFile;
92 | Settingsdialog *m_settings;
93 |
94 | QString m_varNames[20];
95 |
96 | QList m_varLineEdits;
97 | QList m_varLabels;
98 |
99 | void processData();
100 | void addLabelConnections();
101 | void handleLabel1(bool tick);
102 | void handleLabel2(bool tick);
103 | void handleLabel3(bool tick);
104 | void handleLabel4(bool tick);
105 | void handleLabel5(bool tick);
106 | void handleLabel6(bool tick);
107 | void handleLabel7(bool tick);
108 | void handleLabel8(bool tick);
109 | void handleLabel9(bool tick);
110 | void handleLabel10(bool tick);
111 | void handleLabel11(bool tick);
112 | void handleLabel12(bool tick);
113 | void handleLabel13(bool tick);
114 | void handleLabel14(bool tick);
115 | void handleLabel15(bool tick);
116 | void handleLabel16(bool tick);
117 | void handleLabel17(bool tick);
118 | void handleLabel18(bool tick);
119 | void handleLabel19(bool tick);
120 | void handleLabel20(bool tick);
121 |
122 | void readIni();
123 |
124 | void handleUpdateUi();
125 |
126 | };
127 |
128 | #endif // MAINWINDOW_H
129 |
--------------------------------------------------------------------------------
/src/mainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 861
10 | 585
11 |
12 |
13 |
14 | Qt 上位机
15 |
16 |
17 |
18 | :/icon/icon.ico:/icon/icon.ico
19 |
20 |
21 | QTabWidget::Triangular
22 |
23 |
24 |
25 |
26 |
27 | 0
28 | 30
29 | 841
30 | 511
31 |
32 |
33 |
34 | 0
35 |
36 |
37 |
38 |
39 |
40 | 10
41 | 10
42 | 831
43 | 491
44 |
45 |
46 |
47 |
48 |
49 | 10
50 | 11
51 | 811
52 | 331
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 255
62 | 255
63 | 255
64 |
65 |
66 |
67 |
68 |
69 |
70 | 0
71 | 0
72 | 0
73 |
74 |
75 |
76 |
77 |
78 |
79 | 0
80 | 0
81 | 0
82 |
83 |
84 |
85 |
86 |
87 |
88 | 0
89 | 0
90 | 0
91 |
92 |
93 |
94 |
95 |
96 |
97 | 0
98 | 0
99 | 0
100 |
101 |
102 |
103 |
104 |
105 |
106 | 0
107 | 0
108 | 0
109 |
110 |
111 |
112 |
113 |
114 |
115 | 255
116 | 255
117 | 255
118 |
119 |
120 |
121 |
122 |
123 |
124 | 255
125 | 255
126 | 255
127 |
128 |
129 |
130 |
131 |
132 |
133 | 255
134 | 255
135 | 255
136 |
137 |
138 |
139 |
140 |
141 |
142 | 0
143 | 0
144 | 0
145 |
146 |
147 |
148 |
149 |
150 |
151 | 0
152 | 0
153 | 0
154 |
155 |
156 |
157 |
158 |
159 |
160 | 0
161 | 0
162 | 0
163 |
164 |
165 |
166 |
167 |
168 |
169 | 0
170 | 0
171 | 0
172 |
173 |
174 |
175 |
176 |
177 |
178 | 255
179 | 255
180 | 220
181 |
182 |
183 |
184 |
185 |
186 |
187 | 0
188 | 0
189 | 0
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 | 255
199 | 255
200 | 255
201 |
202 |
203 |
204 |
205 |
206 |
207 | 0
208 | 0
209 | 0
210 |
211 |
212 |
213 |
214 |
215 |
216 | 0
217 | 0
218 | 0
219 |
220 |
221 |
222 |
223 |
224 |
225 | 0
226 | 0
227 | 0
228 |
229 |
230 |
231 |
232 |
233 |
234 | 0
235 | 0
236 | 0
237 |
238 |
239 |
240 |
241 |
242 |
243 | 0
244 | 0
245 | 0
246 |
247 |
248 |
249 |
250 |
251 |
252 | 255
253 | 255
254 | 255
255 |
256 |
257 |
258 |
259 |
260 |
261 | 255
262 | 255
263 | 255
264 |
265 |
266 |
267 |
268 |
269 |
270 | 255
271 | 255
272 | 255
273 |
274 |
275 |
276 |
277 |
278 |
279 | 0
280 | 0
281 | 0
282 |
283 |
284 |
285 |
286 |
287 |
288 | 0
289 | 0
290 | 0
291 |
292 |
293 |
294 |
295 |
296 |
297 | 0
298 | 0
299 | 0
300 |
301 |
302 |
303 |
304 |
305 |
306 | 0
307 | 0
308 | 0
309 |
310 |
311 |
312 |
313 |
314 |
315 | 255
316 | 255
317 | 220
318 |
319 |
320 |
321 |
322 |
323 |
324 | 0
325 | 0
326 | 0
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 | 0
336 | 0
337 | 0
338 |
339 |
340 |
341 |
342 |
343 |
344 | 0
345 | 0
346 | 0
347 |
348 |
349 |
350 |
351 |
352 |
353 | 0
354 | 0
355 | 0
356 |
357 |
358 |
359 |
360 |
361 |
362 | 0
363 | 0
364 | 0
365 |
366 |
367 |
368 |
369 |
370 |
371 | 0
372 | 0
373 | 0
374 |
375 |
376 |
377 |
378 |
379 |
380 | 0
381 | 0
382 | 0
383 |
384 |
385 |
386 |
387 |
388 |
389 | 0
390 | 0
391 | 0
392 |
393 |
394 |
395 |
396 |
397 |
398 | 255
399 | 255
400 | 255
401 |
402 |
403 |
404 |
405 |
406 |
407 | 0
408 | 0
409 | 0
410 |
411 |
412 |
413 |
414 |
415 |
416 | 0
417 | 0
418 | 0
419 |
420 |
421 |
422 |
423 |
424 |
425 | 0
426 | 0
427 | 0
428 |
429 |
430 |
431 |
432 |
433 |
434 | 0
435 | 0
436 | 0
437 |
438 |
439 |
440 |
441 |
442 |
443 | 0
444 | 0
445 | 0
446 |
447 |
448 |
449 |
450 |
451 |
452 | 255
453 | 255
454 | 220
455 |
456 |
457 |
458 |
459 |
460 |
461 | 0
462 | 0
463 | 0
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 | 20
476 | 360
477 | 511
478 | 131
479 |
480 |
481 |
482 | 变量
483 |
484 |
485 |
486 |
487 | 20
488 | 20
489 | 41
490 | 21
491 |
492 |
493 |
494 | 变量1
495 |
496 |
497 |
498 |
499 |
500 | 70
501 | 20
502 | 41
503 | 21
504 |
505 |
506 |
507 | 变量1
508 |
509 |
510 |
511 |
512 |
513 | 120
514 | 20
515 | 41
516 | 21
517 |
518 |
519 |
520 | 变量1
521 |
522 |
523 |
524 |
525 |
526 | 170
527 | 20
528 | 41
529 | 21
530 |
531 |
532 |
533 | 变量1
534 |
535 |
536 |
537 |
538 |
539 | 220
540 | 20
541 | 41
542 | 21
543 |
544 |
545 |
546 | 变量1
547 |
548 |
549 |
550 |
551 |
552 | 270
553 | 20
554 | 41
555 | 21
556 |
557 |
558 |
559 | 变量1
560 |
561 |
562 |
563 |
564 |
565 | 320
566 | 20
567 | 41
568 | 21
569 |
570 |
571 |
572 | 变量1
573 |
574 |
575 |
576 |
577 |
578 | 370
579 | 20
580 | 41
581 | 21
582 |
583 |
584 |
585 | 变量1
586 |
587 |
588 |
589 |
590 |
591 | 420
592 | 20
593 | 41
594 | 21
595 |
596 |
597 |
598 | 变量1
599 |
600 |
601 |
602 |
603 |
604 | 470
605 | 20
606 | 31
607 | 21
608 |
609 |
610 |
611 | 变量1
612 |
613 |
614 |
615 |
616 |
617 | 470
618 | 70
619 | 31
620 | 21
621 |
622 |
623 |
624 | 变量1
625 |
626 |
627 |
628 |
629 |
630 | 370
631 | 70
632 | 41
633 | 21
634 |
635 |
636 |
637 | 变量1
638 |
639 |
640 |
641 |
642 |
643 | 270
644 | 70
645 | 41
646 | 21
647 |
648 |
649 |
650 | 变量1
651 |
652 |
653 |
654 |
655 |
656 | 120
657 | 70
658 | 41
659 | 21
660 |
661 |
662 |
663 | 变量1
664 |
665 |
666 |
667 |
668 |
669 | 170
670 | 70
671 | 41
672 | 21
673 |
674 |
675 |
676 | 变量1
677 |
678 |
679 |
680 |
681 |
682 | 220
683 | 70
684 | 41
685 | 21
686 |
687 |
688 |
689 | 变量1
690 |
691 |
692 |
693 |
694 |
695 | 70
696 | 70
697 | 41
698 | 21
699 |
700 |
701 |
702 | 变量1
703 |
704 |
705 |
706 |
707 |
708 | 320
709 | 70
710 | 41
711 | 21
712 |
713 |
714 |
715 | 变量1
716 |
717 |
718 |
719 |
720 |
721 | 20
722 | 70
723 | 41
724 | 21
725 |
726 |
727 |
728 | 变量1
729 |
730 |
731 |
732 |
733 |
734 | 420
735 | 70
736 | 41
737 | 21
738 |
739 |
740 |
741 | 变量1
742 |
743 |
744 |
745 |
746 |
747 | 12
748 | 45
749 | 40
750 | 20
751 |
752 |
753 |
754 | false
755 |
756 |
757 |
758 |
759 |
760 | 62
761 | 45
762 | 40
763 | 20
764 |
765 |
766 |
767 |
768 |
769 |
770 | 112
771 | 45
772 | 40
773 | 20
774 |
775 |
776 |
777 |
778 |
779 |
780 | 162
781 | 45
782 | 40
783 | 20
784 |
785 |
786 |
787 |
788 |
789 |
790 | 212
791 | 45
792 | 40
793 | 20
794 |
795 |
796 |
797 |
798 |
799 |
800 | 262
801 | 45
802 | 40
803 | 20
804 |
805 |
806 |
807 |
808 |
809 |
810 | 312
811 | 45
812 | 40
813 | 20
814 |
815 |
816 |
817 |
818 |
819 |
820 | 362
821 | 45
822 | 40
823 | 20
824 |
825 |
826 |
827 |
828 |
829 |
830 | 412
831 | 45
832 | 40
833 | 20
834 |
835 |
836 |
837 |
838 |
839 |
840 | 462
841 | 45
842 | 40
843 | 20
844 |
845 |
846 |
847 |
848 |
849 |
850 | 362
851 | 95
852 | 40
853 | 20
854 |
855 |
856 |
857 |
858 |
859 |
860 | 12
861 | 95
862 | 40
863 | 20
864 |
865 |
866 |
867 |
868 |
869 |
870 | 462
871 | 95
872 | 40
873 | 20
874 |
875 |
876 |
877 |
878 |
879 |
880 | 212
881 | 95
882 | 40
883 | 20
884 |
885 |
886 |
887 |
888 |
889 |
890 | 162
891 | 95
892 | 40
893 | 20
894 |
895 |
896 |
897 |
898 |
899 |
900 | 112
901 | 95
902 | 40
903 | 20
904 |
905 |
906 |
907 |
908 |
909 |
910 | 262
911 | 95
912 | 40
913 | 20
914 |
915 |
916 |
917 |
918 |
919 |
920 | 412
921 | 95
922 | 40
923 | 20
924 |
925 |
926 |
927 |
928 |
929 |
930 | 312
931 | 95
932 | 40
933 | 20
934 |
935 |
936 |
937 |
938 |
939 |
940 | 62
941 | 95
942 | 40
943 | 20
944 |
945 |
946 |
947 |
948 |
949 |
950 |
951 | 560
952 | 360
953 | 271
954 | 131
955 |
956 |
957 |
958 | 控制
959 |
960 |
961 |
962 |
963 | 30
964 | 30
965 | 51
966 | 16
967 |
968 |
969 |
970 | 光标
971 |
972 |
973 | true
974 |
975 |
976 |
977 |
978 |
979 | 80
980 | 30
981 | 51
982 | 16
983 |
984 |
985 |
986 | 刻度
987 |
988 |
989 | true
990 |
991 |
992 |
993 |
994 |
995 | 130
996 | 30
997 | 51
998 | 16
999 |
1000 |
1001 |
1002 | 刷新
1003 |
1004 |
1005 | true
1006 |
1007 |
1008 |
1009 |
1010 |
1011 | 30
1012 | 60
1013 | 71
1014 | 23
1015 |
1016 |
1017 |
1018 | 截图
1019 |
1020 |
1021 |
1022 |
1023 |
1024 | 110
1025 | 60
1026 | 71
1027 | 23
1028 |
1029 |
1030 |
1031 | 保存数据
1032 |
1033 |
1034 |
1035 |
1036 |
1037 | 30
1038 | 90
1039 | 71
1040 | 23
1041 |
1042 |
1043 |
1044 | 恢复坐标
1045 |
1046 |
1047 |
1048 |
1049 |
1050 | 110
1051 | 90
1052 | 71
1053 | 23
1054 |
1055 |
1056 |
1057 | 导入数据
1058 |
1059 |
1060 |
1061 |
1062 |
1063 | 190
1064 | 25
1065 | 61
1066 | 23
1067 |
1068 |
1069 |
1070 | 清空
1071 |
1072 |
1073 |
1074 |
1075 |
1076 | 190
1077 | 60
1078 | 61
1079 | 51
1080 |
1081 |
1082 |
1083 | 设置
1084 |
1085 |
1086 |
1087 |
1088 |
1089 |
1090 | 110
1091 | 800
1092 | 50
1093 | 16
1094 |
1095 |
1096 |
1097 | Rx:
1098 |
1099 |
1100 |
1101 |
1102 |
1103 | 635
1104 | 802
1105 | 51
1106 | 16
1107 |
1108 |
1109 |
1110 | 波特率:
1111 |
1112 |
1113 |
1114 |
1115 |
1116 | 900
1117 | 800
1118 | 41
1119 | 23
1120 |
1121 |
1122 |
1123 | 打开
1124 |
1125 |
1126 |
1127 |
1128 |
1129 | 755
1130 | 802
1131 | 30
1132 | 16
1133 |
1134 |
1135 |
1136 | 串口:
1137 |
1138 |
1139 |
1140 |
1141 |
1142 | 250
1143 | 800
1144 | 371
1145 | 20
1146 |
1147 |
1148 |
1149 |
1150 |
1151 |
1152 | 180
1153 | 800
1154 | 50
1155 | 16
1156 |
1157 |
1158 |
1159 | Tx:
1160 |
1161 |
1162 |
1163 |
1164 |
1165 | 850
1166 | 800
1167 | 41
1168 | 23
1169 |
1170 |
1171 |
1172 | 刷新
1173 |
1174 |
1175 |
1176 |
1177 |
1178 |
1179 |
1180 | 10
1181 | 30
1182 | 821
1183 | 381
1184 |
1185 |
1186 |
1187 |
1188 |
1189 |
1190 | 10
1191 | 440
1192 | 541
1193 | 61
1194 |
1195 |
1196 |
1197 |
1198 |
1199 |
1200 | 560
1201 | 420
1202 | 131
1203 | 81
1204 |
1205 |
1206 |
1207 | 发送控制
1208 |
1209 |
1210 |
1211 |
1212 | 10
1213 | 20
1214 | 51
1215 | 16
1216 |
1217 |
1218 |
1219 | ASCII
1220 |
1221 |
1222 | true
1223 |
1224 |
1225 |
1226 |
1227 |
1228 | 70
1229 | 20
1230 | 51
1231 | 16
1232 |
1233 |
1234 |
1235 | HEX
1236 |
1237 |
1238 | false
1239 |
1240 |
1241 |
1242 |
1243 |
1244 | 70
1245 | 50
1246 | 51
1247 | 23
1248 |
1249 |
1250 |
1251 | 清空
1252 |
1253 |
1254 |
1255 |
1256 |
1257 | 10
1258 | 50
1259 | 51
1260 | 23
1261 |
1262 |
1263 |
1264 | 发送
1265 |
1266 |
1267 |
1268 |
1269 |
1270 |
1271 | 700
1272 | 420
1273 | 131
1274 | 81
1275 |
1276 |
1277 |
1278 | 接收控制
1279 |
1280 |
1281 |
1282 |
1283 | 10
1284 | 20
1285 | 51
1286 | 16
1287 |
1288 |
1289 |
1290 | ASCII
1291 |
1292 |
1293 | true
1294 |
1295 |
1296 |
1297 |
1298 |
1299 | 70
1300 | 20
1301 | 51
1302 | 16
1303 |
1304 |
1305 |
1306 | HEX
1307 |
1308 |
1309 | false
1310 |
1311 |
1312 |
1313 |
1314 |
1315 | 10
1316 | 50
1317 | 51
1318 | 23
1319 |
1320 |
1321 |
1322 | 暂停
1323 |
1324 |
1325 |
1326 |
1327 |
1328 | 70
1329 | 50
1330 | 51
1331 | 23
1332 |
1333 |
1334 |
1335 | 清空
1336 |
1337 |
1338 |
1339 |
1340 |
1341 |
1342 | 20
1343 | 420
1344 | 54
1345 | 12
1346 |
1347 |
1348 |
1349 | 发送框
1350 |
1351 |
1352 |
1353 |
1354 |
1355 | 20
1356 | 10
1357 | 54
1358 | 12
1359 |
1360 |
1361 |
1362 | 接收框
1363 |
1364 |
1365 |
1366 |
1367 |
1368 |
1369 |
1370 | 10
1371 | 20
1372 | 811
1373 | 471
1374 |
1375 |
1376 |
1377 |
1378 |
1379 |
1380 |
1381 |
1382 | 10
1383 | 10
1384 | 75
1385 | 23
1386 |
1387 |
1388 |
1389 | 波形显示
1390 |
1391 |
1392 |
1393 |
1394 |
1395 | 80
1396 | 10
1397 | 75
1398 | 23
1399 |
1400 |
1401 |
1402 | 基本收发
1403 |
1404 |
1405 |
1406 |
1407 |
1408 | 750
1409 | 540
1410 | 41
1411 | 23
1412 |
1413 |
1414 |
1415 | 刷新
1416 |
1417 |
1418 |
1419 |
1420 |
1421 | 800
1422 | 540
1423 | 41
1424 | 23
1425 |
1426 |
1427 |
1428 | 打开
1429 |
1430 |
1431 |
1432 |
1433 |
1434 | 690
1435 | 540
1436 | 51
1437 | 22
1438 |
1439 |
1440 |
1441 |
1442 |
1443 |
1444 | 655
1445 | 542
1446 | 30
1447 | 16
1448 |
1449 |
1450 |
1451 | 串口:
1452 |
1453 |
1454 |
1455 |
1456 |
1457 | 535
1458 | 542
1459 | 51
1460 | 16
1461 |
1462 |
1463 |
1464 | 波特率:
1465 |
1466 |
1467 |
1468 |
1469 |
1470 | 580
1471 | 540
1472 | 61
1473 | 22
1474 |
1475 |
1476 |
1477 | 9600
1478 |
1479 | -
1480 |
1481 | 9600
1482 |
1483 |
1484 | -
1485 |
1486 | 19200
1487 |
1488 |
1489 | -
1490 |
1491 | 38400
1492 |
1493 |
1494 | -
1495 |
1496 | 115200
1497 |
1498 |
1499 |
1500 |
1501 |
1502 |
1503 | 10
1504 | 540
1505 | 16
1506 | 16
1507 |
1508 |
1509 |
1510 | Rx:
1511 |
1512 |
1513 |
1514 |
1515 |
1516 | 80
1517 | 540
1518 | 16
1519 | 16
1520 |
1521 |
1522 |
1523 | Tx:
1524 |
1525 |
1526 |
1527 |
1528 |
1529 | 160
1530 | 540
1531 | 361
1532 | 20
1533 |
1534 |
1535 |
1536 |
1537 |
1538 |
1539 | 30
1540 | 540
1541 | 51
1542 | 16
1543 |
1544 |
1545 |
1546 | 0
1547 |
1548 |
1549 |
1550 |
1551 |
1552 | 100
1553 | 540
1554 | 61
1555 | 16
1556 |
1557 |
1558 |
1559 | 0
1560 |
1561 |
1562 |
1563 |
1564 |
1565 | 180
1566 | 10
1567 | 75
1568 | 23
1569 |
1570 |
1571 |
1572 | 须知
1573 |
1574 |
1575 |
1576 |
1586 |
1587 |
1588 |
1589 |
1590 | Console
1591 | QPlainTextEdit
1592 |
1593 |
1594 |
1595 | Chart
1596 | QGraphicsView
1597 |
1598 |
1599 |
1600 | Varlabel
1601 | QLabel
1602 |
1603 |
1604 |
1605 |
1606 |
1607 |
1608 |
1609 |
1610 |
--------------------------------------------------------------------------------
/src/readme:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/resrc.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | icon.ico
4 |
5 |
6 | ReadMe.txt
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/settingsdialog.cpp:
--------------------------------------------------------------------------------
1 | #include "settingsdialog.h"
2 | #include "ui_settingsdialog.h"
3 | #include
4 | #include
5 | #include
6 | #include "varlabel.h"
7 | #include
8 |
9 |
10 | Settingsdialog::Settingsdialog(QWidget *parent) :
11 | QWidget(parent),
12 | ui(new Ui::Settingsdialog)
13 | {
14 | ui->setupUi(this);
15 | this->setAutoFillBackground(true);
16 |
17 | colorWidges<color1<color1_2<color1_3<color1_4<color1_5<color1_6<color1_7
18 | <color1_8<color1_9<color1_10<color1_11<color1_12<color1_13
19 | <color1_14<color1_15<color1_16<color1_17<color1_18<color1_19<color1_20;
20 |
21 | nameWidges<name1<name1_2<name1_3<name1_4<name1_5<name1_6<name1_7
22 | <name1_8<name1_9<name1_10<name1_11<name1_12<name1_13<name1_14
23 | <name1_15<name1_16<name1_17<name1_18<name1_19<name1_20;
24 |
25 | rangeWidges<range1<range1_2<range1_3<range1_4<range1_5<range1_6<range1_7
26 | <range1_8<range1_9<range1_10<range1_11<range1_12<range1_13<range1_14
27 | <range1_15<range1_16<range1_17<range1_18<range1_19<range1_20;
28 |
29 |
30 | connect(ui->color1,&Varlabel::clicked,this,&Settingsdialog::handleColor1);
31 | connect(ui->color1_2,&Varlabel::clicked,this,&Settingsdialog::handleColor2);
32 | connect(ui->color1_3,&Varlabel::clicked,this,&Settingsdialog::handleColor3);
33 | connect(ui->color1_4,&Varlabel::clicked,this,&Settingsdialog::handleColor4);
34 | connect(ui->color1_5,&Varlabel::clicked,this,&Settingsdialog::handleColor5);
35 | connect(ui->color1_6,&Varlabel::clicked,this,&Settingsdialog::handleColor6);
36 | connect(ui->color1_7,&Varlabel::clicked,this,&Settingsdialog::handleColor7);
37 | connect(ui->color1_8,&Varlabel::clicked,this,&Settingsdialog::handleColor8);
38 | connect(ui->color1_9,&Varlabel::clicked,this,&Settingsdialog::handleColor9);
39 | connect(ui->color1_10,&Varlabel::clicked,this,&Settingsdialog::handleColor10);
40 | connect(ui->color1_11,&Varlabel::clicked,this,&Settingsdialog::handleColor11);
41 | connect(ui->color1_12,&Varlabel::clicked,this,&Settingsdialog::handleColor12);
42 | connect(ui->color1_13,&Varlabel::clicked,this,&Settingsdialog::handleColor13);
43 | connect(ui->color1_14,&Varlabel::clicked,this,&Settingsdialog::handleColor14);
44 | connect(ui->color1_15,&Varlabel::clicked,this,&Settingsdialog::handleColor15);
45 | connect(ui->color1_16,&Varlabel::clicked,this,&Settingsdialog::handleColor16);
46 | connect(ui->color1_17,&Varlabel::clicked,this,&Settingsdialog::handleColor17);
47 | connect(ui->color1_18,&Varlabel::clicked,this,&Settingsdialog::handleColor18);
48 | connect(ui->color1_19,&Varlabel::clicked,this,&Settingsdialog::handleColor19);
49 | connect(ui->color1_20,&Varlabel::clicked,this,&Settingsdialog::handleColor20);
50 |
51 | }
52 |
53 | Settingsdialog::~Settingsdialog()
54 | {
55 | delete ui;
56 | }
57 |
58 | void Settingsdialog::setInitValue(QColor *colors, int *maxs, int *mins ,QString *names)
59 | {
60 | QPalette p;
61 |
62 |
63 | for(int i=0;i<20;i++)
64 | {
65 | colorWidges[i]->setAutoFillBackground(true);
66 | m_colors[i]=colors[i];
67 | m_maxs[i]=maxs[i];
68 | m_mins[i]=mins[i];
69 | m_names[i]=names[i];
70 | p.setColor(QPalette::Window,m_colors[i]);
71 | colorWidges[i]->setPalette(p);
72 | rangeWidges[i]->setText(QString::number(m_mins[i])+","+QString::number(m_maxs[i]));
73 | nameWidges[i]->setText(names[i]);
74 | }
75 | }
76 |
77 |
78 |
79 | void Settingsdialog::handleColor1()
80 | {
81 | ui->color1->setAutoFillBackground(true);
82 | QPalette p=ui->color1->palette();
83 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
84 | if(color.isValid())
85 | {
86 | m_colors[0]=color;
87 | p.setColor(QPalette::Window,color);
88 | p.setColor(QPalette::Base,color);
89 | }
90 | ui->color1->setPalette(p);
91 | }
92 | void Settingsdialog::handleColor2()
93 | {
94 | ui->color1_2->setAutoFillBackground(true);
95 | QPalette p=ui->color1_2->palette();
96 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
97 | if(color.isValid())
98 | {
99 | m_colors[1]=color;
100 | p.setColor(QPalette::Window,color);
101 | p.setColor(QPalette::Base,color);
102 | }
103 | ui->color1_2->setPalette(p);
104 | }
105 | void Settingsdialog::handleColor3()
106 | {
107 |
108 | ui->color1_3->setAutoFillBackground(true);
109 | QPalette p=ui->color1_3->palette();
110 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
111 | if(color.isValid())
112 | {
113 | m_colors[2]=color;
114 | p.setColor(QPalette::Window,color);
115 | p.setColor(QPalette::Base,color);
116 | }
117 | ui->color1_3->setPalette(p);
118 | }
119 | void Settingsdialog::handleColor4()
120 | {
121 | ui->color1_4->setAutoFillBackground(true);
122 | QPalette p=ui->color1_4->palette();
123 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
124 | if(color.isValid())
125 | {
126 | m_colors[3]=color;
127 | p.setColor(QPalette::Window,color);
128 | p.setColor(QPalette::Base,color);
129 | }
130 | ui->color1_4->setPalette(p);
131 | }
132 | void Settingsdialog::handleColor5()
133 | {
134 | ui->color1_5->setAutoFillBackground(true);
135 | QPalette p=ui->color1_5->palette();
136 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
137 | if(color.isValid())
138 | {
139 | m_colors[4]=color;
140 | p.setColor(QPalette::Window,color);
141 | p.setColor(QPalette::Base,color);
142 | }
143 | ui->color1_5->setPalette(p);
144 | }
145 | void Settingsdialog::handleColor6()
146 | {
147 | ui->color1_6->setAutoFillBackground(true);
148 | QPalette p=ui->color1_6->palette();
149 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
150 | if(color.isValid())
151 | {
152 | m_colors[5]=color;
153 | p.setColor(QPalette::Window,color);
154 | p.setColor(QPalette::Base,color);
155 | }
156 | ui->color1_6->setPalette(p);
157 | }
158 | void Settingsdialog::handleColor7()
159 | {
160 | ui->color1_7->setAutoFillBackground(true);
161 | QPalette p=ui->color1_7->palette();
162 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
163 | if(color.isValid())
164 | {
165 | m_colors[6]=color;
166 | p.setColor(QPalette::Window,color);
167 | p.setColor(QPalette::Base,color);
168 | }
169 | ui->color1_7->setPalette(p);
170 | }
171 | void Settingsdialog::handleColor8()
172 | {
173 | ui->color1_8->setAutoFillBackground(true);
174 | QPalette p=ui->color1_8->palette();
175 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
176 | if(color.isValid())
177 | {
178 | m_colors[7]=color;
179 | p.setColor(QPalette::Window,color);
180 | p.setColor(QPalette::Base,color);
181 | }
182 | ui->color1_8->setPalette(p);
183 | }
184 | void Settingsdialog::handleColor9()
185 | {
186 | ui->color1_9->setAutoFillBackground(true);
187 | QPalette p=ui->color1_9->palette();
188 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
189 | if(color.isValid())
190 | {
191 | m_colors[8]=color;
192 | p.setColor(QPalette::Window,color);
193 | p.setColor(QPalette::Base,color);
194 | }
195 | ui->color1_9->setPalette(p);
196 | }
197 | void Settingsdialog::handleColor10()
198 | {
199 | ui->color1_10->setAutoFillBackground(true);
200 | QPalette p=ui->color1_10->palette();
201 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
202 | if(color.isValid())
203 | {
204 | m_colors[9]=color;
205 | p.setColor(QPalette::Window,color);
206 | p.setColor(QPalette::Base,color);
207 | }
208 | ui->color1_10->setPalette(p);
209 | }
210 | void Settingsdialog::handleColor11()
211 | {
212 | ui->color1_11->setAutoFillBackground(true);
213 | QPalette p=ui->color1_11->palette();
214 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
215 | if(color.isValid())
216 | {
217 | m_colors[10]=color;
218 | p.setColor(QPalette::Window,color);
219 | p.setColor(QPalette::Base,color);
220 | }
221 | ui->color1_11->setPalette(p);
222 | }
223 | void Settingsdialog::handleColor12()
224 | {
225 | ui->color1_12->setAutoFillBackground(true);
226 | QPalette p=ui->color1_12->palette();
227 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
228 | if(color.isValid())
229 | {
230 | m_colors[11]=color;
231 | p.setColor(QPalette::Window,color);
232 | p.setColor(QPalette::Base,color);
233 | }
234 | ui->color1_12->setPalette(p);
235 | }
236 | void Settingsdialog::handleColor13()
237 | {
238 | ui->color1_13->setAutoFillBackground(true);
239 | QPalette p=ui->color1_13->palette();
240 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
241 | if(color.isValid())
242 | {
243 | m_colors[12]=color;
244 | p.setColor(QPalette::Window,color);
245 | p.setColor(QPalette::Base,color);
246 | }
247 | ui->color1_13->setPalette(p);
248 | }
249 | void Settingsdialog::handleColor14()
250 | {
251 | ui->color1_14->setAutoFillBackground(true);
252 | QPalette p=ui->color1_14->palette();
253 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
254 | if(color.isValid())
255 | {
256 | m_colors[13]=color;
257 | p.setColor(QPalette::Window,color);
258 | p.setColor(QPalette::Base,color);
259 | }
260 | ui->color1_14->setPalette(p);
261 | }
262 | void Settingsdialog::handleColor15()
263 | {
264 | ui->color1_15->setAutoFillBackground(true);
265 | QPalette p=ui->color1_15->palette();
266 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
267 | if(color.isValid())
268 | {
269 | m_colors[14]=color;
270 | p.setColor(QPalette::Window,color);
271 | p.setColor(QPalette::Base,color);
272 | }
273 | ui->color1_15->setPalette(p);
274 | }
275 | void Settingsdialog::handleColor16()
276 | {
277 | ui->color1_16->setAutoFillBackground(true);
278 | QPalette p=ui->color1_16->palette();
279 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
280 | if(color.isValid())
281 | {
282 | m_colors[15]=color;
283 | p.setColor(QPalette::Window,color);
284 | p.setColor(QPalette::Base,color);
285 | }
286 | ui->color1_16->setPalette(p);
287 | }
288 | void Settingsdialog::handleColor17()
289 | {
290 | ui->color1_17->setAutoFillBackground(true);
291 | QPalette p=ui->color1_17->palette();
292 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
293 | if(color.isValid())
294 | {
295 | m_colors[16]=color;
296 | p.setColor(QPalette::Window,color);
297 | p.setColor(QPalette::Base,color);
298 | }
299 | ui->color1_17->setPalette(p);
300 | }
301 | void Settingsdialog::handleColor18()
302 | {
303 | ui->color1_18->setAutoFillBackground(true);
304 | QPalette p=ui->color1_18->palette();
305 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
306 | if(color.isValid())
307 | {
308 | m_colors[17]=color;
309 | p.setColor(QPalette::Window,color);
310 | p.setColor(QPalette::Base,color);
311 | }
312 | ui->color1_18->setPalette(p);
313 | }
314 | void Settingsdialog::handleColor19()
315 | {
316 | ui->color1_19->setAutoFillBackground(true);
317 | QPalette p=ui->color1_19->palette();
318 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
319 | if(color.isValid())
320 | {
321 | m_colors[18]=color;
322 | p.setColor(QPalette::Window,color);
323 | p.setColor(QPalette::Base,color);
324 | }
325 | ui->color1_19->setPalette(p);
326 | }
327 | void Settingsdialog::handleColor20()
328 | {
329 | ui->color1_20->setAutoFillBackground(true);
330 | QPalette p=ui->color1_20->palette();
331 | QColor color=QColorDialog::getColor(p.color(QPalette::Window),this);
332 | if(color.isValid())
333 | {
334 | m_colors[19]=color;
335 | p.setColor(QPalette::Window,color);
336 | p.setColor(QPalette::Base,color);
337 | }
338 | ui->color1_20->setPalette(p);
339 | }
340 |
341 |
342 | void Settingsdialog::on_pushButton_clicked()
343 | {
344 | QStringList tmp;
345 | for(int i=0;i<20;i++)
346 | {
347 | tmp=rangeWidges[i]->text().split(',');
348 | if(tmp.length()<2)
349 | {
350 | QMessageBox::critical(this, tr("Error"), tr("请检查变量范围输入的格式 "));
351 | return;
352 | }
353 | else
354 | {
355 | m_mins[i]=tmp[0].toInt();
356 | m_maxs[i]=tmp[1].toInt();
357 | }
358 |
359 | m_names[i]=nameWidges[i]->text();
360 | }
361 | emit settingsChanged(m_colors,m_mins,m_maxs,m_names);
362 | }
363 |
--------------------------------------------------------------------------------
/src/settingsdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef SETTINGSDIALOG_H
2 | #define SETTINGSDIALOG_H
3 |
4 | #include
5 | #include
6 | #include "varlabel.h"
7 |
8 | namespace Ui {
9 | class Settingsdialog;
10 | }
11 |
12 | class Settingsdialog : public QWidget
13 | {
14 | Q_OBJECT
15 | signals:
16 | void settingsChanged(QColor colors[20],int mins[20],int maxs[20],QString names[20]) ;
17 | public:
18 | explicit Settingsdialog(QWidget *parent = nullptr);
19 | ~Settingsdialog()override;
20 |
21 | void setInitValue(QColor *colors,int *maxs,int *mins, QString *names);
22 |
23 | private slots:
24 |
25 | void on_pushButton_clicked();
26 |
27 | private:
28 | Ui::Settingsdialog *ui;
29 | QColor m_colors[20];
30 | int m_mins[20];
31 | int m_maxs[20];
32 | QString m_names[20];
33 |
34 |
35 | QList rangeWidges;
36 | QList nameWidges;
37 | QList colorWidges;
38 |
39 | void handleColor1();
40 | void handleColor2();
41 | void handleColor3();
42 | void handleColor4();
43 | void handleColor5();
44 | void handleColor6();
45 | void handleColor7();
46 | void handleColor8();
47 | void handleColor9();
48 | void handleColor10();
49 | void handleColor11();
50 | void handleColor12();
51 | void handleColor13();
52 | void handleColor14();
53 | void handleColor15();
54 | void handleColor16();
55 | void handleColor17();
56 | void handleColor18();
57 | void handleColor19();
58 | void handleColor20();
59 |
60 |
61 | };
62 |
63 | #endif // SETTINGSDIALOG_H
64 |
--------------------------------------------------------------------------------
/src/settingsdialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Settingsdialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 494
10 | 323
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 | 设置
21 |
22 |
23 |
24 | :/icon/icon.ico:/icon/icon.ico
25 |
26 |
27 |
28 |
29 | 20
30 | 40
31 | 31
32 | 16
33 |
34 |
35 |
36 | VAL1
37 |
38 |
39 |
40 |
41 |
42 | 20
43 | 62
44 | 31
45 | 16
46 |
47 |
48 |
49 | VAL2
50 |
51 |
52 |
53 |
54 |
55 | 20
56 | 84
57 | 31
58 | 16
59 |
60 |
61 |
62 | VAL3
63 |
64 |
65 |
66 |
67 |
68 | 20
69 | 106
70 | 31
71 | 16
72 |
73 |
74 |
75 | VAL4
76 |
77 |
78 |
79 |
80 |
81 | 20
82 | 128
83 | 31
84 | 16
85 |
86 |
87 |
88 | VAL5
89 |
90 |
91 |
92 |
93 |
94 | 20
95 | 150
96 | 31
97 | 16
98 |
99 |
100 |
101 | VAL6
102 |
103 |
104 |
105 |
106 |
107 | 20
108 | 172
109 | 31
110 | 16
111 |
112 |
113 |
114 | VAL7
115 |
116 |
117 |
118 |
119 |
120 | 20
121 | 194
122 | 31
123 | 16
124 |
125 |
126 |
127 | VAL8
128 |
129 |
130 |
131 |
132 |
133 | 20
134 | 216
135 | 31
136 | 16
137 |
138 |
139 |
140 | VAL9
141 |
142 |
143 |
144 |
145 |
146 | 20
147 | 238
148 | 31
149 | 16
150 |
151 |
152 |
153 | VAL10
154 |
155 |
156 |
157 |
158 |
159 | 260
160 | 40
161 | 31
162 | 16
163 |
164 |
165 |
166 | VAL11
167 |
168 |
169 |
170 |
171 |
172 | 260
173 | 62
174 | 31
175 | 16
176 |
177 |
178 |
179 | VAL12
180 |
181 |
182 |
183 |
184 |
185 | 260
186 | 84
187 | 31
188 | 16
189 |
190 |
191 |
192 | VAL13
193 |
194 |
195 |
196 |
197 |
198 | 260
199 | 106
200 | 31
201 | 16
202 |
203 |
204 |
205 | VAL14
206 |
207 |
208 |
209 |
210 |
211 | 260
212 | 128
213 | 31
214 | 16
215 |
216 |
217 |
218 | VAL15
219 |
220 |
221 |
222 |
223 |
224 | 260
225 | 150
226 | 31
227 | 16
228 |
229 |
230 |
231 | VAL16
232 |
233 |
234 |
235 |
236 |
237 | 260
238 | 172
239 | 31
240 | 16
241 |
242 |
243 |
244 | VAL17
245 |
246 |
247 |
248 |
249 |
250 | 260
251 | 194
252 | 31
253 | 16
254 |
255 |
256 |
257 | VAL18
258 |
259 |
260 |
261 |
262 |
263 | 260
264 | 216
265 | 31
266 | 16
267 |
268 |
269 |
270 | VAL19
271 |
272 |
273 |
274 |
275 |
276 | 260
277 | 238
278 | 31
279 | 16
280 |
281 |
282 |
283 | VAL20
284 |
285 |
286 |
287 |
288 |
289 | 20
290 | 20
291 | 31
292 | 16
293 |
294 |
295 |
296 | 变量
297 |
298 |
299 |
300 |
301 |
302 | 60
303 | 20
304 | 41
305 | 16
306 |
307 |
308 |
309 | 变量名
310 |
311 |
312 |
313 |
314 |
315 | 130
316 | 20
317 | 31
318 | 16
319 |
320 |
321 |
322 | 颜色
323 |
324 |
325 |
326 |
327 |
328 | 190
329 | 20
330 | 31
331 | 16
332 |
333 |
334 |
335 | 范围
336 |
337 |
338 |
339 |
340 |
341 | 310
342 | 20
343 | 41
344 | 16
345 |
346 |
347 |
348 | 变量名
349 |
350 |
351 |
352 |
353 |
354 | 260
355 | 20
356 | 31
357 | 16
358 |
359 |
360 |
361 | 变量
362 |
363 |
364 |
365 |
366 |
367 | 370
368 | 20
369 | 31
370 | 16
371 |
372 |
373 |
374 | 颜色
375 |
376 |
377 |
378 |
379 |
380 | 430
381 | 20
382 | 31
383 | 16
384 |
385 |
386 |
387 | 范围
388 |
389 |
390 |
391 |
392 |
393 | 60
394 | 40
395 | 41
396 | 20
397 |
398 |
399 |
400 |
401 |
402 |
403 | 60
404 | 62
405 | 41
406 | 20
407 |
408 |
409 |
410 |
411 |
412 |
413 | 60
414 | 84
415 | 41
416 | 20
417 |
418 |
419 |
420 |
421 |
422 |
423 | 60
424 | 106
425 | 41
426 | 20
427 |
428 |
429 |
430 |
431 |
432 |
433 | 60
434 | 128
435 | 41
436 | 20
437 |
438 |
439 |
440 |
441 |
442 |
443 | 60
444 | 150
445 | 41
446 | 20
447 |
448 |
449 |
450 |
451 |
452 |
453 | 60
454 | 172
455 | 41
456 | 20
457 |
458 |
459 |
460 |
461 |
462 |
463 | 60
464 | 194
465 | 41
466 | 20
467 |
468 |
469 |
470 |
471 |
472 |
473 | 60
474 | 216
475 | 41
476 | 20
477 |
478 |
479 |
480 |
481 |
482 |
483 | 60
484 | 238
485 | 41
486 | 20
487 |
488 |
489 |
490 |
491 |
492 |
493 | 310
494 | 40
495 | 41
496 | 20
497 |
498 |
499 |
500 |
501 |
502 |
503 | 310
504 | 62
505 | 41
506 | 20
507 |
508 |
509 |
510 |
511 |
512 |
513 | 310
514 | 84
515 | 41
516 | 20
517 |
518 |
519 |
520 |
521 |
522 |
523 | 310
524 | 106
525 | 41
526 | 20
527 |
528 |
529 |
530 |
531 |
532 |
533 | 310
534 | 128
535 | 41
536 | 20
537 |
538 |
539 |
540 |
541 |
542 |
543 | 310
544 | 150
545 | 41
546 | 20
547 |
548 |
549 |
550 |
551 |
552 |
553 | 310
554 | 172
555 | 41
556 | 20
557 |
558 |
559 |
560 |
561 |
562 |
563 | 310
564 | 194
565 | 41
566 | 20
567 |
568 |
569 |
570 |
571 |
572 |
573 | 310
574 | 216
575 | 41
576 | 20
577 |
578 |
579 |
580 |
581 |
582 |
583 | 310
584 | 238
585 | 41
586 | 20
587 |
588 |
589 |
590 |
591 |
592 |
593 | 125
594 | 64
595 | 31
596 | 16
597 |
598 |
599 |
600 | QFrame::Panel
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 | 125
610 | 174
611 | 31
612 | 16
613 |
614 |
615 |
616 | QFrame::Panel
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 | 125
626 | 130
627 | 31
628 | 16
629 |
630 |
631 |
632 | QFrame::Panel
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 | 125
642 | 152
643 | 31
644 | 16
645 |
646 |
647 |
648 | QFrame::Panel
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 | 125
658 | 196
659 | 31
660 | 16
661 |
662 |
663 |
664 | QFrame::Panel
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 | 125
674 | 86
675 | 31
676 | 16
677 |
678 |
679 |
680 | QFrame::Panel
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 | 125
690 | 108
691 | 31
692 | 16
693 |
694 |
695 |
696 | QFrame::Panel
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 | 125
706 | 218
707 | 31
708 | 16
709 |
710 |
711 |
712 | QFrame::Panel
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 | 125
722 | 42
723 | 31
724 | 16
725 |
726 |
727 |
728 | Qt::NoFocus
729 |
730 |
731 | false
732 |
733 |
734 | QFrame::Panel
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 | 125
744 | 240
745 | 31
746 | 16
747 |
748 |
749 |
750 | QFrame::Panel
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 | 365
760 | 64
761 | 31
762 | 16
763 |
764 |
765 |
766 | QFrame::Panel
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 | 365
776 | 174
777 | 31
778 | 16
779 |
780 |
781 |
782 | QFrame::Panel
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 | 365
792 | 130
793 | 31
794 | 16
795 |
796 |
797 |
798 | QFrame::Panel
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 | 365
808 | 152
809 | 31
810 | 16
811 |
812 |
813 |
814 | QFrame::Panel
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 | 365
824 | 196
825 | 31
826 | 16
827 |
828 |
829 |
830 | QFrame::Panel
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 | 365
840 | 86
841 | 31
842 | 16
843 |
844 |
845 |
846 | QFrame::Panel
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 | 365
856 | 108
857 | 31
858 | 16
859 |
860 |
861 |
862 | QFrame::Panel
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 | 365
872 | 218
873 | 31
874 | 16
875 |
876 |
877 |
878 | QFrame::Panel
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 | 365
888 | 42
889 | 31
890 | 16
891 |
892 |
893 |
894 | QFrame::Panel
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 | 365
904 | 240
905 | 31
906 | 16
907 |
908 |
909 |
910 | QFrame::Panel
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 | 170
920 | 126
921 | 70
922 | 20
923 |
924 |
925 |
926 |
927 |
928 |
929 | 170
930 | 236
931 | 70
932 | 20
933 |
934 |
935 |
936 |
937 |
938 |
939 | 170
940 | 82
941 | 70
942 | 20
943 |
944 |
945 |
946 |
947 |
948 |
949 | 170
950 | 104
951 | 70
952 | 20
953 |
954 |
955 |
956 |
957 |
958 |
959 | 170
960 | 192
961 | 70
962 | 20
963 |
964 |
965 |
966 |
967 |
968 |
969 | 170
970 | 148
971 | 70
972 | 20
973 |
974 |
975 |
976 |
977 |
978 |
979 | 170
980 | 60
981 | 70
982 | 20
983 |
984 |
985 |
986 |
987 |
988 |
989 | 170
990 | 214
991 | 70
992 | 20
993 |
994 |
995 |
996 |
997 |
998 |
999 | 170
1000 | 38
1001 | 70
1002 | 20
1003 |
1004 |
1005 |
1006 |
1007 |
1008 |
1009 | 170
1010 | 170
1011 | 70
1012 | 20
1013 |
1014 |
1015 |
1016 |
1017 |
1018 |
1019 | 410
1020 | 126
1021 | 70
1022 | 20
1023 |
1024 |
1025 |
1026 |
1027 |
1028 |
1029 | 410
1030 | 192
1031 | 70
1032 | 20
1033 |
1034 |
1035 |
1036 |
1037 |
1038 |
1039 | 410
1040 | 148
1041 | 70
1042 | 20
1043 |
1044 |
1045 |
1046 |
1047 |
1048 |
1049 | 410
1050 | 214
1051 | 70
1052 | 20
1053 |
1054 |
1055 |
1056 |
1057 |
1058 |
1059 | 410
1060 | 236
1061 | 70
1062 | 20
1063 |
1064 |
1065 |
1066 |
1067 |
1068 |
1069 | 410
1070 | 38
1071 | 70
1072 | 20
1073 |
1074 |
1075 |
1076 |
1077 |
1078 |
1079 | 410
1080 | 60
1081 | 70
1082 | 20
1083 |
1084 |
1085 |
1086 |
1087 |
1088 |
1089 | 410
1090 | 82
1091 | 70
1092 | 20
1093 |
1094 |
1095 |
1096 |
1097 |
1098 |
1099 | 410
1100 | 104
1101 | 70
1102 | 20
1103 |
1104 |
1105 |
1106 |
1107 |
1108 |
1109 | 410
1110 | 170
1111 | 70
1112 | 20
1113 |
1114 |
1115 |
1116 |
1117 |
1118 |
1119 | 360
1120 | 280
1121 | 75
1122 | 23
1123 |
1124 |
1125 |
1126 | 应用
1127 |
1128 |
1129 | false
1130 |
1131 |
1132 | false
1133 |
1134 |
1135 | false
1136 |
1137 |
1138 | true
1139 |
1140 |
1141 |
1142 |
1143 |
1144 | Varlabel
1145 | QLabel
1146 |
1147 |
1148 |
1149 | DigitLineEdit
1150 | QLineEdit
1151 |
1152 |
1153 |
1154 |
1155 |
1156 |
1157 |
1158 |
1159 |
--------------------------------------------------------------------------------
/src/varlabel.cpp:
--------------------------------------------------------------------------------
1 | #include "varlabel.h"
2 |
3 | Varlabel::Varlabel(QWidget *parent, Qt::WindowFlags f):
4 | QLabel (parent,f)
5 | {
6 | this->setAutoFillBackground(true);
7 | }
8 |
9 | Varlabel::Varlabel(const QString &text, QWidget *parent, Qt::WindowFlags f):
10 | QLabel (text,parent,f)
11 | {
12 | this->setAutoFillBackground(true);
13 | }
14 |
15 | void Varlabel::mousePressEvent(QMouseEvent *e)
16 | {
17 | Q_UNUSED(e)
18 | this->m_tick=!this->m_tick;
19 | emit clicked(this->m_tick);
20 | }
21 |
--------------------------------------------------------------------------------
/src/varlabel.h:
--------------------------------------------------------------------------------
1 | #ifndef VARLABEL_H
2 | #define VARLABEL_H
3 |
4 | #include
5 | #include
6 |
7 | class Varlabel : public QLabel
8 | {
9 | Q_OBJECT
10 |
11 | signals:
12 | void clicked(bool);
13 | public:
14 | explicit Varlabel(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr);
15 | explicit Varlabel(const QString &text, QWidget *parent=nullptr, Qt::WindowFlags f=nullptr);
16 | protected:
17 | void mousePressEvent(QMouseEvent *e)override;
18 | private:
19 | bool m_tick=0;
20 |
21 |
22 | };
23 |
24 | #endif // VARLABEL_H
25 |
--------------------------------------------------------------------------------
/win_64_deploy/Qt5Core.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/Qt5Core.dll
--------------------------------------------------------------------------------
/win_64_deploy/Qt5Gui.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/Qt5Gui.dll
--------------------------------------------------------------------------------
/win_64_deploy/Qt5SerialPort.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/Qt5SerialPort.dll
--------------------------------------------------------------------------------
/win_64_deploy/Qt5Svg.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/Qt5Svg.dll
--------------------------------------------------------------------------------
/win_64_deploy/Qt5Widgets.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/Qt5Widgets.dll
--------------------------------------------------------------------------------
/win_64_deploy/QtDemo.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/QtDemo.exe
--------------------------------------------------------------------------------
/win_64_deploy/SavedData/JLU2019-04-27_07-37-23-540.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/SavedData/JLU2019-04-27_07-37-23-540.csv
--------------------------------------------------------------------------------
/win_64_deploy/SavedData/readme:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/win_64_deploy/SavedImage/JLU2019-04-27_11-24-15-574.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/SavedImage/JLU2019-04-27_11-24-15-574.png
--------------------------------------------------------------------------------
/win_64_deploy/SavedImage/JLU2019-04-27_11-24-33-755.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/SavedImage/JLU2019-04-27_11-24-33-755.png
--------------------------------------------------------------------------------
/win_64_deploy/SavedImage/readme:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/win_64_deploy/config.ini:
--------------------------------------------------------------------------------
1 | [Color]
2 | VAL1="128,128,0"
3 | VAL2="0,255,0"
4 | VAL3="0,0,255"
5 | VAL4="128,128,128"
6 | VAL5="160,160,164"
7 | VAL6="0,255,255"
8 | VAL7="255,0,255"
9 | VAL8="255,255,0"
10 | VAL9="0,128,0"
11 | VAL10="0,0,128"
12 | VAL11="128,0,0"
13 | VAL12="0,128,128"
14 | VAL13="128,0,128"
15 | VAL14="128,128,0"
16 | VAL15="192,192,192"
17 | VAL16="255,255,255"
18 | VAL17="0,0,0"
19 | VAL18="255,255,255"
20 | VAL19="255,255,255"
21 | VAL20="255,255,255"
22 |
23 | [Min]
24 | VAL1=-300
25 | VAL2=-300
26 | VAL3=-300
27 | VAL4=-300
28 | VAL5=-300
29 | VAL6=-300
30 | VAL7=-300
31 | VAL8=-300
32 | VAL9=-300
33 | VAL10=-300
34 | VAL11=-300
35 | VAL12=-300
36 | VAL13=-300
37 | VAL14=-300
38 | VAL15=-300
39 | VAL16=-300
40 | VAL17=-300
41 | VAL18=-300
42 | VAL19=-300
43 | VAL20=-300
44 |
45 | [Max]
46 | VAL1=300
47 | VAL2=300
48 | VAL3=300
49 | VAL4=300
50 | VAL5=300
51 | VAL6=300
52 | VAL7=300
53 | VAL8=300
54 | VAL9=300
55 | VAL10=300
56 | VAL11=300
57 | VAL12=300
58 | VAL13=300
59 | VAL14=300
60 | VAL15=300
61 | VAL16=300
62 | VAL17=300
63 | VAL18=300
64 | VAL19=300
65 | VAL20=300
66 |
67 | [Name]
68 | VAL1=VAR1
69 | VAL2=VAR2
70 | VAL3=VAR3
71 | VAL4=VAR4
72 | VAL5=VAR5
73 | VAL6=VAR6
74 | VAL7=VAR7
75 | VAL8=VAR8
76 | VAL9=VAR9
77 | VAL10=VAR10
78 | VAL11=VAR11
79 | VAL12=VAR12
80 | VAL13=VAR13
81 | VAL14=VAR14
82 | VAL15=VAR15
83 | VAL16=VAR16
84 | VAL17=VAR17
85 | VAL18=VAR18
86 | VAL19=VAR19
87 | VAL20=VAR20
88 |
--------------------------------------------------------------------------------
/win_64_deploy/iconengines/qsvgicon.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/iconengines/qsvgicon.dll
--------------------------------------------------------------------------------
/win_64_deploy/iconengines/readme:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/win_64_deploy/platforms/qwindows.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/platforms/qwindows.dll
--------------------------------------------------------------------------------
/win_64_deploy/platforms/readme:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/win_64_deploy/readme:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/win_64_deploy/styles/qwindowsvistastyle.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeoWootsi/QtDemo/cbf66f665d5abcf405564f5eac2780e4928087ea/win_64_deploy/styles/qwindowsvistastyle.dll
--------------------------------------------------------------------------------
/win_64_deploy/styles/readme:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------