diff options
222 files changed, 2792 insertions, 415 deletions
diff --git a/.cmake.conf b/.cmake.conf index 4e73b3d6..e62fae5e 100644 --- a/.cmake.conf +++ b/.cmake.conf @@ -1 +1,2 @@ -set(QT_REPO_MODULE_VERSION "6.2.0") +set(QT_REPO_MODULE_VERSION "6.2.8") +set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "") diff --git a/.qmake.conf b/.qmake.conf index 39e35588..3a8fd966 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,4 +2,4 @@ load(qt_build_config) DEFINES += QT_NO_JAVA_STYLE_ITERATORS -MODULE_VERSION = 6.2.0 +MODULE_VERSION = 6.2.8 diff --git a/CMakeLists.txt b/CMakeLists.txt index b824480a..7d1235e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qtcharts.pro. -cmake_minimum_required(VERSION 3.15.0) +cmake_minimum_required(VERSION 3.16) include(.cmake.conf) project(QtCharts diff --git a/LICENSE.FDL b/LICENSE.FDL new file mode 100644 index 00000000..857214dd --- /dev/null +++ b/LICENSE.FDL @@ -0,0 +1,451 @@ + + GNU Free Documentation License + Version 1.3, 3 November 2008 + + + Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. + <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +0. PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document "free" in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of "copyleft", which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + + +1. APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The "Document", below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as "you". You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A "Modified Version" of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A "Secondary Section" is a named appendix or a front-matter section of +the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The "Invariant Sections" are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The "Cover Texts" are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A "Transparent" copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not "Transparent" is called "Opaque". + +Examples of suitable formats for Transparent copies include plain +ASCII without markup, Texinfo input format, LaTeX input format, SGML +or XML using a publicly available DTD, and standard-conforming simple +HTML, PostScript or PDF designed for human modification. Examples of +transparent image formats include PNG, XCF and JPG. Opaque formats +include proprietary formats that can be read and edited only by +proprietary word processors, SGML or XML for which the DTD and/or +processing tools are not generally available, and the +machine-generated HTML, PostScript or PDF produced by some word +processors for output purposes only. + +The "Title Page" means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, "Title Page" means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +The "publisher" means any person or entity that distributes copies of +the Document to the public. + +A section "Entitled XYZ" means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as "Acknowledgements", +"Dedications", "Endorsements", or "History".) To "Preserve the Title" +of such a section when you modify the Document means that it remains a +section "Entitled XYZ" according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + +2. VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no +other conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + + +3. COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to +give them a chance to provide you with an updated version of the +Document. + + +4. MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + +A. Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions + (which should, if there were any, be listed in the History section + of the Document). You may use the same title as a previous version + if the original publisher of that version gives permission. +B. List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has fewer than five), + unless they release you from this requirement. +C. State on the Title page the name of the publisher of the + Modified Version, as the publisher. +D. Preserve all the copyright notices of the Document. +E. Add an appropriate copyright notice for your modifications + adjacent to the other copyright notices. +F. Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +G. Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document's license notice. +H. Include an unaltered copy of this License. +I. Preserve the section Entitled "History", Preserve its Title, and add + to it an item stating at least the title, year, new authors, and + publisher of the Modified Version as given on the Title Page. If + there is no section Entitled "History" in the Document, create one + stating the title, year, authors, and publisher of the Document as + given on its Title Page, then add an item describing the Modified + Version as stated in the previous sentence. +J. Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise + the network locations given in the Document for previous versions + it was based on. These may be placed in the "History" section. + You may omit a network location for a work that was published at + least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +K. For any section Entitled "Acknowledgements" or "Dedications", + Preserve the Title of the section, and preserve in the section all + the substance and tone of each of the contributor acknowledgements + and/or dedications given therein. +L. Preserve all the Invariant Sections of the Document, + unaltered in their text and in their titles. Section numbers + or the equivalent are not considered part of the section titles. +M. Delete any section Entitled "Endorsements". Such a section + may not be included in the Modified Version. +N. Do not retitle any existing section to be Entitled "Endorsements" + or to conflict in title with any Invariant Section. +O. Preserve any Warranty Disclaimers. + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled "Endorsements", provided it contains +nothing but endorsements of your Modified Version by various +parties--for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + + +5. COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled "History" +in the various original documents, forming one section Entitled +"History"; likewise combine any sections Entitled "Acknowledgements", +and any sections Entitled "Dedications". You must delete all sections +Entitled "Endorsements". + + +6. COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other +documents released under this License, and replace the individual +copies of this License in the various documents with a single copy +that is included in the collection, provided that you follow the rules +of this License for verbatim copying of each of the documents in all +other respects. + +You may extract a single document from such a collection, and +distribute it individually under this License, provided you insert a +copy of this License into the extracted document, and follow this +License in all other respects regarding verbatim copying of that +document. + + +7. AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an "aggregate" if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + + +8. TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled "Acknowledgements", +"Dedications", or "History", the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + + +9. TERMINATION + +You may not copy, modify, sublicense, or distribute the Document +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense, or distribute it is void, and +will automatically terminate your rights under this License. + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, receipt of a copy of some or all of the same material does +not give you any rights to use it. + + +10. FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions of the +GNU Free Documentation License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. See +https://www.gnu.org/licenses/. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. If the Document +specifies that a proxy can decide which future versions of this +License can be used, that proxy's public statement of acceptance of a +version permanently authorizes you to choose that version for the +Document. + +11. RELICENSING + +"Massive Multiauthor Collaboration Site" (or "MMC Site") means any +World Wide Web server that publishes copyrightable works and also +provides prominent facilities for anybody to edit those works. A +public wiki that anybody can edit is an example of such a server. A +"Massive Multiauthor Collaboration" (or "MMC") contained in the site +means any set of copyrightable works thus published on the MMC site. + +"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 +license published by Creative Commons Corporation, a not-for-profit +corporation with a principal place of business in San Francisco, +California, as well as future copyleft versions of that license +published by that same organization. + +"Incorporate" means to publish or republish a Document, in whole or in +part, as part of another Document. + +An MMC is "eligible for relicensing" if it is licensed under this +License, and if all works that were first published under this License +somewhere other than this MMC, and subsequently incorporated in whole or +in part into the MMC, (1) had no cover texts or invariant sections, and +(2) were thus incorporated prior to November 1, 2008. + +The operator of an MMC Site may republish an MMC contained in the site +under CC-BY-SA on the same site at any time before August 1, 2009, +provided the MMC is eligible for relicensing. + + +ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + + Copyright (c) YEAR YOUR NAME. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. + A copy of the license is included in the section entitled "GNU + Free Documentation License". + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the "with...Texts." line with this: + + with the Invariant Sections being LIST THEIR TITLES, with the + Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. diff --git a/LICENSE.GPL3-EXCEPT b/LICENSE.GPL3-EXCEPT new file mode 100644 index 00000000..b1cb1bec --- /dev/null +++ b/LICENSE.GPL3-EXCEPT @@ -0,0 +1,704 @@ +This is the GNU General Public License version 3, annotated with The +Qt Company GPL Exception 1.0: + +------------------------------------------------------------------------- + +The Qt Company GPL Exception 1.0 + +Exception 1: + +As a special exception you may create a larger work which contains the +output of this application and distribute that work under terms of your +choice, so long as the work is not otherwise derived from or based on +this application and so long as the work does not in itself generate +output that contains the output from this application in its original +or modified form. + +Exception 2: + +As a special exception, you have permission to combine this application +with Plugins licensed under the terms of your choice, to produce an +executable, and to copy and distribute the resulting executable under +the terms of your choice. However, the executable must be accompanied +by a prominent notice offering all users of the executable the entire +source code to this application, excluding the source code of the +independent modules, but including any changes you have made to this +application, under the terms of this license. + + +------------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/coin/module_config.yaml b/coin/module_config.yaml index 919d02e8..1d492cd3 100644 --- a/coin/module_config.yaml +++ b/coin/module_config.yaml @@ -1,4 +1,5 @@ version: 2 +alias: qtcharts accept_configuration: condition: property property: features @@ -13,7 +14,12 @@ instructions: instructions: - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml" disable_if: - condition: property - property: configureArgs - contains_value: "-DFEATURE_widgets=OFF" + condition: or + conditions: + - condition: property + property: configureArgs + contains_value: "-DFEATURE_widgets=OFF" + - condition: property + property: configureArgs + contains_value: "-no-widgets" diff --git a/conanfile.py b/conanfile.py index 7434ced2..aec6f724 100644 --- a/conanfile.py +++ b/conanfile.py @@ -26,112 +26,57 @@ ## ############################################################################# -from conans import ConanFile, tools, CMake -import os +from conans import ConanFile +import re from pathlib import Path +from typing import Dict, Any +_qtcharts_features = [ + "charts-area-chart", + "charts-bar-chart", + "charts-boxplot-chart", + "charts-candlestick-chart", + "charts-datetime-axis", + "charts-line-chart", + "charts-pie-chart", + "charts-scatter-chart", + "charts-spline-chart", +] -class QtConanError(Exception): - pass + +def _parse_qt_version_by_key(key: str) -> str: + with open(Path(__file__).parent.resolve() / ".cmake.conf") as f: + m = re.search(fr'{key} .*"(.*)"', f.read()) + return m.group(1) if m else "" + + +def _get_qt_minor_version() -> str: + return ".".join(_parse_qt_version_by_key("QT_REPO_MODULE_VERSION").split(".")[:2]) class QtCharts(ConanFile): name = "qtcharts" - version = "6.2.0" license = "GPL-3.0+, Commercial Qt License Agreement" author = "The Qt Company <https://www.qt.io/contact-us>" - url = "https://code.qt.io/cgit/qt/qtcharts.git/" - description = "Qt Charts provides UI Components for displaying visually pleasing charts, driven by static or dynamic data models." - topics = ("qt", "qt6", "charts", "qtquick") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False, "default"], - "qt6": "ANY"} # this is needed to model unique package_id for the Add-on build per used Qt6 version - default_options = {"shared": "default", # default: Use the value of the Qt build - "qt6": None} + url = "https://code.qt.io/cgit/qt/qtcharts.git" + description = ( + "Qt Charts module provides a set of easy to use chart components. " + "It uses the Qt Graphics View Framework, therefore charts can be easily integrated " + "to modern user interfaces. Qt Charts can be used as QWidgets, QGraphicsWidget, or QML types. " + "Users can easily create impressive graphs by selecting one of the charts themes." + ) + topics = "qt", "qt6", "qtcharts", "charts", "graphs" + settings = "os", "compiler", "arch", "build_type" + # for referencing the version number and prerelease tag and dependencies info + exports = ".cmake.conf", "dependencies.yaml" exports_sources = "*", "!conan*.*" - # use commit ID as the RREV (recipe revision) if this is exported from .git repository - revision_mode = "scm" if Path(Path(__file__).parent.resolve() / ".git").exists() else "hash" - - def source(self): - # sources are installed next to recipe, no need to clone etc. sources here - pass - - def _get_cmake_prefix_path(self): - # 'QTDIR' provided as env variable in profile file which is part of the Qt essential binary - # package(s). Installed under .conan/profiles - cmake_prefix_path = os.environ.get("QTDIR") - if not cmake_prefix_path: - raise QtConanError("'QTDIR' not defined! The 'QTDIR' needs to point to Qt installation directory.") - print(f"CMAKE_PREFIX_PATH for '{self.name}/{self.version}' build is: {cmake_prefix_path}") - return cmake_prefix_path - - def _read_env(self, key): - value = os.environ.get(key) - if not value: - raise QtConanError(f"{self.settings.os} build specified but '{key}' was not defined?") - return value - - def _get_qtcmake(self): - qt_install_path = self._get_cmake_prefix_path() - ext = ".bat" if tools.os_info.is_windows else "" - qtcmake = os.path.abspath(os.path.join(qt_install_path, "bin", "qt-cmake" + ext)) - if not os.path.exists(qtcmake): - raise QtConanError(f"Unable to locate {qtcmake} from 'QTDIR': {qt_install_path}") - return qtcmake - - def _get_cmake_tool(self): - cmake = CMake(self, cmake_program=self._get_qtcmake()) - cmake.verbose = True - - # Qt modules need to be 'installed'. - # We need to direct the 'make install' to some directory under Conan cache, - # place it under the current build directory which is also under the Conan cache. - # Note, the actual 'make install' is called in "package()". - install_dir = os.path.join(os.getcwd(), "_install_tmp") - cmake.definitions["CMAKE_INSTALL_PREFIX"] = install_dir - - # Use the value of the Qt build - if self.options.shared.value == "default": - del cmake.definitions["BUILD_SHARED_LIBS"] - - cmake_toolchain_file = os.environ.get("CMAKE_TOOLCHAIN_FILE") - if cmake_toolchain_file: - cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = cmake_toolchain_file - - if self.settings.os == "Android": - cmake.definitions["ANDROID_SDK_ROOT"] = self._read_env('ANDROID_SDK_ROOT') - cmake.definitions["ANDROID_NDK_ROOT"] = self._read_env('ANDROID_NDK_ROOT') - - if self.settings.os == "iOS": - # Instead of Conan's auto-added 'Darwin', explicitly pass 'iOS'. - cmake.definitions["CMAKE_SYSTEM_NAME"] = "iOS" - - # Remove the explicit sysroot, let CMake detect the sysroots, to ensure - # that multi-arch builds work. - del cmake.definitions["CMAKE_OSX_SYSROOT"] - - # Remove the conan provided architecture, instead rely on the architectures set - # by the Qt toolchain file, which with official Qt packages most likely means - # multi-arch iOS. - del cmake.definitions["CMAKE_OSX_ARCHITECTURES"] - - return cmake - - def build(self): - cmake = self._get_cmake_tool() - self.run('%s "%s" %s' % (self._get_qtcmake(), self.source_folder, cmake.command_line)) - self.run('cmake --build . %s' % cmake.build_config) - return - - def package(self): - install_dir = os.path.join(os.getcwd(), "_install_tmp") # see 'CMAKE_INSTALL_PREFIX' above - self.run('cmake --build . --target install') - self.copy("*", src=install_dir, dst=".") - - def package_info(self): - self.cpp_info.libs = ["Qt6Charts"] # used for the actual library filename, Ordered list with the library names + python_requires = f"qt-conan-common/{_get_qt_minor_version()}@qt/everywhere" + python_requires_extend = "qt-conan-common.QtLeafModule" - def deploy(self): - self.copy("*") # copy from current package - self.copy_deps("*") # copy from dependencies + def get_qt_leaf_module_options(self) -> Dict[str, Any]: + """Implements abstractmethod from qt-conan-common.QtLeafModule""" + return {item.replace("-", "_"): ["yes", "no", None] for item in _qtcharts_features} + def get_qt_leaf_module_default_options(self) -> Dict[str, Any]: + """Implements abstractmethod from qt-conan-common.QtLeafModule""" + return {item.replace("-", "_"): None for item in _qtcharts_features} diff --git a/dependencies.yaml b/dependencies.yaml index 0028103b..91d92f71 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,10 +1,10 @@ dependencies: - ../qtbase: - ref: 57015d8551ab5fe92481f9ebbe6eb80a2e831063 + ../tqtc-qtbase: + ref: 4c1c38dede55565afa846685b3e19cf8f1cfed0c required: true - ../qtdeclarative: - ref: d71b605747aa5e3d308e724bbb6df498cf337132 + ../tqtc-qtdeclarative: + ref: 9919f58fce6329a233ca885188d0aba5f484e546 required: false - ../qtmultimedia: - ref: dce2c3423bec010ea1544bb27a26d3b7cdae9db8 + ../tqtc-qtmultimedia: + ref: 34dc084899419ab704703a888dbffe119566eaca required: false diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7613c97b..4eb2527b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from examples.pro. -qt_examples_build_begin() +qt_examples_build_begin(EXTERNAL_BUILD) add_subdirectory(charts) diff --git a/examples/charts/CMakeLists.txt b/examples/charts/CMakeLists.txt index 8cd0211f..55ec96b7 100644 --- a/examples/charts/CMakeLists.txt +++ b/examples/charts/CMakeLists.txt @@ -1,86 +1,88 @@ # Generated from charts.pro. if(QT_FEATURE_charts_area_chart) - add_subdirectory(areachart) + qt_internal_add_example(areachart) endif() if(QT_FEATURE_charts_line_chart) - add_subdirectory(callout) - add_subdirectory(chartinteractions) - add_subdirectory(customchart) - add_subdirectory(linechart) - add_subdirectory(lineandbar) - add_subdirectory(legendmarkers) - add_subdirectory(logvalueaxis) - add_subdirectory(modeldata) - add_subdirectory(zoomlinechart) + qt_internal_add_example(callout) + qt_internal_add_example(chartinteractions) + qt_internal_add_example(customchart) + qt_internal_add_example(linechart) + qt_internal_add_example(lineandbar) + qt_internal_add_example(legendmarkers) + qt_internal_add_example(logvalueaxis) + qt_internal_add_example(modeldata) + qt_internal_add_example(zoomlinechart) endif() if(QT_FEATURE_charts_spline_chart) - add_subdirectory(dynamicspline) - add_subdirectory(multiaxis) - add_subdirectory(splinechart) + qt_internal_add_example(dynamicspline) + qt_internal_add_example(multiaxis) + qt_internal_add_example(splinechart) + qt_internal_add_example(pointsselectionandmarkers) endif() if(QT_FEATURE_charts_area_chart AND QT_FEATURE_charts_spline_chart) - add_subdirectory(chartthemes) - add_subdirectory(polarchart) + qt_internal_add_example(chartthemes) + qt_internal_add_example(polarchart) endif() if(QT_FEATURE_charts_bar_chart) - add_subdirectory(barchart) - add_subdirectory(barmodelmapper) - add_subdirectory(horizontalbarchart) - add_subdirectory(horizontalpercentbarchart) - add_subdirectory(horizontalstackedbarchart) - add_subdirectory(stackedbarchart) - add_subdirectory(stackedbarchartdrilldown) - add_subdirectory(percentbarchart) - add_subdirectory(legend) - add_subdirectory(temperaturerecords) + qt_internal_add_example(barchart) + qt_internal_add_example(barmodelmapper) + qt_internal_add_example(horizontalbarchart) + qt_internal_add_example(horizontalpercentbarchart) + qt_internal_add_example(horizontalstackedbarchart) + qt_internal_add_example(stackedbarchart) + qt_internal_add_example(stackedbarchartdrilldown) + qt_internal_add_example(percentbarchart) + qt_internal_add_example(legend) + qt_internal_add_example(temperaturerecords) + qt_internal_add_example(selectedbar) endif() if(QT_FEATURE_charts_pie_chart) - add_subdirectory(donutchart) - add_subdirectory(donutbreakdown) - add_subdirectory(nesteddonuts) - add_subdirectory(piechart) - add_subdirectory(piechartcustomization) - add_subdirectory(piechartdrilldown) + qt_internal_add_example(donutchart) + qt_internal_add_example(donutbreakdown) + qt_internal_add_example(nesteddonuts) + qt_internal_add_example(piechart) + qt_internal_add_example(piechartcustomization) + qt_internal_add_example(piechartdrilldown) endif() if(QT_FEATURE_charts_pie_chart AND TARGET Qt::Quick) - add_subdirectory(qmlpiechart) + qt_internal_add_example(qmlpiechart) endif() if(QT_FEATURE_charts_boxplot_chart) - add_subdirectory(boxplotchart) + qt_internal_add_example(boxplotchart) endif() if(QT_FEATURE_charts_boxplot_chart AND TARGET Qt::Quick) - add_subdirectory(qmlboxplot) + qt_internal_add_example(qmlboxplot) endif() if(QT_FEATURE_charts_candlestick_chart) - add_subdirectory(candlestickchart) + qt_internal_add_example(candlestickchart) endif() if(QT_FEATURE_charts_candlestick_chart AND TARGET Qt::Quick) - add_subdirectory(qmlcandlestick) + qt_internal_add_example(qmlcandlestick) endif() if(QT_FEATURE_charts_scatter_chart) - add_subdirectory(scatterchart) - add_subdirectory(scatterinteractions) + qt_internal_add_example(scatterchart) + qt_internal_add_example(scatterinteractions) endif() if(TARGET Qt::Quick) - add_subdirectory(qmlchart) - add_subdirectory(qmlcustomizations) - add_subdirectory(qmlcustomlegend) - add_subdirectory(qmlf1legends) - add_subdirectory(qmloscilloscope) - add_subdirectory(qmlweather) + qt_internal_add_example(qmlchart) + qt_internal_add_example(qmlcustomizations) + qt_internal_add_example(qmlcustomlegend) + qt_internal_add_example(qmlf1legends) + qt_internal_add_example(qmloscilloscope) + qt_internal_add_example(qmlweather) endif() if(TARGET Qt::Multimedia) # TODO: this never gets compiled : missing find_pacakge - # add_subdirectory(audio) // QTBUG-94181 + # qt_internal_add_example(audio) // QTBUG-94181 endif() if(QT_FEATURE_opengl) - add_subdirectory(openglseries) + qt_internal_add_example(openglseries) endif() if(QT_FEATURE_charts_datetime_axis) - add_subdirectory(datetimeaxis) + qt_internal_add_example(datetimeaxis) endif() if(QT_FEATURE_charts_datetime_axis AND TARGET Qt::Quick) - add_subdirectory(qmlaxes) - add_subdirectory(qmlpolarchart) + qt_internal_add_example(qmlaxes) + qt_internal_add_example(qmlpolarchart) endif() diff --git a/examples/charts/areachart/CMakeLists.txt b/examples/charts/areachart/CMakeLists.txt index f55320ed..bc80affe 100644 --- a/examples/charts/areachart/CMakeLists.txt +++ b/examples/charts/areachart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from areachart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(areachart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/audio/CMakeLists.txt b/examples/charts/audio/CMakeLists.txt index ab7ee791..3148f9c8 100644 --- a/examples/charts/audio/CMakeLists.txt +++ b/examples/charts/audio/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from audio.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(audio LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -28,6 +28,7 @@ qt_add_executable(audio set_target_properties(audio PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/apple/Info.plist.in" ) target_link_libraries(audio PUBLIC Qt::Charts diff --git a/examples/charts/audio/apple/Info.plist.in b/examples/charts/audio/apple/Info.plist.in new file mode 100644 index 00000000..9e6cc252 --- /dev/null +++ b/examples/charts/audio/apple/Info.plist.in @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + + <key>NSMicrophoneUsageDescription</key> + <string>Qt Charts Example</string> +</dict> +</plist> diff --git a/examples/charts/audio/main.cpp b/examples/charts/audio/main.cpp index 8c4eca66..712a7c14 100644 --- a/examples/charts/audio/main.cpp +++ b/examples/charts/audio/main.cpp @@ -29,7 +29,8 @@ #include "widget.h" -#include <QtMultimedia/QAudioDeviceInfo> +#include <QtMultimedia/QAudioDevice> +#include <QtMultimedia/QMediaDevices> #include <QtWidgets/QApplication> #include <QtWidgets/QMessageBox> @@ -37,7 +38,7 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); - const QAudioDeviceInfo inputDevice = QAudioDeviceInfo::defaultInputDevice(); + const QAudioDevice inputDevice = QMediaDevices::defaultAudioInput(); if (inputDevice.isNull()) { QMessageBox::warning(nullptr, "audio", "There is no audio input device available."); diff --git a/examples/charts/audio/widget.cpp b/examples/charts/audio/widget.cpp index c4945067..1a63150b 100644 --- a/examples/charts/audio/widget.cpp +++ b/examples/charts/audio/widget.cpp @@ -30,8 +30,9 @@ #include "widget.h" #include "xyseriesiodevice.h" -#include <QtMultimedia/QAudioDeviceInfo> +#include <QtMultimedia/QAudioDevice> #include <QtMultimedia/QAudioInput> +#include <QtMultimedia/QAudioSource> #include <QtCharts/QChartView> #include <QtCharts/QLineSeries> @@ -42,7 +43,7 @@ QT_USE_NAMESPACE -Widget::Widget(const QAudioDeviceInfo &deviceInfo, QWidget *parent) : +Widget::Widget(const QAudioDevice &deviceInfo, QWidget *parent) : QWidget(parent), m_chart(new QChart), m_series(new QLineSeries) @@ -62,29 +63,31 @@ Widget::Widget(const QAudioDeviceInfo &deviceInfo, QWidget *parent) : m_chart->addAxis(axisY, Qt::AlignLeft); m_series->attachAxis(axisY); m_chart->legend()->hide(); - m_chart->setTitle("Data from the microphone (" + deviceInfo.deviceName() + ')'); + m_chart->setTitle("Data from the microphone (" + deviceInfo.description() + ')'); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(chartView); + m_audioInput = new QAudioInput(deviceInfo, this); + QAudioFormat formatAudio; formatAudio.setSampleRate(8000); formatAudio.setChannelCount(1); - formatAudio.setSampleSize(8); - formatAudio.setCodec("audio/pcm"); - formatAudio.setByteOrder(QAudioFormat::LittleEndian); - formatAudio.setSampleType(QAudioFormat::UnSignedInt); + formatAudio.setSampleFormat(QAudioFormat::UInt8); - m_audioInput = new QAudioInput(deviceInfo, formatAudio, this); + m_audioSource = new QAudioSource(deviceInfo, formatAudio); + m_audioSource->setBufferSize(200); m_device = new XYSeriesIODevice(m_series, this); m_device->open(QIODevice::WriteOnly); - m_audioInput->start(m_device); + m_audioSource->start(m_device); } Widget::~Widget() { - m_audioInput->stop(); + m_audioSource->stop(); m_device->close(); + delete m_audioInput; + delete m_device; } diff --git a/examples/charts/audio/widget.h b/examples/charts/audio/widget.h index f4c3f049..64a130a2 100644 --- a/examples/charts/audio/widget.h +++ b/examples/charts/audio/widget.h @@ -44,7 +44,8 @@ class XYSeriesIODevice; QT_BEGIN_NAMESPACE class QAudioInput; -class QAudioDeviceInfo; +class QAudioDevice; +class QAudioSource; QT_END_NAMESPACE class Widget : public QWidget @@ -52,7 +53,7 @@ class Widget : public QWidget Q_OBJECT public: - explicit Widget(const QAudioDeviceInfo &deviceInfo, QWidget *parent = nullptr); + explicit Widget(const QAudioDevice &deviceInfo, QWidget *parent = nullptr); ~Widget(); private: @@ -60,6 +61,7 @@ private: QChart *m_chart; QLineSeries *m_series ; QAudioInput *m_audioInput = nullptr; + QAudioSource *m_audioSource = nullptr; }; #endif // WIDGET_H diff --git a/examples/charts/barchart/CMakeLists.txt b/examples/charts/barchart/CMakeLists.txt index 3f713b72..52e0af31 100644 --- a/examples/charts/barchart/CMakeLists.txt +++ b/examples/charts/barchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from barchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(barchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/barmodelmapper/CMakeLists.txt b/examples/charts/barmodelmapper/CMakeLists.txt index d1f66c96..72af0a79 100644 --- a/examples/charts/barmodelmapper/CMakeLists.txt +++ b/examples/charts/barmodelmapper/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from barmodelmapper.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(barmodelmapper LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/boxplotchart/CMakeLists.txt b/examples/charts/boxplotchart/CMakeLists.txt index ff1ee5a4..4007dced 100644 --- a/examples/charts/boxplotchart/CMakeLists.txt +++ b/examples/charts/boxplotchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from boxplotchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(boxplotchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/callout/CMakeLists.txt b/examples/charts/callout/CMakeLists.txt index 82b1d790..ec98349d 100644 --- a/examples/charts/callout/CMakeLists.txt +++ b/examples/charts/callout/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from callout.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(callout LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/candlestickchart/CMakeLists.txt b/examples/charts/candlestickchart/CMakeLists.txt index 94accdd6..7db565af 100644 --- a/examples/charts/candlestickchart/CMakeLists.txt +++ b/examples/charts/candlestickchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from candlestickchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(candlestickchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/chartinteractions/CMakeLists.txt b/examples/charts/chartinteractions/CMakeLists.txt index 1dccc30b..95f911c5 100644 --- a/examples/charts/chartinteractions/CMakeLists.txt +++ b/examples/charts/chartinteractions/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from chartinteractions.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(chartinteractions LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/charts.pro b/examples/charts/charts.pro index 1e60be5a..bac912e5 100644 --- a/examples/charts/charts.pro +++ b/examples/charts/charts.pro @@ -21,7 +21,8 @@ qtConfig(charts-spline-chart) { SUBDIRS += \ dynamicspline \ multiaxis \ - splinechart + splinechart \ + pointsselectionandmarkers qtConfig(charts-area-chart) { SUBDIRS += \ chartthemes \ @@ -39,7 +40,8 @@ qtConfig(charts-bar-chart) { stackedbarchartdrilldown \ percentbarchart \ legend \ - temperaturerecords + temperaturerecords \ + selectedbar } qtConfig(charts-pie-chart) { SUBDIRS += \ diff --git a/examples/charts/chartthemes/CMakeLists.txt b/examples/charts/chartthemes/CMakeLists.txt index 8caf3c79..3d6f9639 100644 --- a/examples/charts/chartthemes/CMakeLists.txt +++ b/examples/charts/chartthemes/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from chartthemes.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(chartthemes LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/customchart/CMakeLists.txt b/examples/charts/customchart/CMakeLists.txt index 164d55f4..70b3f14c 100644 --- a/examples/charts/customchart/CMakeLists.txt +++ b/examples/charts/customchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from customchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(customchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/datetimeaxis/CMakeLists.txt b/examples/charts/datetimeaxis/CMakeLists.txt index 128aa126..d34f4746 100644 --- a/examples/charts/datetimeaxis/CMakeLists.txt +++ b/examples/charts/datetimeaxis/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from datetimeaxis.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(datetimeaxis LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/donutbreakdown/CMakeLists.txt b/examples/charts/donutbreakdown/CMakeLists.txt index 63ba5b5f..eceaa86c 100644 --- a/examples/charts/donutbreakdown/CMakeLists.txt +++ b/examples/charts/donutbreakdown/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from donutbreakdown.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(donutbreakdown LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/donutchart/CMakeLists.txt b/examples/charts/donutchart/CMakeLists.txt index 40316cab..a19232dd 100644 --- a/examples/charts/donutchart/CMakeLists.txt +++ b/examples/charts/donutchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from donutchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(donutchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/dynamicspline/CMakeLists.txt b/examples/charts/dynamicspline/CMakeLists.txt index 8d65964b..734fddc7 100644 --- a/examples/charts/dynamicspline/CMakeLists.txt +++ b/examples/charts/dynamicspline/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from dynamicspline.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(dynamicspline LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/horizontalbarchart/CMakeLists.txt b/examples/charts/horizontalbarchart/CMakeLists.txt index 2ba0d249..541b7134 100644 --- a/examples/charts/horizontalbarchart/CMakeLists.txt +++ b/examples/charts/horizontalbarchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from horizontalbarchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(horizontalbarchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/horizontalpercentbarchart/CMakeLists.txt b/examples/charts/horizontalpercentbarchart/CMakeLists.txt index 005e2ba5..4740e4da 100644 --- a/examples/charts/horizontalpercentbarchart/CMakeLists.txt +++ b/examples/charts/horizontalpercentbarchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from horizontalpercentbarchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(horizontalpercentbarchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/horizontalstackedbarchart/CMakeLists.txt b/examples/charts/horizontalstackedbarchart/CMakeLists.txt index 17be4111..3a83038d 100644 --- a/examples/charts/horizontalstackedbarchart/CMakeLists.txt +++ b/examples/charts/horizontalstackedbarchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from horizontalstackedbarchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(horizontalstackedbarchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/legend/CMakeLists.txt b/examples/charts/legend/CMakeLists.txt index 434909d5..837a0eff 100644 --- a/examples/charts/legend/CMakeLists.txt +++ b/examples/charts/legend/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from legend.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(legend LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/legendmarkers/CMakeLists.txt b/examples/charts/legendmarkers/CMakeLists.txt index 9a06c081..ebd4a8c3 100644 --- a/examples/charts/legendmarkers/CMakeLists.txt +++ b/examples/charts/legendmarkers/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from legendmarkers.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(legendmarkers LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/lineandbar/CMakeLists.txt b/examples/charts/lineandbar/CMakeLists.txt index ca6d9054..7488c42c 100644 --- a/examples/charts/lineandbar/CMakeLists.txt +++ b/examples/charts/lineandbar/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from lineandbar.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(lineandbar LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/linechart/CMakeLists.txt b/examples/charts/linechart/CMakeLists.txt index 74076d20..6b18cbdd 100644 --- a/examples/charts/linechart/CMakeLists.txt +++ b/examples/charts/linechart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from linechart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(linechart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/logvalueaxis/CMakeLists.txt b/examples/charts/logvalueaxis/CMakeLists.txt index f2841b88..600c42fd 100644 --- a/examples/charts/logvalueaxis/CMakeLists.txt +++ b/examples/charts/logvalueaxis/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from logvalueaxis.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(logvalueaxis LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/modeldata/CMakeLists.txt b/examples/charts/modeldata/CMakeLists.txt index 65478668..650f236b 100644 --- a/examples/charts/modeldata/CMakeLists.txt +++ b/examples/charts/modeldata/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from modeldata.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(modeldata LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/multiaxis/CMakeLists.txt b/examples/charts/multiaxis/CMakeLists.txt index d333f519..e5396390 100644 --- a/examples/charts/multiaxis/CMakeLists.txt +++ b/examples/charts/multiaxis/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from multiaxis.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(multiaxis LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/nesteddonuts/CMakeLists.txt b/examples/charts/nesteddonuts/CMakeLists.txt index 4e55b578..47a62951 100644 --- a/examples/charts/nesteddonuts/CMakeLists.txt +++ b/examples/charts/nesteddonuts/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from nesteddonuts.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(nesteddonuts LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/openglseries/CMakeLists.txt b/examples/charts/openglseries/CMakeLists.txt index 26be0522..de21d0d3 100644 --- a/examples/charts/openglseries/CMakeLists.txt +++ b/examples/charts/openglseries/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from openglseries.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(openglseries LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/percentbarchart/CMakeLists.txt b/examples/charts/percentbarchart/CMakeLists.txt index c3243045..2b2e51d2 100644 --- a/examples/charts/percentbarchart/CMakeLists.txt +++ b/examples/charts/percentbarchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from percentbarchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(percentbarchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/piechart/CMakeLists.txt b/examples/charts/piechart/CMakeLists.txt index e37c2a6d..9450dce1 100644 --- a/examples/charts/piechart/CMakeLists.txt +++ b/examples/charts/piechart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from piechart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(piechart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/piechartcustomization/CMakeLists.txt b/examples/charts/piechartcustomization/CMakeLists.txt index 3bf78144..94a02914 100644 --- a/examples/charts/piechartcustomization/CMakeLists.txt +++ b/examples/charts/piechartcustomization/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from piechartcustomization.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(piechartcustomization LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/piechartcustomization/mainwidget.cpp b/examples/charts/piechartcustomization/mainwidget.cpp index 5d2ac832..8c2d9b71 100644 --- a/examples/charts/piechartcustomization/mainwidget.cpp +++ b/examples/charts/piechartcustomization/mainwidget.cpp @@ -81,7 +81,7 @@ MainWidget::MainWidget(QWidget *parent) m_legendCheckBox = new QCheckBox(); - QScrollArea *settingsScrollBar = new QScrollArea(); + settingsScrollBar = new QScrollArea(); QWidget *settingsContentWidget = new QWidget(); QFormLayout *chartSettingsLayout = new QFormLayout(settingsContentWidget); @@ -212,6 +212,7 @@ MainWidget::MainWidget(QWidget *parent) sliceSettingsLayout->addRow("Explode distance", m_sliceExplodedFactor); QGroupBox *sliceSettings = new QGroupBox("Selected slice"); sliceSettings->setLayout(sliceSettingsLayout); + sliceSettings->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); connect(m_sliceName, &QLineEdit::textChanged, this, &MainWidget::updateSliceSettings); connect(m_sliceValue, @@ -244,12 +245,16 @@ MainWidget::MainWidget(QWidget *parent) settingsLayout->addWidget(sliceSettings); settingsContentWidget->setLayout(settingsLayout); + settingsScrollBar->setWidget(settingsContentWidget); - settingsScrollBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + settingsScrollBar->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + settingsScrollBar->setWidgetResizable(true); + settingsScrollBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + m_chartView->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); - QGridLayout *baseLayout = new QGridLayout(); + baseLayout = new QGridLayout(); baseLayout->addWidget(settingsScrollBar, 0, 0); - baseLayout->addWidget(m_chartView, 0, 1); + baseLayout->addWidget(m_chartView, 1, 0); setLayout(baseLayout); updateSerieSettings(); @@ -393,4 +398,32 @@ void MainWidget::removeSlice() m_slice = 0; } +void MainWidget::resizeEvent(QResizeEvent *e) +{ + if (width() == 0 || height() == 0) + return; + + const double aspectRatio = double(width()) / double(height()); + + if ((aspectRatio < 1.0) && (oldAspectRatio > 1.0)) { + baseLayout->removeWidget(m_chartView); + baseLayout->removeWidget(settingsScrollBar); + + baseLayout->addWidget(m_chartView, 0, 0); + baseLayout->addWidget(settingsScrollBar, 1, 0); + + oldAspectRatio = aspectRatio; + } + else if ((aspectRatio > 1.0) && (oldAspectRatio < 1.0)) { + baseLayout->removeWidget(m_chartView); + baseLayout->removeWidget(settingsScrollBar); + + baseLayout->addWidget(m_chartView, 0, 0); + baseLayout->addWidget(settingsScrollBar, 0, 1); + + oldAspectRatio = aspectRatio; + } +} + + #include "moc_mainwidget.cpp" diff --git a/examples/charts/piechartcustomization/mainwidget.h b/examples/charts/piechartcustomization/mainwidget.h index d3c1e724..ba6c3670 100644 --- a/examples/charts/piechartcustomization/mainwidget.h +++ b/examples/charts/piechartcustomization/mainwidget.h @@ -29,6 +29,8 @@ #ifndef MAINWIDGET_H #define MAINWIDGET_H +#include "qgridlayout.h" +#include "qscrollarea.h" #include <QtWidgets/QWidget> #include <QtCharts/QChartGlobal> @@ -70,6 +72,8 @@ public Q_SLOTS: void removeSlice(); private: + void resizeEvent(QResizeEvent *e); + QComboBox *m_themeComboBox; QCheckBox *m_aaCheckBox; QCheckBox *m_animationsCheckBox; @@ -100,6 +104,10 @@ private: QPushButton *m_labelBrush; QComboBox *m_labelPosition; BrushTool *m_labelBrushTool; + QGridLayout *baseLayout; + QScrollArea *settingsScrollBar; + + double oldAspectRatio; }; #endif // MAINWIDGET_H diff --git a/examples/charts/piechartdrilldown/CMakeLists.txt b/examples/charts/piechartdrilldown/CMakeLists.txt index 923803cd..567f5c2a 100644 --- a/examples/charts/piechartdrilldown/CMakeLists.txt +++ b/examples/charts/piechartdrilldown/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from piechartdrilldown.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(piechartdrilldown LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/pointsselectionandmarkers/CMakeLists.txt b/examples/charts/pointsselectionandmarkers/CMakeLists.txt new file mode 100644 index 00000000..c2e68bd3 --- /dev/null +++ b/examples/charts/pointsselectionandmarkers/CMakeLists.txt @@ -0,0 +1,54 @@ +# Generated from pointsselectionandmarkers.pro. + +cmake_minimum_required(VERSION 3.14) +project(pointsselectionandmarkers LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/charts/pointsselectionandmarkers") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Charts) + +qt_add_executable(pointsselectionandmarkers + utilities.h utilities.cpp + main.cpp +) + +set_target_properties(pointsselectionandmarkers PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) + +target_link_libraries(pointsselectionandmarkers PUBLIC + Qt::Charts + Qt::Core + Qt::Gui +) + +set(pointsselectionandmarkers_resource_files + "blue_triangle.png" + "green_triangle.png" +) + +qt6_add_resources(pointsselectionandmarkers "images" + PREFIX + "/" + FILES + ${pointsselectionandmarkers_resource_files} +) + +install(TARGETS pointsselectionandmarkers + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/charts/pointsselectionandmarkers/blue_triangle.png b/examples/charts/pointsselectionandmarkers/blue_triangle.png Binary files differnew file mode 100644 index 00000000..7790453c --- /dev/null +++ b/examples/charts/pointsselectionandmarkers/blue_triangle.png diff --git a/examples/charts/pointsselectionandmarkers/green_triangle.png b/examples/charts/pointsselectionandmarkers/green_triangle.png Binary files differnew file mode 100644 index 00000000..29ae043f --- /dev/null +++ b/examples/charts/pointsselectionandmarkers/green_triangle.png diff --git a/examples/charts/pointsselectionandmarkers/main.cpp b/examples/charts/pointsselectionandmarkers/main.cpp new file mode 100644 index 00000000..376d49f9 --- /dev/null +++ b/examples/charts/pointsselectionandmarkers/main.cpp @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "utilities.h" + +#include <QApplication> +#include <QChart> +#include <QChartView> +#include <QCheckBox> +#include <QComboBox> +#include <QGridLayout> +#include <QHBoxLayout> +#include <QLabel> +#include <QMainWindow> +#include <QSplineSeries> + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QMainWindow mainWindow; + mainWindow.setWindowTitle("Chart"); + + //![1] + constexpr qreal marker_size = 20.; + + QSplineSeries *series = new QSplineSeries(); + series->append({QPointF(0., 0.), + QPointF(0.5, 2.27), + QPointF(1.5, 2.2), + QPointF(3.3, 1.7), + QPointF(4.23, 3.1), + QPointF(5.3, 2.3), + QPointF(6.47, 4.1) + }); + series->setMarkerSize(marker_size); + series->setLightMarker(Utilities::redRectangle(marker_size)); + series->setSelectedLightMarker(Utilities::blueTriangle(marker_size)); + QObject::connect(series, &QXYSeries::clicked, series, [&](const QPointF &point) { + int index = series->points().indexOf(point); + if (index != -1) + series->toggleSelection({index}); + }); + //![1] + + //![2] + QChart *chart = new QChart(); + chart->addSeries(series); + chart->createDefaultAxes(); + chart->legend()->setVisible(false); + + QChartView *chartView = new QChartView(chart); + chartView->setRenderHint(QPainter::Antialiasing); + + QWidget *controlWidget = new QWidget(&mainWindow); + QGridLayout *controlLayout = new QGridLayout(controlWidget); + //![2] + + //![3] + QComboBox *charPointCombobox = new QComboBox(); + QComboBox *charPointSelectedCombobox = new QComboBox(); + QComboBox *lineColorCombobox = new QComboBox(); + QCheckBox *showUnselectedPointsCheckbox = new QCheckBox(); + //![3] + + //![4] + QLabel *charPoint = new QLabel(QCoreApplication::tr("Char point: ")); + charPointCombobox->addItems({QCoreApplication::tr("Red rectangle"), + QCoreApplication::tr("Green triangle"), + QCoreApplication::tr("Orange circle") + }); + QObject::connect(charPointCombobox, &QComboBox::currentIndexChanged, series, [&](const int index) { + if (showUnselectedPointsCheckbox->isChecked()) + series->setLightMarker(Utilities::getPointRepresentation(Utilities::PointType(index), marker_size)); + }); + //![4] + + //![5] + QLabel *charPointSelected = new QLabel(QCoreApplication::tr("Char point selected: ")); + charPointSelectedCombobox->addItems({QCoreApplication::tr("Blue triangle"), + QCoreApplication::tr("Yellow rectangle"), + QCoreApplication::tr("Lavender circle") + }); + QObject::connect(charPointSelectedCombobox, &QComboBox::currentIndexChanged, series, [&](const int index) { + series->setSelectedLightMarker(Utilities::getSelectedPointRepresentation(Utilities::SelectedPointType(index), marker_size)); + }); + + QLabel *lineColorLabel = new QLabel(QCoreApplication::tr("Line color: ")); + lineColorCombobox->addItems({QCoreApplication::tr("Blue"), + QCoreApplication::tr("Black"), + QCoreApplication::tr("Mint") + }); + QObject::connect(lineColorCombobox, &QComboBox::currentIndexChanged, series, [&](const int index) { + series->setColor(Utilities::makeLineColor(Utilities::LineColor(index))); + }); + //![5] + + //![6] + QLabel *showUnselectedPointsLabel = new QLabel(QCoreApplication::tr("Display unselected points: ")); + showUnselectedPointsCheckbox->setChecked(true); + QObject::connect(showUnselectedPointsCheckbox, &QCheckBox::stateChanged, series, [&](const int state) { + if (state) { + series->setLightMarker(Utilities::getPointRepresentation(Utilities::PointType(charPointCombobox->currentIndex()), marker_size)); + } else { + series->setLightMarker(QImage()); + } + }); + //![6] + + //![7] + controlLayout->addWidget(charPoint, 0, 0); + controlLayout->addWidget(charPointCombobox, 0, 1); + + controlLayout->addWidget(charPointSelected, 1, 0); + controlLayout->addWidget(charPointSelectedCombobox, 1, 1); + + controlLayout->addWidget(lineColorLabel, 2, 0); + controlLayout->addWidget(lineColorCombobox, 2, 1); + + controlLayout->addWidget(showUnselectedPointsLabel, 3, 0); + controlLayout->addWidget(showUnselectedPointsCheckbox, 3, 1, 1, 2); + + QWidget *mainWidget = new QWidget(&mainWindow); + QHBoxLayout *mainLayout = new QHBoxLayout(mainWidget); + mainLayout->addWidget(chartView); + mainLayout->addWidget(controlWidget); + + mainWindow.setCentralWidget(mainWidget); + mainWindow.resize(1080, 720); + mainWindow.show(); + return a.exec(); + //![7] +} diff --git a/examples/charts/pointsselectionandmarkers/pointsselectionandmarkers.pro b/examples/charts/pointsselectionandmarkers/pointsselectionandmarkers.pro new file mode 100644 index 00000000..ac8adffb --- /dev/null +++ b/examples/charts/pointsselectionandmarkers/pointsselectionandmarkers.pro @@ -0,0 +1,15 @@ +QT += charts \ + widgets + +SOURCES += \ + main.cpp \ + utilities.cpp + +HEADERS += \ + utilities.h + +RESOURCES += \ + pointsselectionandmarkers.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/pointsselectionandmarkers +INSTALLS += target diff --git a/examples/charts/pointsselectionandmarkers/pointsselectionandmarkers.qrc b/examples/charts/pointsselectionandmarkers/pointsselectionandmarkers.qrc new file mode 100644 index 00000000..920bf0cc --- /dev/null +++ b/examples/charts/pointsselectionandmarkers/pointsselectionandmarkers.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>blue_triangle.png</file> + <file>green_triangle.png</file> + </qresource> +</RCC> diff --git a/examples/charts/pointsselectionandmarkers/utilities.cpp b/examples/charts/pointsselectionandmarkers/utilities.cpp new file mode 100644 index 00000000..7b3ef7f4 --- /dev/null +++ b/examples/charts/pointsselectionandmarkers/utilities.cpp @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "utilities.h" + +#include <QBrush> +#include <QList> +#include <QPainter> +#include <QPainterPath> + +namespace Utilities +{ + QImage redRectangle(qreal imageSize) + { + QImage image(imageSize, imageSize, QImage::Format_RGB32); + QPainter painter; + painter.begin(&image); + painter.fillRect(0, 0, imageSize, imageSize, Qt::red); + painter.end(); + return image; + } + + QImage yellowRectangle(qreal imageSize) + { + QImage image(imageSize, imageSize, QImage::Format_RGB32); + QPainter painter; + painter.begin(&image); + painter.fillRect(0, 0, imageSize, imageSize, Qt::yellow); + painter.end(); + return image; + } + + QImage blueTriangle(qreal imageSize) + { + return QImage(":/blue_triangle.png").scaled(imageSize, imageSize); + } + + QImage greenTriangle(qreal imageSize) + { + return QImage(":/green_triangle.png").scaled(imageSize, imageSize); + } + + QImage orangeCircle(qreal imageSize) + { + QImage image(imageSize, imageSize, QImage::Format_ARGB32); + image.fill(QColor(0, 0, 0, 0)); + QPainter paint; + paint.begin(&image); + paint.setBrush(QColor(255,127,80)); + QPen pen = paint.pen(); + pen.setWidth(0); + paint.setPen(pen); + paint.drawEllipse(0, 0, imageSize * 0.9, imageSize * 0.9); + paint.end(); + return image; + } + + QImage lavenderCircle(qreal imageSize) + { + QImage image(imageSize, imageSize, QImage::Format_ARGB32); + image.fill(QColor(0, 0, 0, 0)); + QPainter paint; + paint.begin(&image); + paint.setBrush(QColor(147,112,219)); + QPen pen = paint.pen(); + pen.setWidth(0); + paint.setPen(pen); + paint.drawEllipse(0, 0, imageSize * 0.9, imageSize * 0.9); + paint.end(); + return image; + } + + QImage getPointRepresentation(PointType pointType, int imageSize) + { + switch (pointType) { + case Utilities::PointType::RedRectangle: + return redRectangle(imageSize); + case Utilities::PointType::GreenTriangle: + return greenTriangle(imageSize); + case Utilities::PointType::OrangeCircle: + return orangeCircle(imageSize); + default: + return redRectangle(imageSize); + } + } + + QImage getSelectedPointRepresentation(SelectedPointType pointType, int imageSize) + { + switch (pointType) { + case Utilities::SelectedPointType::BlueTriangle: + return blueTriangle(imageSize); + case Utilities::SelectedPointType::YellowRectangle: + return yellowRectangle(imageSize); + case Utilities::SelectedPointType::LavenderCircle: + return lavenderCircle(imageSize); + default: + return blueTriangle(imageSize); + } + } + + QColor makeLineColor(LineColor lineColor) + { + switch (lineColor) { + case Utilities::LineColor::Blue: + return QColor(65, 105, 225); + case Utilities::LineColor::Black: + return QColor(0,0,0); + case Utilities::LineColor::Mint: + return QColor(70, 203, 155); + default: + return QColor(0, 0, 0); + } + } +} diff --git a/examples/charts/pointsselectionandmarkers/utilities.h b/examples/charts/pointsselectionandmarkers/utilities.h new file mode 100644 index 00000000..79a6a0c6 --- /dev/null +++ b/examples/charts/pointsselectionandmarkers/utilities.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef UTILITIES_H +#define UTILITIES_H + +#include <QImage> + +namespace Utilities +{ + enum class PointType { + RedRectangle, + GreenTriangle, + OrangeCircle + }; + + enum class SelectedPointType { + BlueTriangle, + YellowRectangle, + LavenderCircle + }; + + enum class LineColor { + Blue, + Black, + Mint + }; + + QImage redRectangle(qreal imageSize); + QImage yellowRectangle(qreal imageSize); + QImage blueTriangle(qreal imageSize); + QImage greenTriangle(qreal imageSize); + QImage orangeCircle(qreal imageSize); + QImage lavenderCircle(qreal imageSize); + QImage getPointRepresentation(PointType pointType, int imageSize); + QImage getSelectedPointRepresentation(SelectedPointType pointType, int imageSize); + QColor makeLineColor(LineColor lineColor); +} + +#endif // UTILITIES_H diff --git a/examples/charts/polarchart/CMakeLists.txt b/examples/charts/polarchart/CMakeLists.txt index 7047de38..7c94a7eb 100644 --- a/examples/charts/polarchart/CMakeLists.txt +++ b/examples/charts/polarchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from polarchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(polarchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmlaxes/CMakeLists.txt b/examples/charts/qmlaxes/CMakeLists.txt index bb061691..738ff295 100644 --- a/examples/charts/qmlaxes/CMakeLists.txt +++ b/examples/charts/qmlaxes/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmlaxes.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmlaxes LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmlboxplot/CMakeLists.txt b/examples/charts/qmlboxplot/CMakeLists.txt index e60aa879..ce55be21 100644 --- a/examples/charts/qmlboxplot/CMakeLists.txt +++ b/examples/charts/qmlboxplot/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmlboxplot.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmlboxplot LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmlcandlestick/CMakeLists.txt b/examples/charts/qmlcandlestick/CMakeLists.txt index c78b7950..df2a7015 100644 --- a/examples/charts/qmlcandlestick/CMakeLists.txt +++ b/examples/charts/qmlcandlestick/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmlcandlestick.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmlcandlestick LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmlchart/CMakeLists.txt b/examples/charts/qmlchart/CMakeLists.txt index 6496ca8b..fd2aa325 100644 --- a/examples/charts/qmlchart/CMakeLists.txt +++ b/examples/charts/qmlchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmlchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmlchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmlcustomizations/CMakeLists.txt b/examples/charts/qmlcustomizations/CMakeLists.txt index 00f59f59..7af83332 100644 --- a/examples/charts/qmlcustomizations/CMakeLists.txt +++ b/examples/charts/qmlcustomizations/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmlcustomizations.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmlcustomizations LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmlcustomlegend/CMakeLists.txt b/examples/charts/qmlcustomlegend/CMakeLists.txt index e51e7f67..1c3aef8a 100644 --- a/examples/charts/qmlcustomlegend/CMakeLists.txt +++ b/examples/charts/qmlcustomlegend/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmlcustomlegend.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmlcustomlegend LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmlf1legends/CMakeLists.txt b/examples/charts/qmlf1legends/CMakeLists.txt index 69b418e9..f5438a22 100644 --- a/examples/charts/qmlf1legends/CMakeLists.txt +++ b/examples/charts/qmlf1legends/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmlf1legends.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmlf1legends LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmloscilloscope/CMakeLists.txt b/examples/charts/qmloscilloscope/CMakeLists.txt index 5db06367..6d8bf8f9 100644 --- a/examples/charts/qmloscilloscope/CMakeLists.txt +++ b/examples/charts/qmloscilloscope/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmloscilloscope.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmloscilloscope LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmlpiechart/CMakeLists.txt b/examples/charts/qmlpiechart/CMakeLists.txt index 787e5235..35a880fc 100644 --- a/examples/charts/qmlpiechart/CMakeLists.txt +++ b/examples/charts/qmlpiechart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmlpiechart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmlpiechart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmlpolarchart/CMakeLists.txt b/examples/charts/qmlpolarchart/CMakeLists.txt index b1c927f9..39685151 100644 --- a/examples/charts/qmlpolarchart/CMakeLists.txt +++ b/examples/charts/qmlpolarchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmlpolarchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmlpolarchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/qmlweather/CMakeLists.txt b/examples/charts/qmlweather/CMakeLists.txt index 314ece1b..8142fb8c 100644 --- a/examples/charts/qmlweather/CMakeLists.txt +++ b/examples/charts/qmlweather/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from qmlweather.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(qmlweather LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/scatterchart/CMakeLists.txt b/examples/charts/scatterchart/CMakeLists.txt index fa498df7..facd2538 100644 --- a/examples/charts/scatterchart/CMakeLists.txt +++ b/examples/charts/scatterchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from scatterchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(scatterchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/scatterinteractions/CMakeLists.txt b/examples/charts/scatterinteractions/CMakeLists.txt index 51eb2bea..6d1cada9 100644 --- a/examples/charts/scatterinteractions/CMakeLists.txt +++ b/examples/charts/scatterinteractions/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from scatterinteractions.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(scatterinteractions LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/selectedbar/CMakeLists.txt b/examples/charts/selectedbar/CMakeLists.txt new file mode 100644 index 00000000..a293d64b --- /dev/null +++ b/examples/charts/selectedbar/CMakeLists.txt @@ -0,0 +1,40 @@ +# Generated from selectedbar.pro. + +cmake_minimum_required(VERSION 3.16) +project(selectedbar LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/charts/selectedbar") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Charts) + +qt_add_executable(selectedbar + utilities.h utilities.cpp + main.cpp +) +set_target_properties(selectedbar PROPERTIES + WIN32_EXECUTABLE TRUE + MACOSX_BUNDLE TRUE +) +target_link_libraries(selectedbar PUBLIC + Qt::Charts + Qt::Core + Qt::Gui +) + +install(TARGETS selectedbar + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/charts/selectedbar/main.cpp b/examples/charts/selectedbar/main.cpp new file mode 100644 index 00000000..9ed62441 --- /dev/null +++ b/examples/charts/selectedbar/main.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "utilities.h" +#include <QBarSet> +#include <QApplication> +#include <QBarSeries> +#include <QList> +#include <QChart> +#include <QBarCategoryAxis> +#include <QValueAxis> +#include <QChartView> +#include <QWindow> +#include <QHBoxLayout> +#include <QLabel> +#include <QMainWindow> + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QMainWindow mainWindow; + mainWindow.setWindowTitle(QCoreApplication::tr("Meat consumption series")); + + //![1] + QBarSet *setChicken = Utilities::createChickenSet(); + QBarSet *setPork = Utilities::createPorkSet(); + QBarSet *setTurkey = Utilities::createTurkeySet(); + QBarSet *setHam = Utilities::createHamSet(); + qreal totalSum = setChicken->sum() + setPork->sum() + setTurkey->sum() + setHam->sum(); + QList<QBarSet *> setList = QList<QBarSet *>{setChicken, setPork, setTurkey, setHam}; + + QBarSeries *series = new QBarSeries(); + series->append(setList); + //![1] + + //![2] + QChart *chart = new QChart(); + chart->addSeries(series); + chart->setTitle(QCoreApplication::tr("Meat consumption")); + chart->setAnimationOptions(QChart::SeriesAnimations); + chart->legend()->setVisible(true); + chart->legend()->setAlignment(Qt::AlignBottom); + //![2] + + //![3] + for (QBarSet *barSet : series->barSets()) + barSet->setSelectedColor(barSet->brush().color().darker()); + //![3] + + //![4] + QStringList categories = Utilities::createYearCategories(); + QBarCategoryAxis *axisX = new QBarCategoryAxis(); + axisX->setCategories(categories); + chart->addAxis(axisX, Qt::AlignBottom); + series->attachAxis(axisX); + + QValueAxis *axisY = new QValueAxis(); + axisY->setRange(0, 20); + axisY->setTitleText(QCoreApplication::tr("Tons")); + axisY->setLabelsAngle(-90); + axisY->setTitleVisible(true); + chart->addAxis(axisY, Qt::AlignLeft); + series->attachAxis(axisY); + //![4] + + //![5] + QChartView *chartView = new QChartView(chart); + chartView->setRenderHint(QPainter::Antialiasing); + //![5] + + //![6] + QWidget *labelWidget = new QWidget(&mainWindow); + QHBoxLayout *labelLayout = new QHBoxLayout(labelWidget); + labelLayout->setAlignment(Qt::AlignCenter); + + QLabel *totalSumLabel = new QLabel(QCoreApplication::tr("Total sum: %1 T").arg(totalSum)); + labelLayout->addWidget(totalSumLabel); + totalSumLabel->setContentsMargins(0, 0, 54, 0); + + QLabel *selectedSumLabel = new QLabel(QCoreApplication::tr("Selected sum: 0 T")); + labelLayout->addWidget(selectedSumLabel); + + QLabel *unselectedSumLabel = new QLabel(QCoreApplication::tr("Unselected sum: %1 T").arg(totalSum)); + labelLayout->addWidget(unselectedSumLabel); + unselectedSumLabel->setContentsMargins(54, 0, 0, 0); + //![6] + + //![7] + QObject::connect(series, &QAbstractBarSeries::clicked, series, [=](int index, QBarSet *set) { + set->toggleSelection({index}); + qreal selectedSum = 0.; + for (int i = 0; i < setList.size(); ++i) { + auto selectedIndices = setList.at(i)->selectedBars(); + for (int k = 0; k < selectedIndices.size(); ++k) + selectedSum += setList.at(i)->at(selectedIndices.at(k)); + } + selectedSumLabel->setText(QCoreApplication::tr("Selected sum: %1 T").arg(selectedSum)); + // Because of rounding errors, selectedSum can result in being bigger than total sum + qreal unselectedSum = totalSum - selectedSum < 0 ? 0. : totalSum - selectedSum; + unselectedSumLabel->setText( + QCoreApplication::tr("Unselected sum: %1 T") + .arg(unselectedSum) + ); + }); + //![7] + + //![8] + QWidget *mainWidget = new QWidget(&mainWindow); + QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget); + + mainLayout->addWidget(chartView); + mainLayout->addWidget(labelWidget); + + mainWindow.setCentralWidget(mainWidget); + mainWindow.resize(800, 600); + + mainWindow.show(); + return a.exec(); + //![8] +} diff --git a/examples/charts/selectedbar/selectedbar.pro b/examples/charts/selectedbar/selectedbar.pro new file mode 100644 index 00000000..24d0de08 --- /dev/null +++ b/examples/charts/selectedbar/selectedbar.pro @@ -0,0 +1,11 @@ +QT += charts widgets + +SOURCES += \ + main.cpp \ + utilities.cpp + +HEADERS += \ + utilities.h + +target.path = $$[QT_INSTALL_EXAMPLES]/charts/selectedbar +INSTALLS += target diff --git a/examples/charts/selectedbar/utilities.cpp b/examples/charts/selectedbar/utilities.cpp new file mode 100644 index 00000000..4bbf2c74 --- /dev/null +++ b/examples/charts/selectedbar/utilities.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "utilities.h" +#include <QCoreApplication> + +namespace Utilities +{ + +QBarSet *createChickenSet() +{ + QBarSet *set = new QBarSet(QCoreApplication::tr("Chicken")); + set->append({15.0, 12.0, 8.0, 11.5, 13.7}); + return set; +} + +QBarSet *createPorkSet() +{ + QBarSet *set = new QBarSet(QCoreApplication::tr("Pork")); + set->append({9.0, 11.0, 9.0, 7, 12.2}); + return set; +} + +QBarSet *createTurkeySet() +{ + QBarSet *set = new QBarSet(QCoreApplication::tr("Turkey")); + set->append({5.0, 7.6, 9.3, 8, 8.1}); + return set; +} + +QBarSet *createHamSet() +{ + QBarSet *set = new QBarSet(QCoreApplication::tr("Ham")); + set->append({5.4, 7.1, 9.3, 12.3, 11.3}); + return set; +} + +QStringList createYearCategories() +{ + return QStringList{QCoreApplication::tr("2017"), + QCoreApplication::tr("2018"), + QCoreApplication::tr("2019"), + QCoreApplication::tr("2020"), + QCoreApplication::tr("2021")}; +} + +} diff --git a/examples/charts/selectedbar/utilities.h b/examples/charts/selectedbar/utilities.h new file mode 100644 index 00000000..41fe9610 --- /dev/null +++ b/examples/charts/selectedbar/utilities.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Charts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef UTILITIES_H +#define UTILITIES_H + +#include <QList> +#include <QBarSet> + +namespace Utilities +{ + QBarSet *createChickenSet(); + QBarSet *createPorkSet(); + QBarSet *createTurkeySet(); + QBarSet *createHamSet(); + QStringList createYearCategories(); + qreal totalSum(const QList<QBarSet *> &setList); +} + +#endif // UTILITIES_H diff --git a/examples/charts/splinechart/CMakeLists.txt b/examples/charts/splinechart/CMakeLists.txt index 62e369d0..1e8c0092 100644 --- a/examples/charts/splinechart/CMakeLists.txt +++ b/examples/charts/splinechart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from splinechart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(splinechart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/stackedbarchart/CMakeLists.txt b/examples/charts/stackedbarchart/CMakeLists.txt index 782258bf..c96be256 100644 --- a/examples/charts/stackedbarchart/CMakeLists.txt +++ b/examples/charts/stackedbarchart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from stackedbarchart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(stackedbarchart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/stackedbarchartdrilldown/CMakeLists.txt b/examples/charts/stackedbarchartdrilldown/CMakeLists.txt index f8374cf9..576960bc 100644 --- a/examples/charts/stackedbarchartdrilldown/CMakeLists.txt +++ b/examples/charts/stackedbarchartdrilldown/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from stackedbarchartdrilldown.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(stackedbarchartdrilldown LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/temperaturerecords/CMakeLists.txt b/examples/charts/temperaturerecords/CMakeLists.txt index c6bd04d5..b1a0588b 100644 --- a/examples/charts/temperaturerecords/CMakeLists.txt +++ b/examples/charts/temperaturerecords/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from temperaturerecords.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(temperaturerecords LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/examples/charts/zoomlinechart/CMakeLists.txt b/examples/charts/zoomlinechart/CMakeLists.txt index 5c0f299d..6c6b8222 100644 --- a/examples/charts/zoomlinechart/CMakeLists.txt +++ b/examples/charts/zoomlinechart/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from zoomlinechart.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(zoomlinechart LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/src/charts/areachart/qareaseries.cpp b/src/charts/areachart/qareaseries.cpp index efd75736..9685c915 100644 --- a/src/charts/areachart/qareaseries.cpp +++ b/src/charts/areachart/qareaseries.cpp @@ -465,8 +465,8 @@ void QAreaSeries::setUpperSeries(QLineSeries *series) if (series) series->d_ptr->setBlockOpenGL(true); d->m_upperSeries = series; - if (!d->m_item.isNull()) - static_cast<AreaChartItem *>(d->m_item.data())->setUpperSeries(series); + if (d->m_item) + static_cast<AreaChartItem *>(d->m_item.get())->setUpperSeries(series); } } @@ -486,8 +486,8 @@ void QAreaSeries::setLowerSeries(QLineSeries *series) if (series) series->d_ptr->setBlockOpenGL(true); d->m_lowerSeries = series; - if (!d->m_item.isNull()) - static_cast<AreaChartItem *>(d->m_item.data())->setLowerSeries(series); + if (d->m_item) + static_cast<AreaChartItem *>(d->m_item.get())->setLowerSeries(series); } } @@ -755,7 +755,7 @@ void QAreaSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, QEasingCurve &curve) { Q_Q(QAreaSeries); - AreaChartItem *area = static_cast<AreaChartItem *>(m_item.data()); + AreaChartItem *area = static_cast<AreaChartItem *>(m_item.get()); if (q->upperSeries() && area->upperLineItem()->animation()) area->upperLineItem()->animation()->stopAndDestroyLater(); diff --git a/src/charts/axis/cartesianchartaxis.cpp b/src/charts/axis/cartesianchartaxis.cpp index e154bfc1..2a606d71 100644 --- a/src/charts/axis/cartesianchartaxis.cpp +++ b/src/charts/axis/cartesianchartaxis.cpp @@ -274,7 +274,7 @@ bool CartesianChartAxis::emptyAxis() const { return axisGeometry().isEmpty() || gridGeometry().isEmpty() - || qFuzzyCompare(min(), max()); + || qFuzzyIsNull(max() - min()); } void CartesianChartAxis::setGeometry(const QRectF &axis, const QRectF &grid) diff --git a/src/charts/axis/chartaxiselement.cpp b/src/charts/axis/chartaxiselement.cpp index d152d7bb..4fff04fc 100644 --- a/src/charts/axis/chartaxiselement.cpp +++ b/src/charts/axis/chartaxiselement.cpp @@ -373,7 +373,7 @@ bool ChartAxisElement::emptyAxis() const { return axisGeometry().isEmpty() || gridGeometry().isEmpty() - || qFuzzyCompare(min(), max()); + || qFuzzyIsNull(max() - min()); } qreal ChartAxisElement::min() const diff --git a/src/charts/axis/horizontalaxis.cpp b/src/charts/axis/horizontalaxis.cpp index ac7d65dd..e1807191 100644 --- a/src/charts/axis/horizontalaxis.cpp +++ b/src/charts/axis/horizontalaxis.cpp @@ -493,12 +493,12 @@ void HorizontalAxis::updateMinorTickGeometry() qreal minorArrowLineItemY2; switch (axis()->alignment()) { case Qt::AlignTop: - minorArrowLineItemY1 = gridGeometry().bottom(); - minorArrowLineItemY2 = gridGeometry().bottom() - labelPadding() / 2.0; + minorArrowLineItemY1 = gridGeometry().top(); + minorArrowLineItemY2 = gridGeometry().top() - labelPadding() / 2.0; break; case Qt::AlignBottom: - minorArrowLineItemY1 = gridGeometry().top(); - minorArrowLineItemY2 = gridGeometry().top() + labelPadding() / 2.0; + minorArrowLineItemY1 = gridGeometry().bottom(); + minorArrowLineItemY2 = gridGeometry().bottom() + labelPadding() / 2.0; break; default: minorArrowLineItemY1 = 0.0; diff --git a/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp b/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp index b4a88e17..3ea5dd1b 100644 --- a/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp +++ b/src/charts/axis/logvalueaxis/qlogvalueaxis.cpp @@ -154,7 +154,7 @@ QT_BEGIN_NAMESPACE \sa QString::asprintf() */ /*! - \qmlproperty real LogValueAxis::labelFormat + \qmlproperty string LogValueAxis::labelFormat The label format of the axis. The format string supports the following conversion specifiers, length modifiers, and flags diff --git a/src/charts/axis/qabstractaxis.cpp b/src/charts/axis/qabstractaxis.cpp index 6def930b..156c4c8e 100644 --- a/src/charts/axis/qabstractaxis.cpp +++ b/src/charts/axis/qabstractaxis.cpp @@ -1156,7 +1156,7 @@ void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent) void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve) { - ChartAxisElement *axis = m_item.data(); + ChartAxisElement *axis = m_item.get(); Q_ASSERT(axis); if (axis->animation()) axis->animation()->stopAndDestroyLater(); diff --git a/src/charts/axis/qabstractaxis_p.h b/src/charts/axis/qabstractaxis_p.h index 1249602e..2599a58a 100644 --- a/src/charts/axis/qabstractaxis_p.h +++ b/src/charts/axis/qabstractaxis_p.h @@ -45,6 +45,8 @@ #include <QtCharts/private/qchartglobal_p.h> #include <QtCore/QDebug> +#include <memory> + QT_BEGIN_NAMESPACE class QGraphicsItem; QT_END_NAMESPACE @@ -87,7 +89,7 @@ public: virtual qreal min() = 0; virtual qreal max() = 0; - ChartAxisElement *axisItem() { return m_item.data(); } + ChartAxisElement *axisItem() { return m_item.get(); } public Q_SLOTS: void handleRangeChanged(qreal min, qreal max); @@ -98,7 +100,7 @@ Q_SIGNALS: protected: QAbstractAxis *q_ptr; QChart *m_chart = nullptr; - QScopedPointer<ChartAxisElement> m_item; + std::unique_ptr<ChartAxisElement> m_item; private: QList<QAbstractSeries*> m_series; diff --git a/src/charts/axis/valueaxis/qvalueaxis.h b/src/charts/axis/valueaxis/qvalueaxis.h index c044bd27..c2622cf0 100644 --- a/src/charts/axis/valueaxis/qvalueaxis.h +++ b/src/charts/axis/valueaxis/qvalueaxis.h @@ -44,9 +44,12 @@ class Q_CHARTS_EXPORT QValueAxis : public QAbstractAxis Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged) Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged) Q_PROPERTY(int minorTickCount READ minorTickCount WRITE setMinorTickCount NOTIFY minorTickCountChanged) - Q_PROPERTY(qreal tickAnchor READ tickAnchor WRITE setTickAnchor NOTIFY tickAnchorChanged REVISION 1) - Q_PROPERTY(qreal tickInterval READ tickInterval WRITE setTickInterval NOTIFY tickIntervalChanged REVISION 1) - Q_PROPERTY(TickType tickType READ tickType WRITE setTickType NOTIFY tickTypeChanged REVISION 1) + Q_PROPERTY(qreal tickAnchor READ tickAnchor WRITE setTickAnchor NOTIFY tickAnchorChanged + REVISION(2, 3)) + Q_PROPERTY(qreal tickInterval READ tickInterval WRITE setTickInterval NOTIFY tickIntervalChanged + REVISION(2, 3)) + Q_PROPERTY(TickType tickType READ tickType WRITE setTickType NOTIFY tickTypeChanged REVISION(2, + 3)) Q_ENUMS(TickType) public: @@ -97,9 +100,9 @@ Q_SIGNALS: void tickCountChanged(int tickCount); void minorTickCountChanged(int tickCount); void labelFormatChanged(const QString &format); - Q_REVISION(1) void tickIntervalChanged(qreal interval); - Q_REVISION(1) void tickAnchorChanged(qreal anchor); - Q_REVISION(1) void tickTypeChanged(QValueAxis::TickType type); + Q_REVISION(2, 3) void tickIntervalChanged(qreal interval); + Q_REVISION(2, 3) void tickAnchorChanged(qreal anchor); + Q_REVISION(2, 3) void tickTypeChanged(QValueAxis::TickType type); private: Q_DECLARE_PRIVATE(QValueAxis) diff --git a/src/charts/barchart/qabstractbarseries.cpp b/src/charts/barchart/qabstractbarseries.cpp index bbf30329..270953b5 100644 --- a/src/charts/barchart/qabstractbarseries.cpp +++ b/src/charts/barchart/qabstractbarseries.cpp @@ -1107,7 +1107,7 @@ void QAbstractBarSeriesPrivate::initializeAxes() } // Make sure series animations are reset when axes change - AbstractBarChartItem *item = qobject_cast<AbstractBarChartItem *>(m_item.data()); + AbstractBarChartItem *item = qobject_cast<AbstractBarChartItem *>(m_item.get()); if (item) item->resetAnimation(); } @@ -1190,7 +1190,7 @@ void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bo // with single bar series with a lot of sets colored as they always have been. int actualIndex = 0; int firstSeriesSetCount = m_barSets.count(); - if (!m_item.isNull()) { + if (m_item) { auto seriesMap = m_item->themeManager()->seriesMap(); int lowestSeries = index; for (auto it = seriesMap.cbegin(), end = seriesMap.cend(); it != end; ++it) { @@ -1260,7 +1260,7 @@ void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bo void QAbstractBarSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve) { - AbstractBarChartItem *bar = static_cast<AbstractBarChartItem *>(m_item.data()); + AbstractBarChartItem *bar = static_cast<AbstractBarChartItem *>(m_item.get()); Q_ASSERT(bar); if (bar->animation()) bar->animation()->stopAndDestroyLater(); diff --git a/src/charts/barchart/qbarset.cpp b/src/charts/barchart/qbarset.cpp index faccf07f..f7ad4909 100644 --- a/src/charts/barchart/qbarset.cpp +++ b/src/charts/barchart/qbarset.cpp @@ -691,7 +691,7 @@ QColor QBarSet::selectedColor() const } /*! - Sets the color of the selected bars. + Sets the \a color of the selected bars. \sa selectedColor \since 6.2 */ diff --git a/src/charts/boxplotchart/qboxplotseries.cpp b/src/charts/boxplotchart/qboxplotseries.cpp index 531bcf72..02baf873 100644 --- a/src/charts/boxplotchart/qboxplotseries.cpp +++ b/src/charts/boxplotchart/qboxplotseries.cpp @@ -509,7 +509,7 @@ void QBoxPlotSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool f void QBoxPlotSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve) { - BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data()); + BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.get()); Q_ASSERT(item); if (item->animation()) item->animation()->stopAndDestroyLater(); @@ -547,7 +547,7 @@ void QBoxPlotSeriesPrivate::handleSeriesRemove(QAbstractSeries *series) // Test if series removed is me, then don't do anything if (q != removedSeries) { - BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.data()); + BoxPlotChartItem *item = static_cast<BoxPlotChartItem *>(m_item.get()); if (item) { item->m_seriesCount = item->m_seriesCount - 1; if (removedSeries->d_func()->m_index < m_index) { @@ -566,7 +566,7 @@ void QBoxPlotSeriesPrivate::handleSeriesChange(QAbstractSeries *series) Q_Q(QBoxPlotSeries); - BoxPlotChartItem *boxPlot = static_cast<BoxPlotChartItem *>(m_item.data()); + BoxPlotChartItem *boxPlot = static_cast<BoxPlotChartItem *>(m_item.get()); if (m_chart) { QList<QAbstractSeries *> serieses = m_chart->series(); diff --git a/src/charts/boxplotchart/qboxplotseries.h b/src/charts/boxplotchart/qboxplotseries.h index 73cfbd72..a6b1db25 100644 --- a/src/charts/boxplotchart/qboxplotseries.h +++ b/src/charts/boxplotchart/qboxplotseries.h @@ -45,7 +45,7 @@ class Q_CHARTS_EXPORT QBoxPlotSeries : public QAbstractSeries Q_PROPERTY(qreal boxWidth READ boxWidth WRITE setBoxWidth NOTIFY boxWidthChanged) Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) - Q_PROPERTY(int count READ count NOTIFY countChanged REVISION 1) + Q_PROPERTY(int count READ count NOTIFY countChanged REVISION(2, 0)) public: explicit QBoxPlotSeries(QObject *parent = nullptr); ~QBoxPlotSeries(); diff --git a/src/charts/candlestickchart/qcandlestickseries.cpp b/src/charts/candlestickchart/qcandlestickseries.cpp index 96335a02..6307e518 100644 --- a/src/charts/candlestickchart/qcandlestickseries.cpp +++ b/src/charts/candlestickchart/qcandlestickseries.cpp @@ -1011,7 +1011,7 @@ void QCandlestickSeriesPrivate::initializeGraphics(QGraphicsItem *parent) void QCandlestickSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve) { - CandlestickChartItem *item = static_cast<CandlestickChartItem *>(m_item.data()); + CandlestickChartItem *item = static_cast<CandlestickChartItem *>(m_item.get()); Q_ASSERT(item); if (item->animation()) @@ -1118,7 +1118,7 @@ void QCandlestickSeriesPrivate::handleSeriesChange(QAbstractSeries *series) Q_UNUSED(series); if (m_chart) { - CandlestickChartItem *item = static_cast<CandlestickChartItem *>(m_item.data()); + CandlestickChartItem *item = static_cast<CandlestickChartItem *>(m_item.get()); if (item) item->handleCandlestickSeriesChange(); } @@ -1136,7 +1136,7 @@ void QCandlestickSeriesPrivate::handleSeriesRemove(QAbstractSeries *series) } if (q != removedSeries) { - CandlestickChartItem *item = static_cast<CandlestickChartItem *>(m_item.data()); + CandlestickChartItem *item = static_cast<CandlestickChartItem *>(m_item.get()); if (item) item->handleCandlestickSeriesChange(); } diff --git a/src/charts/chartpresenter.cpp b/src/charts/chartpresenter.cpp index 39ba35f6..969b2c68 100644 --- a/src/charts/chartpresenter.cpp +++ b/src/charts/chartpresenter.cpp @@ -98,7 +98,7 @@ void ChartPresenter::setFixedGeometry(const QRectF &rect) void ChartPresenter::setGeometry(const QRectF rect) { - if (m_rect != rect) { + if (rect.isValid() && m_rect != rect) { m_rect = rect; if (!m_fixedRect.isNull()) return; @@ -138,7 +138,7 @@ void ChartPresenter::handleAxisAdded(QAbstractAxis *axis) void ChartPresenter::handleAxisRemoved(QAbstractAxis *axis) { - ChartAxisElement *item = axis->d_ptr->m_item.take(); + ChartAxisElement *item = axis->d_ptr->m_item.release(); if (item->animation()) item->animation()->stopAndDestroyLater(); item->hide(); @@ -169,7 +169,7 @@ void ChartPresenter::handleSeriesAdded(QAbstractSeries *series) void ChartPresenter::handleSeriesRemoved(QAbstractSeries *series) { - ChartItem *chart = series->d_ptr->m_item.take(); + ChartItem *chart = series->d_ptr->m_item.release(); chart->hide(); chart->cleanup(); series->disconnect(chart); diff --git a/src/charts/doc/images/examples_pointsselectionandmarkers1.png b/src/charts/doc/images/examples_pointsselectionandmarkers1.png Binary files differnew file mode 100644 index 00000000..7a98ddea --- /dev/null +++ b/src/charts/doc/images/examples_pointsselectionandmarkers1.png diff --git a/src/charts/doc/images/examples_pointsselectionandmarkers2.png b/src/charts/doc/images/examples_pointsselectionandmarkers2.png Binary files differnew file mode 100644 index 00000000..8b8b0800 --- /dev/null +++ b/src/charts/doc/images/examples_pointsselectionandmarkers2.png diff --git a/src/charts/doc/images/examples_selectedbar.png b/src/charts/doc/images/examples_selectedbar.png Binary files differnew file mode 100644 index 00000000..0b425aeb --- /dev/null +++ b/src/charts/doc/images/examples_selectedbar.png diff --git a/src/charts/doc/src/examples-pointsselectionandmarkers.qdoc b/src/charts/doc/src/examples-pointsselectionandmarkers.qdoc new file mode 100644 index 00000000..c3fe2e84 --- /dev/null +++ b/src/charts/doc/src/examples-pointsselectionandmarkers.qdoc @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example pointsselectionandmarkers + \title Light Markers Points Selection Example + \ingroup qtcharts_examples + + \brief The example shows a usage of light markers + and points selection for the series. + + \image examples_pointsselectionandmarkers1.png + \image examples_pointsselectionandmarkers2.png + + \include examples-run.qdocinc + + \section1 Light Markers Feature + + We start with creating a series, filling it with the data, and setting up selection funcionality. + It's important not to set points visibility to \c true, because light markers functionality is + an independent feature and setting both would result in undesired behavior. + \snippet pointsselectionandmarkers/main.cpp 1 + + Then we create the \c {QChart}, the \c {QChartview} and the control widget with its layout to arrange customization elements. + \snippet pointsselectionandmarkers/main.cpp 2 + + The next step is creating elements of customization. + \snippet pointsselectionandmarkers/main.cpp 3 + + We create the label for the marker selection combobox and add fill the combobox with the items. + Also, we provide functionality to the combobox. Considering the implementation of the light markers + functionality, we need to make sure if displaying of unselected points is checked. + Switching the visibility of the light marker off is achieved by setting it to \c "empty" \c {QImage}. + If the user unchecks the displaying of unselected points and changes the light marker image, unselected points + have to remain invisible. + If checking isn't performed, new \c {QImage} will be set for light marker + and unselected points will be visible even though it has been switched off. + \snippet pointsselectionandmarkers/main.cpp 4 + + Almost the same procedure applies to the selected point light marker and line color. The only difference is + that there's no need to check visibility of unselected points as it doesn't affect the functionality. + \snippet pointsselectionandmarkers/main.cpp 5 + + A small difference comes with changing visibility of unselected points. As it was mentioned before, + making light markers invisible is achieved by setting them to "empty" \c {QImage}. + That is why, depending on checkbox state, selected point light marker is set to "empty" \c {QImage} or + to the light marker extracted from the current index of the corresponding combobox. + \snippet pointsselectionandmarkers/main.cpp 6 + + The final part is to arrange the elements, add all the widgets to the main widget, and set the main window size. + \snippet pointsselectionandmarkers/main.cpp 7 +*/ diff --git a/src/charts/doc/src/examples-selectedbar.qdoc b/src/charts/doc/src/examples-selectedbar.qdoc new file mode 100644 index 00000000..72c6a34c --- /dev/null +++ b/src/charts/doc/src/examples-selectedbar.qdoc @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example selectedbar + \title SelectedBar Example + \ingroup qtcharts_examples + + \brief The example shows how to use a selection feature for the bar chart. + + The example shows changing the color and state of bars using the selection feature. + + \image examples_selectedbar.png + + \include examples-run.qdocinc + + \section1 Using setBarSelected() + + We create the sets and fill them with the data. Then we create a series and append data to it. + \snippet selectedbar/main.cpp 1 + + We create the chart and add series to it. + Also, we add a title to the chart, set animation for the chart, and align the legend. + \snippet selectedbar/main.cpp 2 + + Here we set the color for the selected bars. + \snippet selectedbar/main.cpp 3 + + Next step is adding axes: + QBarCategoryAxis for years of measurements and QValueAxis for values range. + \snippet selectedbar/main.cpp 4 + + Then we add the chart view to put the chart in. + \snippet selectedbar/main.cpp 5 + + Here we create a widget for labels of values of selected and unselected bars. + \snippet selectedbar/main.cpp 6 + + We connect selecting of a specific bar with labels of values using a lambda. + \c {set->toggleSelection({index})} sets the bar selected. + \snippet selectedbar/main.cpp 7 + + Finally, we create the main widget and add other layouts to it and run the application. + \snippet selectedbar/main.cpp 8 +*/ diff --git a/src/charts/doc/src/index.qdoc b/src/charts/doc/src/index.qdoc index 92f75ea7..ab35d16b 100644 --- a/src/charts/doc/src/index.qdoc +++ b/src/charts/doc/src/index.qdoc @@ -59,6 +59,10 @@ \snippet doc_src_qtcharts.pro 0 \endif + \section1 Module Evolution + \l{Changes to Qt Charts} lists important changes in the module API + and functionality that were done for the Qt 6 series of Qt. + \section1 Licenses Qt Charts is available under commercial licenses from \l{The Qt Company}. diff --git a/src/charts/doc/src/qt6-changes.qdoc b/src/charts/doc/src/qt6-changes.qdoc new file mode 100644 index 00000000..74f24dbe --- /dev/null +++ b/src/charts/doc/src/qt6-changes.qdoc @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtcharts-changes-qt6.html + \title Changes to Qt Charts + \ingroup changes-qt-5-to-6 + \brief Migrate Qt Charts to Qt 6. + + Qt 6 is a result of the conscious effort to make the framework more + efficient and easy to use. + + We try to maintain binary and source compatibility for all the public + APIs in each release. But some changes were inevitable in an effort to + make Qt a better framework. + + In this document we summarize those changes in Qt Charts. + + \section1 QtCharts Namespace + + Qt Charts no longer has a custom \c QtCharts namespace. Instead, the normal Qt + namespace is used if one is configured for the Qt build. + + \section1 OpenGL Acceleration in QML + + As the name implies, \l{AbstractSeries::useOpenGL}{AbstractSeries.useOpenGL} still only + supports OpenGL acceleration, so it won't work if QML RHI backend is defined as something + else, as it typically is by default in Qt 6. Force RHI OpenGL backend into use to fix this + issue by using the environment variable \c{QSG_RHI_BACKEND=opengl}, for example. +*/ diff --git a/src/charts/domain/abstractdomain.cpp b/src/charts/domain/abstractdomain.cpp index 263c72a4..1ccffde0 100644 --- a/src/charts/domain/abstractdomain.cpp +++ b/src/charts/domain/abstractdomain.cpp @@ -58,6 +58,9 @@ AbstractDomain::~AbstractDomain() void AbstractDomain::setSize(const QSizeF &size) { + if (!size.isValid()) + return; + if (m_size != size) { m_size=size; emit updated(); diff --git a/src/charts/layout/abstractchartlayout.cpp b/src/charts/layout/abstractchartlayout.cpp index 3826c75e..e5c3eb36 100644 --- a/src/charts/layout/abstractchartlayout.cpp +++ b/src/charts/layout/abstractchartlayout.cpp @@ -53,6 +53,7 @@ void AbstractChartLayout::setGeometry(const QRectF &rect) { if (!rect.isValid()) return; + // If the chart has a fixed geometry then don't update visually const bool updateLayout = (!m_presenter->isFixedGeometry() || m_presenter->geometry() == rect); if (m_presenter->chart()->isVisible()) { @@ -73,12 +74,14 @@ void AbstractChartLayout::setGeometry(const QRectF &rect) contentGeometry = calculateAxisGeometry(contentGeometry, axes, updateLayout); - m_presenter->setGeometry(contentGeometry); - if (updateLayout) { - if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian) - static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); - else - static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); + if (contentGeometry.isValid()) { + m_presenter->setGeometry(contentGeometry); + if (updateLayout) { + if (m_presenter->chart()->chartType() == QChart::ChartTypeCartesian) + static_cast<QGraphicsRectItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); + else + static_cast<QGraphicsEllipseItem *>(m_presenter->plotAreaElement())->setRect(contentGeometry); + } } } diff --git a/src/charts/layout/cartesianchartlayout.cpp b/src/charts/layout/cartesianchartlayout.cpp index ae4f8d3d..e46b3f15 100644 --- a/src/charts/layout/cartesianchartlayout.cpp +++ b/src/charts/layout/cartesianchartlayout.cpp @@ -193,18 +193,14 @@ QRectF CartesianChartLayout::calculateAxisGeometry(const QRectF &geometry, if (leftSqueezeRatio < 1.0) width *= leftSqueezeRatio; leftOffset+=width; - axis->setGeometry(QRect(chartRect.left() - leftOffset, chartRect.top(), - width, chartRect.bottom()), - chartRect); + axis->setGeometry(QRect(chartRect.left()-leftOffset, geometry.top(),width, geometry.bottom()),chartRect); break; } case Qt::AlignRight:{ qreal width = size.width(); if (rightSqueezeRatio < 1.0) width *= rightSqueezeRatio; - axis->setGeometry(QRect(chartRect.right() + rightOffset, chartRect.top(), - width, chartRect.bottom()), - chartRect); + axis->setGeometry(QRect(chartRect.right()+rightOffset,geometry.top(),width,geometry.bottom()),chartRect); rightOffset+=width; break; } @@ -212,9 +208,7 @@ QRectF CartesianChartLayout::calculateAxisGeometry(const QRectF &geometry, qreal height = size.height(); if (topSqueezeRatio < 1.0) height *= topSqueezeRatio; - axis->setGeometry(QRect(chartRect.left(), chartRect.top() - topOffset - height, - chartRect.width(), height), - chartRect); + axis->setGeometry(QRect(geometry.left(), chartRect.top() - topOffset - height, geometry.width(), height), chartRect); topOffset += height; break; } @@ -222,9 +216,7 @@ QRectF CartesianChartLayout::calculateAxisGeometry(const QRectF &geometry, qreal height = size.height(); if (bottomSqueezeRatio < 1.0) height *= bottomSqueezeRatio; - axis->setGeometry(QRect(chartRect.left(), chartRect.bottom() + bottomOffset, - chartRect.width(), height), - chartRect); + axis->setGeometry(QRect(geometry.left(), chartRect.bottom() + bottomOffset, geometry.width(), height), chartRect); bottomOffset += height; break; } diff --git a/src/charts/legend/legendmarkeritem.cpp b/src/charts/legend/legendmarkeritem.cpp index c9b2b817..eda5df19 100644 --- a/src/charts/legend/legendmarkeritem.cpp +++ b/src/charts/legend/legendmarkeritem.cpp @@ -147,7 +147,7 @@ QFont LegendMarkerItem::font() const void LegendMarkerItem::setLabel(const QString label) { m_label = label; - updateGeometry(); + m_marker->invalidateLegend(); } QString LegendMarkerItem::label() const diff --git a/src/charts/legend/qlegend.cpp b/src/charts/legend/qlegend.cpp index 49766c6f..9e2778e9 100644 --- a/src/charts/legend/qlegend.cpp +++ b/src/charts/legend/qlegend.cpp @@ -236,8 +236,8 @@ QT_BEGIN_NAMESPACE */ /*! - \fn void QLegend::attachedToChartChanged(bool) - This signal is emitted when the legend is attached to or detached from the legend. + \fn void QLegend::attachedToChartChanged(bool attached) + This signal is emitted when the legend is \a attached to or detached from the chart. \since 6.2 */ diff --git a/src/charts/linechart/linechartitem.cpp b/src/charts/linechart/linechartitem.cpp index c2c3c694..1da16e07 100644 --- a/src/charts/linechart/linechartitem.cpp +++ b/src/charts/linechart/linechartitem.cpp @@ -58,6 +58,7 @@ LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item) connect(series->d_func(), &QXYSeriesPrivate::seriesUpdated, this, &LineChartItem::handleSeriesUpdated); connect(series, &QXYSeries::lightMarkerChanged, this, &LineChartItem::handleSeriesUpdated); + connect(series, &QXYSeries::selectedLightMarkerChanged, this, &LineChartItem::handleSeriesUpdated); connect(series, &QXYSeries::markerSizeChanged, this, &LineChartItem::handleSeriesUpdated); connect(series, &QXYSeries::visibleChanged, this, &LineChartItem::handleSeriesUpdated); connect(series, &QXYSeries::opacityChanged, this, &LineChartItem::handleSeriesUpdated); @@ -322,7 +323,9 @@ void LineChartItem::updateGeometry() // For mouse interactivity, we have to add the rects *after* the 'createStroke', // as we don't need the outline - we need it filled up. - if (!m_series->lightMarker().isNull()) { + if (!m_series->lightMarker().isNull() + || (!m_series->selectedLightMarker().isNull() + && !m_series->selectedPoints().isEmpty())) { // +1, +2: a margin to guarantee we cover all of the pixmap qreal markerHalfSize = (m_markerSize / 2.0) + 1; qreal markerSize = m_markerSize + 2; @@ -449,8 +452,10 @@ void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt int pointLabelsOffset = m_linePen.width() / 2; - // Draw markers if a marker has been set (set to QImage() to disable) - if (!m_series->lightMarker().isNull()) { + // Draw markers if a marker or marker for selected points only has been + // set (set to QImage() to disable) + if (!m_series->lightMarker().isNull() || (!m_series->selectedLightMarker().isNull() + && !m_series->selectedPoints().isEmpty())) { const QImage &marker = m_series->lightMarker(); const QImage &selectedMarker = m_series->selectedLightMarker(); qreal markerHalfSize = m_markerSize / 2.0; @@ -461,7 +466,7 @@ void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt // light markers are independent features. Therefore m_pointsVisible // is not used here as light markers are drawn if lightMarker is not null. // However points visibility configuration can be still used here. - bool drawPoint = true; + bool drawPoint = !m_series->lightMarker().isNull(); if (m_pointsConfiguration.contains(i)) { const auto &conf = m_pointsConfiguration[i]; diff --git a/src/charts/piechart/qpieseries.cpp b/src/charts/piechart/qpieseries.cpp index a031f3d4..77402cdb 100644 --- a/src/charts/piechart/qpieseries.cpp +++ b/src/charts/piechart/qpieseries.cpp @@ -996,7 +996,7 @@ void QPieSeriesPrivate::initializeGraphics(QGraphicsItem* parent) void QPieSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve) { - PieChartItem *item = static_cast<PieChartItem *>(m_item.data()); + PieChartItem *item = static_cast<PieChartItem *>(m_item.get()); Q_ASSERT(item); if (item->animation()) item->animation()->stopAndDestroyLater(); diff --git a/src/charts/piechart/qpieslice.cpp b/src/charts/piechart/qpieslice.cpp index 32673704..1b3f5cd3 100644 --- a/src/charts/piechart/qpieslice.cpp +++ b/src/charts/piechart/qpieslice.cpp @@ -108,11 +108,13 @@ QT_BEGIN_NAMESPACE /*! \property QPieSlice::label \brief The label of the slice. + \note The string can be HTML formatted. \sa labelVisible, labelBrush, labelFont, labelArmLengthFactor */ /*! \qmlproperty string PieSlice::label The label of the slice. + \note The string can be HTML formatted. */ /*! diff --git a/src/charts/qabstractseries.cpp b/src/charts/qabstractseries.cpp index c3d5cd7d..0af48070 100644 --- a/src/charts/qabstractseries.cpp +++ b/src/charts/qabstractseries.cpp @@ -416,8 +416,8 @@ QList<QAbstractAxis*> QAbstractSeries::attachedAxes() QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries *q) : q_ptr(q), - m_chart(0), - m_item(0), + m_chart(nullptr), + m_item(nullptr), m_domain(new XYDomain()), m_visible(true), m_opacity(1.0), @@ -434,10 +434,11 @@ void QAbstractSeriesPrivate::setDomain(AbstractDomain* domain) { Q_ASSERT(domain); if(m_domain.data()!=domain) { - if(!m_item.isNull()) QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.data(), SLOT(handleDomainUpdated())); + if (m_item) + QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.get(), SLOT(handleDomainUpdated())); m_domain.reset(domain); - if(!m_item.isNull()) { - QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated())); + if (m_item) { + QObject::connect(m_domain.data(), SIGNAL(updated()), m_item.get(), SLOT(handleDomainUpdated())); m_item->handleDomainUpdated(); } } @@ -455,9 +456,9 @@ ChartPresenter *QAbstractSeriesPrivate::presenter() const void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent) { - Q_ASSERT(!m_item.isNull()); + Q_ASSERT(m_item); Q_UNUSED(parent); - QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated())); + QObject::connect(m_domain.data(), SIGNAL(updated()), m_item.get(), SLOT(handleDomainUpdated())); } void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, diff --git a/src/charts/qabstractseries_p.h b/src/charts/qabstractseries_p.h index 5b05f10d..f5c74849 100644 --- a/src/charts/qabstractseries_p.h +++ b/src/charts/qabstractseries_p.h @@ -44,6 +44,8 @@ #include <private/abstractdomain_p.h> #include <QtCharts/private/qchartglobal_p.h> +#include <memory> + QT_BEGIN_NAMESPACE class QGraphicsItem; QT_END_NAMESPACE @@ -81,7 +83,7 @@ public: virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0; virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0; - ChartItem* chartItem() { return m_item.data(); } + ChartItem* chartItem() { return m_item.get(); } virtual void setDomain(AbstractDomain* domain); AbstractDomain* domain() { return m_domain.data(); } @@ -99,7 +101,7 @@ Q_SIGNALS: protected: QAbstractSeries *q_ptr; QChart *m_chart; - QScopedPointer<ChartItem> m_item; + std::unique_ptr<ChartItem> m_item; QList<QAbstractAxis*> m_axes; private: diff --git a/src/charts/qchartview.cpp b/src/charts/qchartview.cpp index e7ca9db1..3e57f186 100644 --- a/src/charts/qchartview.cpp +++ b/src/charts/qchartview.cpp @@ -234,17 +234,18 @@ void QChartView::mouseReleaseEvent(QMouseEvent *event) // Since plotArea uses QRectF and rubberband uses QRect, we can't just blindly use // rubberband's dimensions for vertical and horizontal rubberbands, where one // dimension must match the corresponding plotArea dimension exactly. - if (d_ptr->m_rubberBandFlags.testFlag(VerticalRubberBand)) { - rect.setX(d_ptr->m_chart->plotArea().x()); - rect.setWidth(d_ptr->m_chart->plotArea().width()); - } else if (d_ptr->m_rubberBandFlags.testFlag(HorizontalRubberBand)) { - rect.setY(d_ptr->m_chart->plotArea().y()); - rect.setHeight(d_ptr->m_chart->plotArea().height()); + if (!d_ptr->m_rubberBandFlags.testFlag(RectangleRubberBand)) { + if (d_ptr->m_rubberBandFlags.testFlag(VerticalRubberBand)) { + rect.setX(d_ptr->m_chart->plotArea().x()); + rect.setWidth(d_ptr->m_chart->plotArea().width()); + } else if (d_ptr->m_rubberBandFlags.testFlag(HorizontalRubberBand)) { + rect.setY(d_ptr->m_chart->plotArea().y()); + rect.setHeight(d_ptr->m_chart->plotArea().height()); + } } d_ptr->m_chart->zoomIn(rect); event->accept(); } - } else if (d_ptr->m_rubberBand && event->button() == Qt::RightButton) { // If vertical or horizontal rubberband mode, restrict zoom out to specified axis. // Since there is no suitable API for that, use zoomIn with rect bigger than the @@ -255,13 +256,12 @@ void QChartView::mouseReleaseEvent(QMouseEvent *event) if (d_ptr->m_rubberBandFlags.testFlag(VerticalRubberBand)) { qreal adjustment = rect.height() / 2; rect.adjust(0, -adjustment, 0, adjustment); - } else if (d_ptr->m_rubberBandFlags.testFlag(HorizontalRubberBand)) { + } + if (d_ptr->m_rubberBandFlags.testFlag(HorizontalRubberBand)) { qreal adjustment = rect.width() / 2; rect.adjust(-adjustment, 0, adjustment, 0); } d_ptr->m_chart->zoomIn(rect); - } else { - d_ptr->m_chart->zoomOut(); } event->accept(); } else { diff --git a/src/charts/scatterchart/qscatterseries.cpp b/src/charts/scatterchart/qscatterseries.cpp index 1467a839..6c86afe8 100644 --- a/src/charts/scatterchart/qscatterseries.cpp +++ b/src/charts/scatterchart/qscatterseries.cpp @@ -206,6 +206,8 @@ QT_BEGIN_NAMESPACE QScatterSeries::QScatterSeries(QObject *parent) : QXYSeries(*new QScatterSeriesPrivate(this), parent) { + setPointsVisible(true); + // Emit QScatterSeries' markerSizeChanged signal as it's not the same as // QXYSeries' markerSizeChanged connect(this, &QXYSeries::markerSizeChanged, this, &QScatterSeries::markerSizeChanged); @@ -370,7 +372,7 @@ void QScatterSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool f void QScatterSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve) { - ScatterChartItem *item = static_cast<ScatterChartItem *>(m_item.data()); + ScatterChartItem *item = static_cast<ScatterChartItem *>(m_item.get()); Q_ASSERT(item); if (item->animation()) diff --git a/src/charts/scatterchart/scatterchartitem.cpp b/src/charts/scatterchart/scatterchartitem.cpp index 3c9c8cfb..79eedc4d 100644 --- a/src/charts/scatterchart/scatterchartitem.cpp +++ b/src/charts/scatterchart/scatterchartitem.cpp @@ -50,17 +50,20 @@ ScatterChartItem::ScatterChartItem(QScatterSeries *series, QGraphicsItem *item) m_items(this), m_visible(true), m_markerShape(QScatterSeries::MarkerShapeRectangle), + m_pointsVisible(true), m_pointLabelsVisible(false), m_markerSize(series->markerSize()), m_pointLabelsFormat(series->pointLabelsFormat()), m_pointLabelsFont(series->pointLabelsFont()), m_pointLabelsColor(series->pointLabelsColor()), m_pointLabelsClipping(true), + m_lastHoveredPoint(QPointF(qQNaN(), qQNaN())), m_mousePressed(false) { connect(series->d_func(), &QXYSeriesPrivate::seriesUpdated, this, &ScatterChartItem::handleSeriesUpdated); connect(series, &QXYSeries::lightMarkerChanged, this, &ScatterChartItem::handleSeriesUpdated); + connect(series, &QXYSeries::selectedLightMarkerChanged, this, &ScatterChartItem::handleSeriesUpdated); connect(series, &QXYSeries::markerSizeChanged, this, &ScatterChartItem::handleSeriesUpdated); connect(series, &QXYSeries::visibleChanged, this, &ScatterChartItem::handleSeriesUpdated); connect(series, &QXYSeries::opacityChanged, this, &ScatterChartItem::handleSeriesUpdated); @@ -82,7 +85,7 @@ ScatterChartItem::ScatterChartItem(QScatterSeries *series, QGraphicsItem *item) this, &ScatterChartItem::handleSeriesUpdated); setZValue(ChartPresenter::ScatterSeriesZValue); - setFlags(QGraphicsItem::ItemClipsChildrenToShape); + setFlags(QGraphicsItem::ItemClipsChildrenToShape | QGraphicsItem::ItemIsSelectable); handleSeriesUpdated(); @@ -281,7 +284,7 @@ void ScatterChartItem::updateGeometry() if (!m_visible || offGridStatus.at(i)) { item->setVisible(false); } else { - bool drawPoint = true; + bool drawPoint = m_pointsVisible; if (m_pointsConfiguration.contains(i)) { const auto &conf = m_pointsConfiguration[i]; @@ -298,6 +301,9 @@ void ScatterChartItem::updateGeometry() } } + if (m_series->isPointSelected(i)) + drawPoint = m_series->selectedLightMarker().isNull(); + item->setVisible(drawPoint); } } @@ -307,6 +313,64 @@ void ScatterChartItem::updateGeometry() } } +void ScatterChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + QPointF matchedP = matchForLightMarker(event->pos()); + if (!qIsNaN(matchedP.x())) { + emit XYChart::pressed(matchedP); + m_lastMousePos = event->pos(); + m_mousePressed = true; + } else { + event->ignore(); + } + + QGraphicsItem::mousePressEvent(event); +} + +void ScatterChartItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) +{ + QPointF matchedP = matchForLightMarker(event->pos()); + if (!qIsNaN(matchedP.x())) { + if (matchedP != m_lastHoveredPoint) { + if (!qIsNaN(m_lastHoveredPoint.x())) + emit XYChart::hovered(m_lastHoveredPoint, false); + + m_lastHoveredPoint = matchedP; + emit XYChart::hovered(matchedP, true); + } + } else if (!qIsNaN(m_lastHoveredPoint.x())) { + emit XYChart::hovered(m_lastHoveredPoint, false); + m_lastHoveredPoint = QPointF(qQNaN(), qQNaN()); + } + + QGraphicsItem::hoverMoveEvent(event); +} + +void ScatterChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + QPointF result; + QPointF matchedP = matchForLightMarker(m_lastMousePos); + if (!qIsNaN(matchedP.x()) && m_mousePressed) { + result = matchedP; + emit XYChart::released(result); + emit XYChart::clicked(result); + } + + m_mousePressed = false; + QGraphicsItem::mouseReleaseEvent(event); +} + +void ScatterChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +{ + QPointF matchedP = matchForLightMarker(event->pos()); + if (!qIsNaN(matchedP.x())) + emit XYChart::doubleClicked(matchedP); + else + emit XYChart::doubleClicked(domain()->calculateDomainPoint(m_lastMousePos)); + + QGraphicsItem::mouseDoubleClickEvent(event); +} + void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); @@ -315,8 +379,14 @@ void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * if (m_series->useOpenGL()) return; - // Draw markers if a marker has been set (set to QImage() to disable) - if (!m_series->lightMarker().isNull()) { + QRectF clipRect = QRectF(QPointF(0, 0), domain()->size()); + + painter->save(); + painter->setClipRect(clipRect); + + // Draw markers if a marker or marker for selected points only has been + // set (set to QImage() to disable) + if (!m_series->lightMarker().isNull() || !m_series->selectedLightMarker().isNull()) { const QImage &marker = m_series->lightMarker(); const QImage &selectedMarker = m_series->selectedLightMarker(); qreal markerHalfSize = m_markerSize / 2.0; @@ -326,7 +396,7 @@ void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * // light markers are independent features. Therefore m_pointsVisible // is not used here as light markers are drawn if lightMarker is not null. // However points visibility configuration can be still used here. - bool drawPoint = true; + bool drawPoint = !m_series->lightMarker().isNull(); if (m_pointsConfiguration.contains(i)) { const auto &conf = m_pointsConfiguration[i]; @@ -350,11 +420,6 @@ void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * } } - QRectF clipRect = QRectF(QPointF(0, 0), domain()->size()); - - painter->save(); - painter->setClipRect(clipRect); - if (m_series->bestFitLineVisible()) m_series->d_func()->drawBestFitLine(painter, clipRect); @@ -422,6 +487,7 @@ void ScatterChartItem::handleSeriesUpdated() m_pointsConfigurationDirty = m_series->pointsConfiguration() != m_pointsConfiguration; bool recreate = m_visible != m_series->isVisible() + || m_pointsVisible != m_series->pointsVisible() || m_markerSize != m_series->markerSize() || m_markerShape != m_series->markerShape() || m_selectedColor != m_series->selectedColor() @@ -432,6 +498,7 @@ void ScatterChartItem::handleSeriesUpdated() m_markerShape = m_series->markerShape(); setVisible(m_visible); setOpacity(m_series->opacity()); + m_pointsVisible = m_series->pointsVisible(); m_pointLabelsFormat = m_series->pointLabelsFormat(); m_pointLabelsVisible = m_series->pointLabelsVisible(); m_pointLabelsFont = m_series->pointLabelsFont(); @@ -451,6 +518,12 @@ void ScatterChartItem::handleSeriesUpdated() updateGeometry(); } + // Only accept hover events when light/selection markers are in use so we don't unnecessarily + // eat the events in the regular case + setAcceptHoverEvents(!(m_series->lightMarker().isNull() + && (m_series->selectedLightMarker().isNull() + || m_series->selectedPoints().isEmpty()))); + setPen(m_series->pen()); setBrush(m_series->brush()); // Update whole chart in case label clipping changed as labels can be outside series area diff --git a/src/charts/scatterchart/scatterchartitem_p.h b/src/charts/scatterchart/scatterchartitem_p.h index 1770d043..93969173 100644 --- a/src/charts/scatterchart/scatterchartitem_p.h +++ b/src/charts/scatterchart/scatterchartitem_p.h @@ -85,6 +85,10 @@ private: protected: void updateGeometry() override; + void mousePressEvent(QGraphicsSceneMouseEvent *event) override; + void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override; + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override; private: QScatterSeries *m_series; @@ -94,6 +98,7 @@ private: QRectF m_rect; QMap<QGraphicsItem *, QPointF> m_markerMap; + bool m_pointsVisible; bool m_pointLabelsVisible; qreal m_markerSize; QString m_pointLabelsFormat; @@ -101,6 +106,8 @@ private: QColor m_pointLabelsColor; bool m_pointLabelsClipping; + QPointF m_lastHoveredPoint; + QPointF m_lastMousePos; bool m_mousePressed; }; diff --git a/src/charts/splinechart/qsplineseries.cpp b/src/charts/splinechart/qsplineseries.cpp index a57b6097..26686717 100644 --- a/src/charts/splinechart/qsplineseries.cpp +++ b/src/charts/splinechart/qsplineseries.cpp @@ -173,7 +173,7 @@ void QSplineSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool fo void QSplineSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve) { - SplineChartItem *item = static_cast<SplineChartItem *>(m_item.data()); + SplineChartItem *item = static_cast<SplineChartItem *>(m_item.get()); Q_ASSERT(item); if (item->animation()) item->animation()->stopAndDestroyLater(); diff --git a/src/charts/splinechart/splinechartitem.cpp b/src/charts/splinechart/splinechartitem.cpp index 7e0601e4..4dba01f2 100644 --- a/src/charts/splinechart/splinechartitem.cpp +++ b/src/charts/splinechart/splinechartitem.cpp @@ -56,6 +56,7 @@ SplineChartItem::SplineChartItem(QSplineSeries *series, QGraphicsItem *item) connect(m_series->d_func(), &QXYSeriesPrivate::seriesUpdated, this, &SplineChartItem::handleSeriesUpdated); connect(series, &QXYSeries::lightMarkerChanged, this, &SplineChartItem::handleSeriesUpdated); + connect(series, &QXYSeries::selectedLightMarkerChanged, this, &SplineChartItem::handleSeriesUpdated); connect(series, &QXYSeries::markerSizeChanged, this, &SplineChartItem::handleSeriesUpdated); connect(series, &QXYSeries::visibleChanged, this, &SplineChartItem::handleSeriesUpdated); connect(series, &QXYSeries::opacityChanged, this, &SplineChartItem::handleSeriesUpdated); @@ -69,8 +70,13 @@ SplineChartItem::SplineChartItem(QSplineSeries *series, QGraphicsItem *item) this, &SplineChartItem::handleSeriesUpdated); connect(series, &QXYSeries::pointLabelsClippingChanged, this, &SplineChartItem::handleSeriesUpdated); + connect(series, &QSplineSeries::selectedColorChanged, + this, &SplineChartItem::handleSeriesUpdated); connect(series, &QLineSeries::selectedPointsChanged, this, &SplineChartItem::handleSeriesUpdated); + connect(series, &QSplineSeries::pointsConfigurationChanged, + this, &SplineChartItem::handleSeriesUpdated); + handleSeriesUpdated(); } @@ -316,7 +322,8 @@ void SplineChartItem::updateGeometry() // For mouse interactivity, we have to add the rects *after* the 'createStroke', // as we don't need the outline - we need it filled up. - if (!m_series->lightMarker().isNull()) { + if (!m_series->lightMarker().isNull() || (!m_series->selectedLightMarker().isNull() + && !m_series->selectedPoints().isEmpty())) { // +1, +2: a margin to guarantee we cover all of the pixmap qreal markerHalfSize = (m_series->markerSize() / 2.0) + 1; qreal markerSize = m_series->markerSize() + 2; @@ -452,6 +459,8 @@ void SplineChartItem::handleSeriesUpdated() m_markerSize = m_series->markerSize(); m_pointLabelsFont = m_series->pointLabelsFont(); m_pointLabelsColor = m_series->pointLabelsColor(); + m_selectedPoints = m_series->selectedPoints(); + m_selectedColor = m_series->selectedColor(); bool labelClippingChanged = m_pointLabelsClipping != m_series->pointLabelsClipping(); m_pointLabelsClipping = m_series->pointLabelsClipping(); // Update whole chart in case label clipping changed as labels can be outside series area @@ -495,18 +504,12 @@ void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o painter->drawPath(m_path); - if (m_pointsVisible) { - painter->setPen(m_pointPen); - if (m_series->chart()->chartType() == QChart::ChartTypePolar) - painter->drawPoints(m_visiblePoints); - else - painter->drawPoints(geometryPoints()); - } - int pointLabelsOffset = m_linePen.width() / 2; - // Draw markers if a marker has been set (set to QImage() to disable) - if (!m_series->lightMarker().isNull()) { + // Draw markers if a marker or marker for selected points only has been + // set (set to QImage() to disable) + if (!m_series->lightMarker().isNull() || (!m_series->selectedLightMarker().isNull() + && !m_series->selectedPoints().isEmpty())) { const QImage &marker = m_series->lightMarker(); const QImage &selectedMarker = m_series->selectedLightMarker(); qreal markerHalfSize = m_markerSize / 2.0; @@ -517,7 +520,7 @@ void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o // light markers are independent features. Therefore m_pointsVisible // is not used here as light markers are drawn if lightMarker is not null. // However points visibility configuration can be still used here. - bool drawPoint = true; + bool drawPoint = !m_series->lightMarker().isNull(); if (m_pointsConfiguration.contains(i)) { const auto &conf = m_pointsConfiguration[i]; @@ -549,6 +552,65 @@ void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o m_series->d_func()->drawSeriesPointLabels(painter, m_points, pointLabelsOffset); } + painter->setPen(m_pointPen); + if (m_series->chart()->chartType() == QChart::ChartTypePolar && m_pointsVisible) { + painter->drawPoints(m_visiblePoints); + } else { + const bool simpleDraw = m_selectedPoints.isEmpty() && m_pointsConfiguration.isEmpty(); + painter->setPen(Qt::NoPen); + painter->setBrush(m_linePen.color()); + painter->setClipping(true); + + if (m_pointsVisible && simpleDraw && m_series->lightMarker().isNull()) { + for (int i = 0; i < m_points.size(); ++i) + painter->drawEllipse(m_points.at(i), m_markerSize, m_markerSize); + } else if (!simpleDraw) { + qreal ptSize = m_markerSize; + for (int i = 0; i < m_points.size(); ++i) { + if (clipRect.contains(m_points.at(i))) { + painter->save(); + ptSize = m_markerSize; + bool drawPoint = m_pointsVisible && m_series->lightMarker().isNull(); + if (m_pointsConfiguration.contains(i)) { + const auto &conf = m_pointsConfiguration[i]; + if (conf.contains(QXYSeries::PointConfiguration::Visibility)) { + drawPoint = + m_pointsConfiguration[i][QXYSeries::PointConfiguration::Visibility] + .toBool(); + } + + if (drawPoint) { + if (conf.contains(QXYSeries::PointConfiguration::Size)) { + ptSize = m_pointsConfiguration[i][QXYSeries::PointConfiguration::Size] + .toReal(); + } + + if (conf.contains(QXYSeries::PointConfiguration::Color)) { + painter->setBrush( + m_pointsConfiguration[i][QXYSeries::PointConfiguration::Color] + .value<QColor>()); + } + } + } + + if (m_series->isPointSelected(i)) { + // Selected points are drawn regardless of m_pointsVisible settings and + // custom point configuration. However, they are not drawn if light markers + // are used. The reason of this is to avoid displaying selected point + // over selected light marker. + drawPoint = m_series->selectedLightMarker().isNull(); + ptSize = ptSize * 1.5; + if (m_selectedColor.isValid()) + painter->setBrush(m_selectedColor); + } + + if (drawPoint) + painter->drawEllipse(m_points.at(i), ptSize, ptSize); + painter->restore(); + } + } + } + } painter->restore(); } diff --git a/src/charts/xychart/qxymodelmapper.cpp b/src/charts/xychart/qxymodelmapper.cpp index 82e3875c..c1589d74 100644 --- a/src/charts/xychart/qxymodelmapper.cpp +++ b/src/charts/xychart/qxymodelmapper.cpp @@ -367,31 +367,32 @@ void QXYModelMapperPrivate::modelUpdated(QModelIndex topLeft, QModelIndex bottom blockSeriesSignals(); QModelIndex index; - QPointF oldPoint; QPointF newPoint; + int indexColumn = 0; + int indexRow = 0; for (int row = topLeft.row(); row <= bottomRight.row(); row++) { for (int column = topLeft.column(); column <= bottomRight.column(); column++) { index = topLeft.sibling(row, column); - if (m_orientation == Qt::Vertical && (index.column() == m_xSection || index.column() == m_ySection)) { - if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) { - QModelIndex xIndex = xModelIndex(index.row() - m_first); - QModelIndex yIndex = yModelIndex(index.row() - m_first); + indexColumn = index.column(); + indexRow = index.row(); + if (m_orientation == Qt::Vertical && (indexColumn == m_xSection || indexColumn == m_ySection)) { + if (indexRow >= m_first && (m_count == - 1 || indexRow < m_first + m_count)) { + QModelIndex xIndex = xModelIndex(indexRow - m_first); + QModelIndex yIndex = yModelIndex(indexRow - m_first); if (xIndex.isValid() && yIndex.isValid()) { - oldPoint = m_series->points().at(index.row() - m_first); newPoint.setX(valueFromModel(xIndex)); newPoint.setY(valueFromModel(yIndex)); - m_series->replace(index.row() - m_first, newPoint); + m_series->replace(indexRow - m_first, newPoint); } } - } else if (m_orientation == Qt::Horizontal && (index.row() == m_xSection || index.row() == m_ySection)) { - if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count)) { - QModelIndex xIndex = xModelIndex(index.column() - m_first); - QModelIndex yIndex = yModelIndex(index.column() - m_first); + } else if (m_orientation == Qt::Horizontal && (indexRow == m_xSection || indexRow == m_ySection)) { + if (indexColumn >= m_first && (m_count == - 1 || indexColumn < m_first + m_count)) { + QModelIndex xIndex = xModelIndex(indexColumn - m_first); + QModelIndex yIndex = yModelIndex(indexColumn - m_first); if (xIndex.isValid() && yIndex.isValid()) { - oldPoint = m_series->points().at(index.column() - m_first); newPoint.setX(valueFromModel(xIndex)); newPoint.setY(valueFromModel(yIndex)); - m_series->replace(index.column() - m_first, newPoint); + m_series->replace(indexColumn - m_first, newPoint); } } } diff --git a/src/charts/xychart/qxyseries.cpp b/src/charts/xychart/qxyseries.cpp index 9c30b1e4..eabca0b2 100644 --- a/src/charts/xychart/qxyseries.cpp +++ b/src/charts/xychart/qxyseries.cpp @@ -537,7 +537,7 @@ QT_BEGIN_NAMESPACE /*! \fn void QXYSeries::lightMarkerChanged(const QImage &lightMarker) This signal is emitted when the light marker image changes to \a lightMarker. - \sa QXYSeries::setLightMarker(); + \sa QXYSeries::setLightMarker() \since 6.2 */ @@ -1585,12 +1585,12 @@ const QImage &QXYSeries::lightMarker() const /*! Sets the image used for drawing markers on selected series's points to \a selectedLightMarker. - The default value is QImage(), meaning usual QXYSeries::lightMarker() will be painted. + The default value is QImage(), meaning usual lightMarker() will be painted. - This is an equivalent for QXYSeries::setSelectedColor() if you prefer light markers over - normal points, but you still want to distinguish selected points. + This is an equivalent for \l{selectedColor} if you prefer light markers over + normal points, but still want to distinguish selected points. - \sa QXYSeries::lightMarker(), QXYSeries::selectedColor(), QXYSeries::setPointSelected() + \sa lightMarker(), selectedColor, setPointSelected() \since 6.2 */ void QXYSeries::setSelectedLightMarker(const QImage &selectedLightMarker) @@ -1605,14 +1605,14 @@ void QXYSeries::setSelectedLightMarker(const QImage &selectedLightMarker) } /*! - Returns the image used for drawing markers on selected series's points. + Returns the image used for drawing markers on selected series' points. - The default value is QImage(), meaning usual QXYSeries::lightMarker() will be painted. + The default value is QImage(), meaning usual lightMarker() will be painted. - This is an equivalent for QXYSeries::selectedColor() if you prefer light markers over - normal points, but you still want to distinguish selected points. + This is equivalent to \l{selectedColor} if you prefer light markers over + normal points, but still want to distinguish selected points. - \sa QXYSeries::lightMarker(), QXYSeries::selectedColor(), QXYSeries::setPointSelected() + \sa lightMarker(), selectedColor, setPointSelected() \since 6.2 */ const QImage &QXYSeries::selectedLightMarker() const @@ -1622,7 +1622,7 @@ const QImage &QXYSeries::selectedLightMarker() const } /*! - Sets the size of the marker used to render points in the series. + Sets the \a size of the marker used to render points in the series. The default size is 15.0. \sa QScatterSeries::markerSize @@ -1809,7 +1809,7 @@ QAbstractAxis* QXYSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) void QXYSeriesPrivate::initializeAnimations(QChart::AnimationOptions options, int duration, QEasingCurve &curve) { - XYChart *item = static_cast<XYChart *>(m_item.data()); + XYChart *item = static_cast<XYChart *>(m_item.get()); Q_ASSERT(item); if (item->animation()) item->animation()->stopAndDestroyLater(); @@ -1907,13 +1907,18 @@ void QXYSeriesPrivate::drawBestFitLine(QPainter *painter, const QRectF &clipRect if (!ok) return; - const qreal x1 = clipRect.x(); + auto *domain = this->domain(); + const auto clipOriginX = domain->isReverseX() ? clipRect.right() : clipRect.left(); + const auto clipOriginY = domain->isReverseY() ? clipRect.top() : clipRect.bottom(); + const auto domainOrigin = domain->calculateDomainPoint({clipOriginX, clipOriginY}); + + const qreal x1 = domainOrigin.x(); const qreal y1 = bestFitLineParams.first * x1 + bestFitLineParams.second; - QPointF p1 = domain()->calculateGeometryPoint(QPointF(x1, y1), ok); + QPointF p1 = domain->calculateGeometryPoint(QPointF(x1, y1), ok); - const qreal x2 = clipRect.x() + 1; + const qreal x2 = domainOrigin.x() + 1; const qreal y2 = bestFitLineParams.first * x2 + bestFitLineParams.second; - QPointF p2 = domain()->calculateGeometryPoint(QPointF(x2, y2), ok); + QPointF p2 = domain->calculateGeometryPoint(QPointF(x2, y2), ok); if (ok) { QLineF bestFitLine { p1, p2 }; diff --git a/src/charts/xychart/xychart.cpp b/src/charts/xychart/xychart.cpp index 7eda3819..f09c2d66 100644 --- a/src/charts/xychart/xychart.cpp +++ b/src/charts/xychart/xychart.cpp @@ -258,13 +258,23 @@ bool XYChart::isEmpty() QPointF XYChart::matchForLightMarker(const QPointF &eventPos) { - if (m_series->lightMarker().isNull()) + if (m_series->lightMarker().isNull() + && (m_series->selectedLightMarker().isNull() + || m_series->selectedPoints().isEmpty())) return QPointF(qQNaN(), qQNaN()); // 0,0 could actually be in points() - int markerWidth = m_series->lightMarker().width(); - int markerHeight = m_series->lightMarker().height(); + const bool useSelectedMarker = m_series->lightMarker().isNull(); - for (const QPointF &dp : m_series->points()) { + QList<QPointF> points; + if (useSelectedMarker) { + const auto selectedPoints = m_series->selectedPoints(); + for (const int &selectedPointIndex : selectedPoints) + points << m_series->at(selectedPointIndex); + } else { + points = m_series->points(); + } + + for (const QPointF &dp : points) { bool ok; const QPointF gp = domain()->calculateGeometryPoint(dp, ok); if (ok) { @@ -274,9 +284,9 @@ QPointF XYChart::matchForLightMarker(const QPointF &eventPos) // but as there is a bunch of 'translations' and therefore inaccuracies, // so it is necessary to increase that margin to 2 // (otherwise you can click next to an icon, get a click event but not match it) - QRectF r(gp.x() - (markerWidth / 2 + 2), - gp.y() - (markerHeight / 2 + 2), - markerWidth + 4, markerHeight + 4); + QRectF r(gp.x() - (m_series->markerSize() / 2 + 2), + gp.y() - (m_series->markerSize() / 2 + 2), + m_series->markerSize() + 4, m_series->markerSize() + 4); if (r.contains(eventPos)) return dp; diff --git a/src/chartsqml2/declarativechart.cpp b/src/chartsqml2/declarativechart.cpp index 67bf1864..8a55feb4 100644 --- a/src/chartsqml2/declarativechart.cpp +++ b/src/chartsqml2/declarativechart.cpp @@ -70,6 +70,7 @@ #include <QtCore/QTimer> #include <QtCore/QThread> #include <QtQuick/QQuickWindow> +#include <QtWidgets/QGraphicsLayout> #if QT_CONFIG(charts_datetime_axis) #include <QtCharts/QDateTimeAxis> @@ -79,7 +80,6 @@ QT_BEGIN_NAMESPACE /*! \qmltype ChartView - \instantiates DeclarativeChart \inqmlmodule QtCharts \brief Manages the graphical representation of the chart's series, legends, @@ -652,9 +652,12 @@ void DeclarativeChart::seriesAxisAttachHelper(QAbstractSeries *series, QAbstract { if (!series->attachedAxes().contains(axis)) { // Remove & delete old axes that are not attached to any other series + // Detach old axis from series so that if it is shared with other series + // It can be deleted. foreach (QAbstractAxis* oldAxis, m_chart->axes(orientation, series)) { bool otherAttachments = false; if (oldAxis != axis) { + series->detachAxis(oldAxis); foreach (QAbstractSeries *oldSeries, m_chart->series()) { if (oldSeries != series && oldSeries->attachedAxes().contains(oldAxis)) { otherAttachments = true; @@ -1551,6 +1554,10 @@ QPointF DeclarativeChart::mapToPosition(const QPointF &value, QAbstractSeries *s void DeclarativeChart::setPlotArea(const QRectF &rect) { m_chart->setPlotArea(rect); + + // If plotArea is set inside ChartView, contentGeometry is updated too early and we end up + // with incorrect plotArea. Invalidate the layout to correct the geometry. + m_chart->layout()->invalidate(); } QT_END_NAMESPACE diff --git a/src/chartsqml2/declarativeopenglrendernode.cpp b/src/chartsqml2/declarativeopenglrendernode.cpp index 89629f3d..c3857d30 100644 --- a/src/chartsqml2/declarativeopenglrendernode.cpp +++ b/src/chartsqml2/declarativeopenglrendernode.cpp @@ -393,6 +393,8 @@ void DeclarativeOpenGLRenderNode::renderVisual() // Must be called on render thread as response to beforeRendering signal void DeclarativeOpenGLRenderNode::render() { + // Reset blend function, etc. derived from the previous frame. + QQuickOpenGLUtils::resetOpenGLState(); if (m_renderNeeded) { if (m_xyDataMap.size()) { if (!m_program) diff --git a/src/chartsqml2/declarativepolarchart.cpp b/src/chartsqml2/declarativepolarchart.cpp index ba35256a..2f1431d1 100644 --- a/src/chartsqml2/declarativepolarchart.cpp +++ b/src/chartsqml2/declarativepolarchart.cpp @@ -35,7 +35,6 @@ QT_BEGIN_NAMESPACE /*! \qmltype PolarChartView \inherits ChartView - \instantiates DeclarativePolarChart \inqmlmodule QtCharts \brief Presents data in polar charts. diff --git a/src/chartsqml2/designer/CMakeLists.txt b/src/chartsqml2/designer/CMakeLists.txt index 42115e7b..b0f18096 100644 --- a/src/chartsqml2/designer/CMakeLists.txt +++ b/src/chartsqml2/designer/CMakeLists.txt @@ -1,8 +1,9 @@ +qt_path_join(destination ${QT_INSTALL_DIR} "${INSTALL_QMLDIR}/QtCharts/designer") qt_copy_or_install( FILES ChartViewSpecifics.qml qtcharts.metainfo - DESTINATION "${INSTALL_QMLDIR}/QtCharts/designer" + DESTINATION ${destination} ) add_subdirectory(default) diff --git a/src/chartsqml2/designer/default/CMakeLists.txt b/src/chartsqml2/designer/default/CMakeLists.txt index ccf366d8..dc2c2dda 100644 --- a/src/chartsqml2/designer/default/CMakeLists.txt +++ b/src/chartsqml2/designer/default/CMakeLists.txt @@ -1,3 +1,4 @@ +qt_path_join(destination ${QT_INSTALL_DIR} "${INSTALL_QMLDIR}/QtCharts/designer/default") qt_copy_or_install( FILES AreaSeries.qml @@ -16,5 +17,5 @@ qt_copy_or_install( PolarLineSeries.qml PolarScatterSeries.qml PolarSplineSeries.qml - DESTINATION "${INSTALL_QMLDIR}/QtCharts/designer/default" + DESTINATION "${destination}" ) diff --git a/src/chartsqml2/designer/images/CMakeLists.txt b/src/chartsqml2/designer/images/CMakeLists.txt index 0487f007..ec85d9c7 100644 --- a/src/chartsqml2/designer/images/CMakeLists.txt +++ b/src/chartsqml2/designer/images/CMakeLists.txt @@ -1,3 +1,4 @@ +qt_path_join(destination ${QT_INSTALL_DIR} "${INSTALL_QMLDIR}/QtCharts/designer/images") qt_copy_or_install( FILES areaseries-chart-icon.png @@ -32,5 +33,5 @@ qt_copy_or_install( scatterseries-polar-icon16.png splineseries-polar-icon.png splineseries-polar-icon16.png - DESTINATION "${INSTALL_QMLDIR}/QtCharts/designer/images" + DESTINATION "${destination}" ) diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt index 032035cb..13344dc1 100644 --- a/tests/auto/CMakeLists.txt +++ b/tests/auto/CMakeLists.txt @@ -23,7 +23,7 @@ add_subdirectory(qcategoryaxis) add_subdirectory(qbarcategoryaxis) add_subdirectory(qlegend) add_subdirectory(qareaseries) -# add_subdirectory(cmake) # special case +add_subdirectory(cmake) add_subdirectory(qcandlestickmodelmapper) add_subdirectory(qcandlestickseries) add_subdirectory(qcandlestickset) diff --git a/tests/auto/chartdataset/CMakeLists.txt b/tests/auto/chartdataset/CMakeLists.txt index d14bc68a..63988767 100644 --- a/tests/auto/chartdataset/CMakeLists.txt +++ b/tests/auto/chartdataset/CMakeLists.txt @@ -4,7 +4,7 @@ ## chartdataset Test: ##################################################################### -qt_internal_add_test(chartdataset +qt_internal_add_test(tst_chartdataset SOURCES ../inc/tst_definitions.h tst_chartdataset.cpp diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index 7f772845..90b239a7 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -1,14 +1,44 @@ +# This is an automatic test for the CMake configuration files. +# To run it manually, +# 1) mkdir build # Create a build directory +# 2) cd build +# 3) # Run cmake on this directory +# `$qt_prefix/bin/qt-cmake ..` or `cmake -DCMAKE_PREFIX_PATH=/path/to/qt ..` +# 4) ctest # Run ctest -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.16) +project(charts_cmake_tests) +enable_testing() -project(qmake_cmake_files) +set(required_packages Core Charts) -enable_testing() +# Setup the test when called as a completely standalone project. +if(TARGET Qt6::Core) + # Tests are built as part of the repository's build tree. + # Setup paths so that the Qt packages are found. + qt_internal_set_up_build_dir_package_paths() +endif() + +find_package(Qt6 REQUIRED COMPONENTS ${required_packages}) -find_package(Qt5Core REQUIRED) +# Setup common test variables which were previously set by ctest_testcase_common.prf. +set(CMAKE_MODULES_UNDER_TEST "${required_packages}") -include("${_Qt5CTestMacros}") +foreach(qt_package ${CMAKE_MODULES_UNDER_TEST}) + set(package_name "${QT_CMAKE_EXPORT_NAMESPACE}${qt_package}") + if(${package_name}_FOUND) + set(CMAKE_${qt_package}_MODULE_MAJOR_VERSION "${${package_name}_VERSION_MAJOR}") + set(CMAKE_${qt_package}_MODULE_MINOR_VERSION "${${package_name}_VERSION_MINOR}") + set(CMAKE_${qt_package}_MODULE_PATCH_VERSION "${${package_name}_VERSION_PATCH}") + endif() +endforeach() + +include("${_Qt6CTestMacros}") + +set(module_includes + Charts QChartView +) -test_module_includes( - Charts QChartView +_qt_internal_test_module_includes( + ${module_includes} ) diff --git a/tests/auto/domain/CMakeLists.txt b/tests/auto/domain/CMakeLists.txt index 6fbcaed6..870d286c 100644 --- a/tests/auto/domain/CMakeLists.txt +++ b/tests/auto/domain/CMakeLists.txt @@ -4,7 +4,7 @@ ## domain Test: ##################################################################### -qt_internal_add_test(domain +qt_internal_add_test(tst_domain SOURCES ../inc/tst_definitions.h tst_domain.cpp diff --git a/tests/auto/qareaseries/BLACKLIST b/tests/auto/qareaseries/BLACKLIST index 2f0ae955..996d7802 100644 --- a/tests/auto/qareaseries/BLACKLIST +++ b/tests/auto/qareaseries/BLACKLIST @@ -1,2 +1,6 @@ [dynamicEdgeSeriesChange] msvc-2019 +# QTBUG-102722 +android +[areaSeries] +android diff --git a/tests/auto/qareaseries/CMakeLists.txt b/tests/auto/qareaseries/CMakeLists.txt index e7410fda..500ceb52 100644 --- a/tests/auto/qareaseries/CMakeLists.txt +++ b/tests/auto/qareaseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qareaseries Test: ##################################################################### -qt_internal_add_test(qareaseries +qt_internal_add_test(tst_qareaseries SOURCES ../inc/tst_definitions.h tst_qareaseries.cpp diff --git a/tests/auto/qbarcategoryaxis/CMakeLists.txt b/tests/auto/qbarcategoryaxis/CMakeLists.txt index fa1d31cb..89189977 100644 --- a/tests/auto/qbarcategoryaxis/CMakeLists.txt +++ b/tests/auto/qbarcategoryaxis/CMakeLists.txt @@ -4,7 +4,7 @@ ## qbarcategoryaxis Test: ##################################################################### -qt_internal_add_test(qbarcategoryaxis +qt_internal_add_test(tst_qbarcategoryaxis SOURCES ../inc/tst_definitions.h ../qabstractaxis/tst_qabstractaxis.cpp ../qabstractaxis/tst_qabstractaxis.h diff --git a/tests/auto/qbarmodelmapper/CMakeLists.txt b/tests/auto/qbarmodelmapper/CMakeLists.txt index 8a3d4aec..1e1a2c94 100644 --- a/tests/auto/qbarmodelmapper/CMakeLists.txt +++ b/tests/auto/qbarmodelmapper/CMakeLists.txt @@ -4,7 +4,7 @@ ## qbarmodelmapper Test: ##################################################################### -qt_internal_add_test(qbarmodelmapper +qt_internal_add_test(tst_qbarmodelmapper SOURCES ../inc/tst_definitions.h tst_qbarmodelmapper.cpp diff --git a/tests/auto/qbarseries/CMakeLists.txt b/tests/auto/qbarseries/CMakeLists.txt index 3bad94b7..29aa4345 100644 --- a/tests/auto/qbarseries/CMakeLists.txt +++ b/tests/auto/qbarseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qbarseries Test: ##################################################################### -qt_internal_add_test(qbarseries +qt_internal_add_test(tst_qbarseries SOURCES ../inc/tst_definitions.h tst_qbarseries.cpp diff --git a/tests/auto/qbarseries/tst_qbarseries.cpp b/tests/auto/qbarseries/tst_qbarseries.cpp index d2c0cdc2..7dbde4d4 100644 --- a/tests/auto/qbarseries/tst_qbarseries.cpp +++ b/tests/auto/qbarseries/tst_qbarseries.cpp @@ -649,6 +649,9 @@ void tst_QBarSeries::mousehovered() { QFETCH(uint, labelsPosition); QFETCH(bool, labelsVisible); +#ifdef Q_OS_ANDROID + QSKIP("Android emulator doesn't have a mouse enabled"); +#endif QBarSeries* series = new QBarSeries(); series->setLabelsVisible(labelsVisible); diff --git a/tests/auto/qbarset/CMakeLists.txt b/tests/auto/qbarset/CMakeLists.txt index 842168bb..bcacb6e1 100644 --- a/tests/auto/qbarset/CMakeLists.txt +++ b/tests/auto/qbarset/CMakeLists.txt @@ -4,7 +4,7 @@ ## qbarset Test: ##################################################################### -qt_internal_add_test(qbarset +qt_internal_add_test(tst_qbarset SOURCES ../inc/tst_definitions.h tst_qbarset.cpp diff --git a/tests/auto/qcandlestickmodelmapper/CMakeLists.txt b/tests/auto/qcandlestickmodelmapper/CMakeLists.txt index 89893b90..1260bee1 100644 --- a/tests/auto/qcandlestickmodelmapper/CMakeLists.txt +++ b/tests/auto/qcandlestickmodelmapper/CMakeLists.txt @@ -4,7 +4,7 @@ ## qcandlestickmodelmapper Test: ##################################################################### -qt_internal_add_test(qcandlestickmodelmapper +qt_internal_add_test(tst_qcandlestickmodelmapper SOURCES ../inc/tst_definitions.h tst_qcandlestickmodelmapper.cpp diff --git a/tests/auto/qcandlestickseries/CMakeLists.txt b/tests/auto/qcandlestickseries/CMakeLists.txt index 66eca374..430744c7 100644 --- a/tests/auto/qcandlestickseries/CMakeLists.txt +++ b/tests/auto/qcandlestickseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qcandlestickseries Test: ##################################################################### -qt_internal_add_test(qcandlestickseries +qt_internal_add_test(tst_qcandlestickseries SOURCES ../inc/tst_definitions.h tst_qcandlestickseries.cpp diff --git a/tests/auto/qcandlestickset/CMakeLists.txt b/tests/auto/qcandlestickset/CMakeLists.txt index c4376efa..4728a9b6 100644 --- a/tests/auto/qcandlestickset/CMakeLists.txt +++ b/tests/auto/qcandlestickset/CMakeLists.txt @@ -4,7 +4,7 @@ ## qcandlestickset Test: ##################################################################### -qt_internal_add_test(qcandlestickset +qt_internal_add_test(tst_qcandlestickset SOURCES ../inc/tst_definitions.h tst_qcandlestickset.cpp diff --git a/tests/auto/qcategoryaxis/CMakeLists.txt b/tests/auto/qcategoryaxis/CMakeLists.txt index a3e2a6e8..1574866c 100644 --- a/tests/auto/qcategoryaxis/CMakeLists.txt +++ b/tests/auto/qcategoryaxis/CMakeLists.txt @@ -4,7 +4,7 @@ ## qcategoryaxis Test: ##################################################################### -qt_internal_add_test(qcategoryaxis +qt_internal_add_test(tst_qcategoryaxis SOURCES ../inc/tst_definitions.h ../qabstractaxis/tst_qabstractaxis.cpp ../qabstractaxis/tst_qabstractaxis.h diff --git a/tests/auto/qchart/CMakeLists.txt b/tests/auto/qchart/CMakeLists.txt index dc81bc8c..3702470d 100644 --- a/tests/auto/qchart/CMakeLists.txt +++ b/tests/auto/qchart/CMakeLists.txt @@ -4,7 +4,7 @@ ## qchart Test: ##################################################################### -qt_internal_add_test(qchart +qt_internal_add_test(tst_qchart SOURCES ../inc/tst_definitions.h tst_qchart.cpp diff --git a/tests/auto/qchartview/CMakeLists.txt b/tests/auto/qchartview/CMakeLists.txt index fca5fc13..c6c669ec 100644 --- a/tests/auto/qchartview/CMakeLists.txt +++ b/tests/auto/qchartview/CMakeLists.txt @@ -4,7 +4,7 @@ ## qchartview Test: ##################################################################### -qt_internal_add_test(qchartview +qt_internal_add_test(tst_qchartview SOURCES ../inc/tst_definitions.h tst_qchartview.cpp diff --git a/tests/auto/qdatetimeaxis/CMakeLists.txt b/tests/auto/qdatetimeaxis/CMakeLists.txt index e5b277b9..2c30c2e4 100644 --- a/tests/auto/qdatetimeaxis/CMakeLists.txt +++ b/tests/auto/qdatetimeaxis/CMakeLists.txt @@ -4,7 +4,7 @@ ## qdatetimeaxis Test: ##################################################################### -qt_internal_add_test(qdatetimeaxis +qt_internal_add_test(tst_qdatetimeaxis SOURCES ../inc/tst_definitions.h ../qabstractaxis/tst_qabstractaxis.cpp ../qabstractaxis/tst_qabstractaxis.h diff --git a/tests/auto/qhorizontalbarseries/CMakeLists.txt b/tests/auto/qhorizontalbarseries/CMakeLists.txt index 19cea05d..3c2fef19 100644 --- a/tests/auto/qhorizontalbarseries/CMakeLists.txt +++ b/tests/auto/qhorizontalbarseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qhorizontalbarseries Test: ##################################################################### -qt_internal_add_test(qhorizontalbarseries +qt_internal_add_test(tst_qhorizontalbarseries SOURCES ../inc/tst_definitions.h tst_qhorizontalbarseries.cpp diff --git a/tests/auto/qhorizontalpercentbarseries/CMakeLists.txt b/tests/auto/qhorizontalpercentbarseries/CMakeLists.txt index cc630fc7..7102a26c 100644 --- a/tests/auto/qhorizontalpercentbarseries/CMakeLists.txt +++ b/tests/auto/qhorizontalpercentbarseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qhorizontalpercentbarseries Test: ##################################################################### -qt_internal_add_test(qhorizontalpercentbarseries +qt_internal_add_test(tst_qhorizontalpercentbarseries SOURCES ../inc/tst_definitions.h tst_qhorizontalpercentbarseries.cpp diff --git a/tests/auto/qhorizontalstackedbarseries/CMakeLists.txt b/tests/auto/qhorizontalstackedbarseries/CMakeLists.txt index 6871a178..706841e4 100644 --- a/tests/auto/qhorizontalstackedbarseries/CMakeLists.txt +++ b/tests/auto/qhorizontalstackedbarseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qhorizontalstackedbarseries Test: ##################################################################### -qt_internal_add_test(qhorizontalstackedbarseries +qt_internal_add_test(tst_qhorizontalstackedbarseries SOURCES ../inc/tst_definitions.h tst_qhorizontalstackedbarseries.cpp diff --git a/tests/auto/qlegend/CMakeLists.txt b/tests/auto/qlegend/CMakeLists.txt index 01566eee..c199288a 100644 --- a/tests/auto/qlegend/CMakeLists.txt +++ b/tests/auto/qlegend/CMakeLists.txt @@ -4,7 +4,7 @@ ## qlegend Test: ##################################################################### -qt_internal_add_test(qlegend +qt_internal_add_test(tst_qlegend SOURCES ../inc/tst_definitions.h tst_qlegend.cpp diff --git a/tests/auto/qlineseries/CMakeLists.txt b/tests/auto/qlineseries/CMakeLists.txt index 152c36e0..75d9957a 100644 --- a/tests/auto/qlineseries/CMakeLists.txt +++ b/tests/auto/qlineseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qlineseries Test: ##################################################################### -qt_internal_add_test(qlineseries +qt_internal_add_test(tst_qlineseries SOURCES ../inc/tst_definitions.h ../qxyseries/tst_qxyseries.cpp ../qxyseries/tst_qxyseries.h diff --git a/tests/auto/qlogvalueaxis/CMakeLists.txt b/tests/auto/qlogvalueaxis/CMakeLists.txt index 6c6ff9f1..a6d524cd 100644 --- a/tests/auto/qlogvalueaxis/CMakeLists.txt +++ b/tests/auto/qlogvalueaxis/CMakeLists.txt @@ -4,7 +4,7 @@ ## qlogvalueaxis Test: ##################################################################### -qt_internal_add_test(qlogvalueaxis +qt_internal_add_test(tst_qlogvalueaxis SOURCES ../inc/tst_definitions.h ../qabstractaxis/tst_qabstractaxis.cpp ../qabstractaxis/tst_qabstractaxis.h diff --git a/tests/auto/qml-qtquicktest/CMakeLists.txt b/tests/auto/qml-qtquicktest/CMakeLists.txt index 50e48683..ad0462b7 100644 --- a/tests/auto/qml-qtquicktest/CMakeLists.txt +++ b/tests/auto/qml-qtquicktest/CMakeLists.txt @@ -3,20 +3,25 @@ ##################################################################### ## qml-qtquicktest Test: ##################################################################### +file(GLOB_RECURSE test_data_glob + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + data/*) +list(APPEND test_data ${test_data_glob}) -qt_internal_add_test(qml-qtquicktest +qt_internal_add_test(tst_qml-qtquicktest QMLTEST SOURCES ../inc/tst_definitions.h main.cpp DEFINES - QUICK_TEST_SOURCE_DIR=\"\\\"${CMAKE_CURRENT_SOURCE_DIR}\\\"\" + QUICK_TEST_SOURCE_DIR=\"\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"\" INCLUDE_DIRECTORIES ../inc PUBLIC_LIBRARIES Qt::Charts Qt::Gui Qt::Widgets + TESTDATA ${test_data} ) #### Keys ignored in scope 1:.:.:qml-qtquicktest.pro:<TRUE>: diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis.qml index f41fd9ec..f41fd9ec 100644 --- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis.qml diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis_1_1.qml index 65b9363f..65b9363f 100644 --- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_1.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis_1_1.qml diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis_1_2.qml index 78275c90..78275c90 100644 --- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_2.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis_1_2.qml diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis_1_3.qml index 5b919c37..5b919c37 100644 --- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_3.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis_1_3.qml diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_4.qml b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis_1_4.qml index af0cf521..af0cf521 100644 --- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_1_4.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis_1_4.qml diff --git a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_2_0.qml b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis_2_0.qml index 4a1b3dda..4a1b3dda 100644 --- a/tests/auto/qml-qtquicktest/tst_barcategoryaxis_2_0.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barcategoryaxis_2_0.qml diff --git a/tests/auto/qml-qtquicktest/tst_barseries.qml b/tests/auto/qml-qtquicktest/data/tst_barseries.qml index e3f085dc..e3f085dc 100644 --- a/tests/auto/qml-qtquicktest/tst_barseries.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barseries.qml diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml b/tests/auto/qml-qtquicktest/data/tst_barseries_1_1.qml index a9caa134..a9caa134 100644 --- a/tests/auto/qml-qtquicktest/tst_barseries_1_1.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barseries_1_1.qml diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_2.qml b/tests/auto/qml-qtquicktest/data/tst_barseries_1_2.qml index 1023af25..1023af25 100644 --- a/tests/auto/qml-qtquicktest/tst_barseries_1_2.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barseries_1_2.qml diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_3.qml b/tests/auto/qml-qtquicktest/data/tst_barseries_1_3.qml index 1e592389..1e592389 100644 --- a/tests/auto/qml-qtquicktest/tst_barseries_1_3.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barseries_1_3.qml diff --git a/tests/auto/qml-qtquicktest/tst_barseries_1_4.qml b/tests/auto/qml-qtquicktest/data/tst_barseries_1_4.qml index 0fd9d173..0fd9d173 100644 --- a/tests/auto/qml-qtquicktest/tst_barseries_1_4.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barseries_1_4.qml diff --git a/tests/auto/qml-qtquicktest/tst_barseries_2_0.qml b/tests/auto/qml-qtquicktest/data/tst_barseries_2_0.qml index f2b952a2..f2b952a2 100644 --- a/tests/auto/qml-qtquicktest/tst_barseries_2_0.qml +++ b/tests/auto/qml-qtquicktest/data/tst_barseries_2_0.qml diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries.qml b/tests/auto/qml-qtquicktest/data/tst_boxplotseries.qml index 06f01e20..06f01e20 100644 --- a/tests/auto/qml-qtquicktest/tst_boxplotseries.qml +++ b/tests/auto/qml-qtquicktest/data/tst_boxplotseries.qml diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml b/tests/auto/qml-qtquicktest/data/tst_boxplotseries_1_3.qml index 35606f75..35606f75 100644 --- a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_3.qml +++ b/tests/auto/qml-qtquicktest/data/tst_boxplotseries_1_3.qml diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_4.qml b/tests/auto/qml-qtquicktest/data/tst_boxplotseries_1_4.qml index 51014e11..51014e11 100644 --- a/tests/auto/qml-qtquicktest/tst_boxplotseries_1_4.qml +++ b/tests/auto/qml-qtquicktest/data/tst_boxplotseries_1_4.qml diff --git a/tests/auto/qml-qtquicktest/tst_boxplotseries_2_0.qml b/tests/auto/qml-qtquicktest/data/tst_boxplotseries_2_0.qml index 58711a8f..58711a8f 100644 --- a/tests/auto/qml-qtquicktest/tst_boxplotseries_2_0.qml +++ b/tests/auto/qml-qtquicktest/data/tst_boxplotseries_2_0.qml diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis.qml b/tests/auto/qml-qtquicktest/data/tst_categoryaxis.qml index 4e050652..4e050652 100644 --- a/tests/auto/qml-qtquicktest/tst_categoryaxis.qml +++ b/tests/auto/qml-qtquicktest/data/tst_categoryaxis.qml diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml b/tests/auto/qml-qtquicktest/data/tst_categoryaxis_1_1.qml index 8f57c1e2..8f57c1e2 100644 --- a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_1.qml +++ b/tests/auto/qml-qtquicktest/data/tst_categoryaxis_1_1.qml diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml b/tests/auto/qml-qtquicktest/data/tst_categoryaxis_1_2.qml index 36b95fae..36b95fae 100644 --- a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_2.qml +++ b/tests/auto/qml-qtquicktest/data/tst_categoryaxis_1_2.qml diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml b/tests/auto/qml-qtquicktest/data/tst_categoryaxis_1_3.qml index 0cf640a4..0cf640a4 100644 --- a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_3.qml +++ b/tests/auto/qml-qtquicktest/data/tst_categoryaxis_1_3.qml diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_4.qml b/tests/auto/qml-qtquicktest/data/tst_categoryaxis_1_4.qml index f724ff17..f724ff17 100644 --- a/tests/auto/qml-qtquicktest/tst_categoryaxis_1_4.qml +++ b/tests/auto/qml-qtquicktest/data/tst_categoryaxis_1_4.qml diff --git a/tests/auto/qml-qtquicktest/tst_categoryaxis_2_0.qml b/tests/auto/qml-qtquicktest/data/tst_categoryaxis_2_0.qml index 46fd16b7..46fd16b7 100644 --- a/tests/auto/qml-qtquicktest/tst_categoryaxis_2_0.qml +++ b/tests/auto/qml-qtquicktest/data/tst_categoryaxis_2_0.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartview.qml b/tests/auto/qml-qtquicktest/data/tst_chartview.qml index 1efc15e5..1efc15e5 100644 --- a/tests/auto/qml-qtquicktest/tst_chartview.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartview.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml b/tests/auto/qml-qtquicktest/data/tst_chartview_1_1.qml index e27e0166..e27e0166 100644 --- a/tests/auto/qml-qtquicktest/tst_chartview_1_1.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartview_1_1.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_2.qml b/tests/auto/qml-qtquicktest/data/tst_chartview_1_2.qml index b7395058..b7395058 100644 --- a/tests/auto/qml-qtquicktest/tst_chartview_1_2.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartview_1_2.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_3.qml b/tests/auto/qml-qtquicktest/data/tst_chartview_1_3.qml index fd3e0095..fd3e0095 100644 --- a/tests/auto/qml-qtquicktest/tst_chartview_1_3.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartview_1_3.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartview_1_4.qml b/tests/auto/qml-qtquicktest/data/tst_chartview_1_4.qml index 47d1b2ee..47d1b2ee 100644 --- a/tests/auto/qml-qtquicktest/tst_chartview_1_4.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartview_1_4.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartview_2_0.qml b/tests/auto/qml-qtquicktest/data/tst_chartview_2_0.qml index 6f67aae9..6f67aae9 100644 --- a/tests/auto/qml-qtquicktest/tst_chartview_2_0.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartview_2_0.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions.qml index 6319ac75..6319ac75 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions_1_1.qml index c17da908..c17da908 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_1.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions_1_1.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions_1_2.qml index 69880965..69880965 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_2.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions_1_2.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions_1_3.qml index cd94f3ed..cd94f3ed 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_3.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions_1_3.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_4.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions_1_4.qml index 8a4a14ab..8a4a14ab 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_1_4.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions_1_4.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_2_0.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions_2_0.qml index 46437cd5..46437cd5 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewfunctions_2_0.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewfunctions_2_0.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals.qml index a6ec1231..a6ec1231 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewsignals.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals_1_1.qml index ea6134da..ea6134da 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_1.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals_1_1.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals_1_2.qml index 4f0d6d86..4f0d6d86 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_2.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals_1_2.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals_1_3.qml index 8ce55897..8ce55897 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_3.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals_1_3.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_4.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals_1_4.qml index 0b9f451d..0b9f451d 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_1_4.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals_1_4.qml diff --git a/tests/auto/qml-qtquicktest/tst_chartviewsignals_2_0.qml b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals_2_0.qml index e86ea1b3..e86ea1b3 100644 --- a/tests/auto/qml-qtquicktest/tst_chartviewsignals_2_0.qml +++ b/tests/auto/qml-qtquicktest/data/tst_chartviewsignals_2_0.qml diff --git a/tests/auto/qml-qtquicktest/tst_pieseries.qml b/tests/auto/qml-qtquicktest/data/tst_pieseries.qml index 3e6a82e8..3e6a82e8 100644 --- a/tests/auto/qml-qtquicktest/tst_pieseries.qml +++ b/tests/auto/qml-qtquicktest/data/tst_pieseries.qml diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml b/tests/auto/qml-qtquicktest/data/tst_pieseries_1_1.qml index 5016d15e..5016d15e 100644 --- a/tests/auto/qml-qtquicktest/tst_pieseries_1_1.qml +++ b/tests/auto/qml-qtquicktest/data/tst_pieseries_1_1.qml diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml b/tests/auto/qml-qtquicktest/data/tst_pieseries_1_2.qml index 74ad1511..74ad1511 100644 --- a/tests/auto/qml-qtquicktest/tst_pieseries_1_2.qml +++ b/tests/auto/qml-qtquicktest/data/tst_pieseries_1_2.qml diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml b/tests/auto/qml-qtquicktest/data/tst_pieseries_1_3.qml index 15fd4b6e..15fd4b6e 100644 --- a/tests/auto/qml-qtquicktest/tst_pieseries_1_3.qml +++ b/tests/auto/qml-qtquicktest/data/tst_pieseries_1_3.qml diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_1_4.qml b/tests/auto/qml-qtquicktest/data/tst_pieseries_1_4.qml index ccd133dd..ccd133dd 100644 --- a/tests/auto/qml-qtquicktest/tst_pieseries_1_4.qml +++ b/tests/auto/qml-qtquicktest/data/tst_pieseries_1_4.qml diff --git a/tests/auto/qml-qtquicktest/tst_pieseries_2_0.qml b/tests/auto/qml-qtquicktest/data/tst_pieseries_2_0.qml index 6a594fde..6a594fde 100644 --- a/tests/auto/qml-qtquicktest/tst_pieseries_2_0.qml +++ b/tests/auto/qml-qtquicktest/data/tst_pieseries_2_0.qml diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis.qml b/tests/auto/qml-qtquicktest/data/tst_valueaxis.qml index 32e12702..32e12702 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis.qml +++ b/tests/auto/qml-qtquicktest/data/tst_valueaxis.qml diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml b/tests/auto/qml-qtquicktest/data/tst_valueaxis_1_1.qml index 1ef81461..1ef81461 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis_1_1.qml +++ b/tests/auto/qml-qtquicktest/data/tst_valueaxis_1_1.qml diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml b/tests/auto/qml-qtquicktest/data/tst_valueaxis_1_2.qml index 9f58eeec..9f58eeec 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis_1_2.qml +++ b/tests/auto/qml-qtquicktest/data/tst_valueaxis_1_2.qml diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml b/tests/auto/qml-qtquicktest/data/tst_valueaxis_1_3.qml index 47c6026b..47c6026b 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis_1_3.qml +++ b/tests/auto/qml-qtquicktest/data/tst_valueaxis_1_3.qml diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_1_4.qml b/tests/auto/qml-qtquicktest/data/tst_valueaxis_1_4.qml index 04b1e434..04b1e434 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis_1_4.qml +++ b/tests/auto/qml-qtquicktest/data/tst_valueaxis_1_4.qml diff --git a/tests/auto/qml-qtquicktest/tst_valueaxis_2_0.qml b/tests/auto/qml-qtquicktest/data/tst_valueaxis_2_0.qml index 786c0fba..786c0fba 100644 --- a/tests/auto/qml-qtquicktest/tst_valueaxis_2_0.qml +++ b/tests/auto/qml-qtquicktest/data/tst_valueaxis_2_0.qml diff --git a/tests/auto/qml-qtquicktest/tst_xyseries.qml b/tests/auto/qml-qtquicktest/data/tst_xyseries.qml index fdce5011..fdce5011 100644 --- a/tests/auto/qml-qtquicktest/tst_xyseries.qml +++ b/tests/auto/qml-qtquicktest/data/tst_xyseries.qml diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml b/tests/auto/qml-qtquicktest/data/tst_xyseries_1_1.qml index b3068462..b3068462 100644 --- a/tests/auto/qml-qtquicktest/tst_xyseries_1_1.qml +++ b/tests/auto/qml-qtquicktest/data/tst_xyseries_1_1.qml diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml b/tests/auto/qml-qtquicktest/data/tst_xyseries_1_2.qml index 78028fcf..78028fcf 100644 --- a/tests/auto/qml-qtquicktest/tst_xyseries_1_2.qml +++ b/tests/auto/qml-qtquicktest/data/tst_xyseries_1_2.qml diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml b/tests/auto/qml-qtquicktest/data/tst_xyseries_1_3.qml index 298e9188..298e9188 100644 --- a/tests/auto/qml-qtquicktest/tst_xyseries_1_3.qml +++ b/tests/auto/qml-qtquicktest/data/tst_xyseries_1_3.qml diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_1_4.qml b/tests/auto/qml-qtquicktest/data/tst_xyseries_1_4.qml index 03e37d06..03e37d06 100644 --- a/tests/auto/qml-qtquicktest/tst_xyseries_1_4.qml +++ b/tests/auto/qml-qtquicktest/data/tst_xyseries_1_4.qml diff --git a/tests/auto/qml-qtquicktest/tst_xyseries_2_0.qml b/tests/auto/qml-qtquicktest/data/tst_xyseries_2_0.qml index 357eb2f3..357eb2f3 100644 --- a/tests/auto/qml-qtquicktest/tst_xyseries_2_0.qml +++ b/tests/auto/qml-qtquicktest/data/tst_xyseries_2_0.qml diff --git a/tests/auto/qml/CMakeLists.txt b/tests/auto/qml/CMakeLists.txt index 95e5663b..783ab119 100644 --- a/tests/auto/qml/CMakeLists.txt +++ b/tests/auto/qml/CMakeLists.txt @@ -4,7 +4,7 @@ ## qml Test: ##################################################################### -qt_internal_add_test(charts_qml +qt_internal_add_test(tst_charts_qml SOURCES ../inc/tst_definitions.h tst_qml.cpp diff --git a/tests/auto/qml/tst_qml.cpp b/tests/auto/qml/tst_qml.cpp index f6f63ed6..cfe13128 100644 --- a/tests/auto/qml/tst_qml.cpp +++ b/tests/auto/qml/tst_qml.cpp @@ -98,6 +98,9 @@ QString tst_qml::imports_2_1() void tst_qml::initTestCase() { +#ifdef Q_OS_ANDROID + QSKIP("The test doesn't package resources properly to Android (QTBUG-102725)"); +#endif } void tst_qml::cleanupTestCase() diff --git a/tests/auto/qpercentbarseries/CMakeLists.txt b/tests/auto/qpercentbarseries/CMakeLists.txt index aebb80c7..8b147b21 100644 --- a/tests/auto/qpercentbarseries/CMakeLists.txt +++ b/tests/auto/qpercentbarseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qpercentbarseries Test: ##################################################################### -qt_internal_add_test(qpercentbarseries +qt_internal_add_test(tst_qpercentbarseries SOURCES ../inc/tst_definitions.h tst_qpercentbarseries.cpp diff --git a/tests/auto/qpiemodelmapper/CMakeLists.txt b/tests/auto/qpiemodelmapper/CMakeLists.txt index f72d6cb0..eb6cc5b5 100644 --- a/tests/auto/qpiemodelmapper/CMakeLists.txt +++ b/tests/auto/qpiemodelmapper/CMakeLists.txt @@ -4,7 +4,7 @@ ## qpiemodelmapper Test: ##################################################################### -qt_internal_add_test(qpiemodelmapper +qt_internal_add_test(tst_qpiemodelmapper SOURCES ../inc/tst_definitions.h tst_qpiemodelmapper.cpp diff --git a/tests/auto/qpieseries/BLACKLIST b/tests/auto/qpieseries/BLACKLIST new file mode 100644 index 00000000..7fd7b1b2 --- /dev/null +++ b/tests/auto/qpieseries/BLACKLIST @@ -0,0 +1,9 @@ +# QTBUG-102723 +[clickedSignal] +android +[pressedSignal] +android +[releasedSignal] +android +[doubleClickedSignal] +android diff --git a/tests/auto/qpieseries/CMakeLists.txt b/tests/auto/qpieseries/CMakeLists.txt index 550478df..9db7c58f 100644 --- a/tests/auto/qpieseries/CMakeLists.txt +++ b/tests/auto/qpieseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qpieseries Test: ##################################################################### -qt_internal_add_test(qpieseries +qt_internal_add_test(tst_qpieseries SOURCES ../inc/tst_definitions.h tst_qpieseries.cpp diff --git a/tests/auto/qpieslice/BLACKLIST b/tests/auto/qpieslice/BLACKLIST new file mode 100644 index 00000000..7fd7b1b2 --- /dev/null +++ b/tests/auto/qpieslice/BLACKLIST @@ -0,0 +1,9 @@ +# QTBUG-102723 +[clickedSignal] +android +[pressedSignal] +android +[releasedSignal] +android +[doubleClickedSignal] +android diff --git a/tests/auto/qpieslice/CMakeLists.txt b/tests/auto/qpieslice/CMakeLists.txt index 09b1f480..7361a46b 100644 --- a/tests/auto/qpieslice/CMakeLists.txt +++ b/tests/auto/qpieslice/CMakeLists.txt @@ -4,7 +4,7 @@ ## qpieslice Test: ##################################################################### -qt_internal_add_test(qpieslice +qt_internal_add_test(tst_qpieslice SOURCES ../inc/tst_definitions.h tst_qpieslice.cpp diff --git a/tests/auto/qscatterseries/CMakeLists.txt b/tests/auto/qscatterseries/CMakeLists.txt index 56792b41..b3cb58a8 100644 --- a/tests/auto/qscatterseries/CMakeLists.txt +++ b/tests/auto/qscatterseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qscatterseries Test: ##################################################################### -qt_internal_add_test(qscatterseries +qt_internal_add_test(tst_qscatterseries SOURCES ../inc/tst_definitions.h ../qxyseries/tst_qxyseries.cpp ../qxyseries/tst_qxyseries.h diff --git a/tests/auto/qscatterseries/tst_qscatterseries.cpp b/tests/auto/qscatterseries/tst_qscatterseries.cpp index e91a881b..8d369660 100644 --- a/tests/auto/qscatterseries/tst_qscatterseries.cpp +++ b/tests/auto/qscatterseries/tst_qscatterseries.cpp @@ -87,7 +87,7 @@ void tst_QScatterSeries::qscatterseries() QCOMPARE(series.brush(), QBrush()); QCOMPARE(series.points(), QList<QPointF>()); QCOMPARE(series.pen(), QPen()); - QCOMPARE(series.pointsVisible(), false); + QCOMPARE(series.pointsVisible(), true); series.append(QList<QPointF>()); series.append(0.0,0.0); @@ -102,7 +102,7 @@ void tst_QScatterSeries::qscatterseries() series.setBrush(QBrush()); series.setPen(QPen()); - series.setPointsVisible(false); + series.setPointsVisible(true); m_chart->addSeries(&series); m_view->show(); diff --git a/tests/auto/qsplineseries/CMakeLists.txt b/tests/auto/qsplineseries/CMakeLists.txt index b75b8197..5f580733 100644 --- a/tests/auto/qsplineseries/CMakeLists.txt +++ b/tests/auto/qsplineseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qsplineseries Test: ##################################################################### -qt_internal_add_test(qsplineseries +qt_internal_add_test(tst_qsplineseries SOURCES ../inc/tst_definitions.h ../qxyseries/tst_qxyseries.cpp ../qxyseries/tst_qxyseries.h diff --git a/tests/auto/qstackedbarseries/CMakeLists.txt b/tests/auto/qstackedbarseries/CMakeLists.txt index fc076c52..ecb78bec 100644 --- a/tests/auto/qstackedbarseries/CMakeLists.txt +++ b/tests/auto/qstackedbarseries/CMakeLists.txt @@ -4,7 +4,7 @@ ## qstackedbarseries Test: ##################################################################### -qt_internal_add_test(qstackedbarseries +qt_internal_add_test(tst_qstackedbarseries SOURCES ../inc/tst_definitions.h tst_qstackedbarseries.cpp diff --git a/tests/auto/qvalueaxis/CMakeLists.txt b/tests/auto/qvalueaxis/CMakeLists.txt index 2d2980c5..b8d253fd 100644 --- a/tests/auto/qvalueaxis/CMakeLists.txt +++ b/tests/auto/qvalueaxis/CMakeLists.txt @@ -4,7 +4,7 @@ ## qvalueaxis Test: ##################################################################### -qt_internal_add_test(qvalueaxis +qt_internal_add_test(tst_qvalueaxis SOURCES ../inc/tst_definitions.h ../qabstractaxis/tst_qabstractaxis.cpp ../qabstractaxis/tst_qabstractaxis.h diff --git a/tests/auto/qxymodelmapper/CMakeLists.txt b/tests/auto/qxymodelmapper/CMakeLists.txt index 7dd66467..1f261a31 100644 --- a/tests/auto/qxymodelmapper/CMakeLists.txt +++ b/tests/auto/qxymodelmapper/CMakeLists.txt @@ -4,7 +4,7 @@ ## qxymodelmapper Test: ##################################################################### -qt_internal_add_test(qxymodelmapper +qt_internal_add_test(tst_qxymodelmapper SOURCES ../inc/tst_definitions.h tst_qxymodelmapper.cpp |