diff options
112 files changed, 1713 insertions, 465 deletions
diff --git a/LICENSE.GPLv3 b/LICENSE.GPLv3 new file mode 100644 index 000000000..4e49b122a --- /dev/null +++ b/LICENSE.GPLv3 @@ -0,0 +1,686 @@ + GNU GENERAL PUBLIC LICENSE + + The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ + + You may use, distribute and copy the Qt GUI Toolkit under the terms of + GNU Lesser General Public License version 3. That license references + the General Public License version 3, that is displayed below. Other + portions of the Qt Toolkit may be licensed directly under 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/LICENSE.LGPLv3 b/LICENSE.LGPLv3 index 8fbb74390..4d67bac0b 100644 --- a/LICENSE.LGPLv3 +++ b/LICENSE.LGPLv3 @@ -5,6 +5,8 @@ You may use, distribute and copy the Qt GUI Toolkit under the terms of GNU Lesser General Public License version 3, which is displayed below. + This license makes reference to the version 3 of the GNU General + Public License, which you can find in the LICENSE.GPLv3 file. ------------------------------------------------------------------------- diff --git a/examples/qml/networkaccessmanagerfactory/doc/src/networkaccessmanagerfactory.qdoc b/examples/qml/networkaccessmanagerfactory/doc/src/networkaccessmanagerfactory.qdoc index ccb05917a..84ad077a1 100644 --- a/examples/qml/networkaccessmanagerfactory/doc/src/networkaccessmanagerfactory.qdoc +++ b/examples/qml/networkaccessmanagerfactory/doc/src/networkaccessmanagerfactory.qdoc @@ -26,8 +26,9 @@ ****************************************************************************/ /*! - \title C++ Extensions: Network Access Manager Factory Example \example networkaccessmanagerfactory + \title C++ Extensions: Network Access Manager Factory Example + \brief Implements a custom network access manager for the QML engine This example shows how to use QQmlNetworkAccessManagerFactory to create a QNetworkAccessManager with a proxy. diff --git a/examples/quick/canvas/squircle/squircle.qml b/examples/quick/canvas/squircle/squircle.qml index 7c62ef5d0..04c9df42d 100644 --- a/examples/quick/canvas/squircle/squircle.qml +++ b/examples/quick/canvas/squircle/squircle.qml @@ -90,9 +90,9 @@ Item { onFillChanged: requestPaint(); onStrokeChanged: requestPaint(); - onPaint: squcirle(); + onPaint: squircle(); - function squcirle() { + function squircle() { var ctx = canvas.getContext("2d"); var N = canvas.nSize; var R = canvas.radius; diff --git a/examples/quick/demos/stocqt/content/StockInfo.qml b/examples/quick/demos/stocqt/content/StockInfo.qml index 337cc79f7..50f6b9107 100644 --- a/examples/quick/demos/stocqt/content/StockInfo.qml +++ b/examples/quick/demos/stocqt/content/StockInfo.qml @@ -48,72 +48,72 @@ Rectangle { property var stock: null - Text { - id: stockIdText - anchors.left: parent.left - anchors.leftMargin: 5 - anchors.top: parent.top - anchors.topMargin: 15 - color: "#000000" - font.family: "Open Sans" - font.pointSize: 38 - font.weight: Font.DemiBold - text: root.stock.stockId - } + Column { + id: stockColumn + anchors.fill: parent + spacing: 4 - Text { - id: stockNameText - anchors.left: parent.left - anchors.leftMargin: 5 - anchors.bottom: priceChangePercentage.bottom - anchors.right: priceChangePercentage.left - anchors.rightMargin: 15 - color: "#000000" - font.family: "Open Sans" - font.pointSize: 16 - elide: Text.ElideRight - text: root.stock.stockName - } + Flow { + anchors { left: parent.left; right: parent.right } + spacing: 12 - Text { - id: price - anchors.right: parent.right - anchors.rightMargin: 5 - anchors.top: parent.top - anchors.topMargin: 15 - horizontalAlignment: Text.AlignRight - color: "#000000" - font.family: "Open Sans" - font.pointSize: 30 - font.weight: Font.DemiBold - text: root.stock.stockPrice - } + Text { + id: stockIdText + color: "#000000" + font.family: "Open Sans" + font.pointSize: 28 + font.weight: Font.DemiBold + text: root.stock.stockId + } - Text { - id: priceChange - anchors.right: parent.right - anchors.rightMargin: 20 - anchors.top: price.bottom - anchors.topMargin: 5 - horizontalAlignment: Text.AlignRight - color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930" - font.family: "Open Sans" - font.pointSize: 20 - font.weight: Font.Bold - text: root.stock.stockPriceChanged - } + Text { + id: price + color: "#6d6d6d" + font.family: "Open Sans" + font.pointSize: 28 + font.weight: Font.DemiBold + text: parseFloat(Math.round(root.stock.stockPrice * 100) / 100).toFixed(2); + } + } + + Text { + id: stockNameText + color: "#0c0c0c" + font.family: "Open Sans" + font.pointSize: 16 + width: stockColumn.width + elide: Text.ElideRight + maximumLineCount: 3 + wrapMode: Text.WordWrap + text: root.stock.stockName + } + + Flow { + anchors { left: parent.left; right: parent.right } + spacing: 12 + + Text { + id: priceChange + horizontalAlignment: Text.AlignRight + color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930" + font.family: "Open Sans" + font.pointSize: 18 + text: parseFloat(Math.round(root.stock.stockPriceChanged * 100) / 100).toFixed(2); + } - Text { - id: priceChangePercentage - anchors.right: parent.right - anchors.rightMargin: 20 - anchors.top: priceChange.bottom - anchors.topMargin: 5 - horizontalAlignment: Text.AlignRight - color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930" - font.family: "Open Sans" - font.pointSize: 18 - font.weight: Font.Bold - text: Math.abs(Math.round(root.stock.stockPriceChanged/(root.stock.stockPrice - root.stock.stockPriceChanged) * 100))/100 +"%" + Text { + id: priceChangePercentage + horizontalAlignment: Text.AlignRight + color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930" + font.family: "Open Sans" + font.pointSize: 18 + font.weight: Font.DemiBold + text: "(" + + Math.abs(Math.round( + root.stock.stockPriceChanged / + (root.stock.stockPrice - root.stock.stockPriceChanged) * 100)) / 100 + + "%)" + } + } } } diff --git a/examples/quick/demos/stocqt/content/StockListView.qml b/examples/quick/demos/stocqt/content/StockListView.qml index 53e345db5..470531a21 100644 --- a/examples/quick/demos/stocqt/content/StockListView.qml +++ b/examples/quick/demos/stocqt/content/StockListView.qml @@ -96,9 +96,9 @@ Rectangle { var records = xhr.responseText.split('\n'); if (records.length > 0) { var r = records[1].split(','); - model.setProperty(index, "value", r[4]); - var today = parseFloat(r[4]); + model.setProperty(index, "value", today.toFixed(2)); + r = records[2].split(','); var yesterday = parseFloat(r[4]); var change = today - yesterday; diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index a17949130..d78a35030 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -1273,7 +1273,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node) #endif #ifdef Q_OS_MAC - // Mac OS X 10.8.3 introduced a bug in the AMD drivers, for at least the 2011 macbook pros, + // OS X 10.8.3 introduced a bug in the AMD drivers, for at least the 2011 macbook pros, // causing point sprites who read gl_PointCoord in the frag shader to come out as // green-red blobs. if (perfLevel < Deformable && strstr((char *) glGetString(GL_VENDOR), "ATI")) { diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index 7fcf383bc..d301c4382 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -652,7 +652,7 @@ void QAbstractAnimationJob::removeAnimationChangeListener(QAnimationJobChangeLis void QAbstractAnimationJob::debugAnimation(QDebug d) const { - d << "AbstractAnimationJob(" << hex << (void *) this << dec << ") state:" + d << "AbstractAnimationJob(" << hex << (const void *) this << dec << ") state:" << m_state << "duration:" << duration(); } diff --git a/src/qml/animations/qcontinuinganimationgroupjob.cpp b/src/qml/animations/qcontinuinganimationgroupjob.cpp index c77448f15..88005baf1 100644 --- a/src/qml/animations/qcontinuinganimationgroupjob.cpp +++ b/src/qml/animations/qcontinuinganimationgroupjob.cpp @@ -115,7 +115,7 @@ void QContinuingAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimat void QContinuingAnimationGroupJob::debugAnimation(QDebug d) const { - d << "ContinuingAnimationGroupJob(" << hex << (void *) this << dec << ")"; + d << "ContinuingAnimationGroupJob(" << hex << (const void *) this << dec << ")"; debugChildren(d); } diff --git a/src/qml/animations/qparallelanimationgroupjob.cpp b/src/qml/animations/qparallelanimationgroupjob.cpp index 0153794d6..fe56f2b1e 100644 --- a/src/qml/animations/qparallelanimationgroupjob.cpp +++ b/src/qml/animations/qparallelanimationgroupjob.cpp @@ -233,7 +233,7 @@ void QParallelAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimatio void QParallelAnimationGroupJob::debugAnimation(QDebug d) const { - d << "ParallelAnimationGroupJob(" << hex << (void *) this << dec << ")"; + d << "ParallelAnimationGroupJob(" << hex << (const void *) this << dec << ")"; debugChildren(d); } diff --git a/src/qml/animations/qpauseanimationjob.cpp b/src/qml/animations/qpauseanimationjob.cpp index 8e35c5899..0e95645f4 100644 --- a/src/qml/animations/qpauseanimationjob.cpp +++ b/src/qml/animations/qpauseanimationjob.cpp @@ -62,7 +62,7 @@ void QPauseAnimationJob::updateCurrentTime(int) void QPauseAnimationJob::debugAnimation(QDebug d) const { - d << "PauseAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << m_duration; + d << "PauseAnimationJob(" << hex << (const void *) this << dec << ")" << "duration:" << m_duration; } QT_END_NAMESPACE diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp index 5060b7f6c..b92caf3bc 100644 --- a/src/qml/animations/qsequentialanimationgroupjob.cpp +++ b/src/qml/animations/qsequentialanimationgroupjob.cpp @@ -411,7 +411,7 @@ void QSequentialAnimationGroupJob::animationRemoved(QAbstractAnimationJob *anim, void QSequentialAnimationGroupJob::debugAnimation(QDebug d) const { - d << "SequentialAnimationGroupJob(" << hex << (void *) this << dec << ")" << "currentAnimation:" << (void *)m_currentAnimation; + d << "SequentialAnimationGroupJob(" << hex << (const void *) this << dec << ")" << "currentAnimation:" << (void *)m_currentAnimation; debugChildren(d); } diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index 911be238b..307f945d2 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -836,7 +836,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QmlIR::Ob propertyFlags |= QQmlPropertyData::IsQList; } - if ((!p->flags & QV4::CompiledData::Property::IsReadOnly) && p->type != QV4::CompiledData::Property::CustomList) + if (!(p->flags & QV4::CompiledData::Property::IsReadOnly) && p->type != QV4::CompiledData::Property::CustomList) propertyFlags |= QQmlPropertyData::IsWritable; @@ -860,7 +860,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QmlIR::Ob continue; quint32 propertyFlags = QQmlPropertyData::IsVarProperty; - if (!p->flags & QV4::CompiledData::Property::IsReadOnly) + if (!(p->flags & QV4::CompiledData::Property::IsReadOnly)) propertyFlags |= QQmlPropertyData::IsWritable; VMD *vmd = (QQmlVMEMetaData *)dynamicData.data(); diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 62e661c98..c150666a1 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -530,7 +530,7 @@ class DominatorTree const int bbCount = function->basicBlockCount(); d->vertex = std::vector<int>(bbCount, InvalidBasicBlockIndex); d->parent = std::vector<int>(bbCount, InvalidBasicBlockIndex); - d->dfnum = std::vector<int>(bbCount, 0); + d->dfnum = std::vector<int>(size_t(bbCount), 0); d->semi = std::vector<BasicBlockIndex>(bbCount, InvalidBasicBlockIndex); d->ancestor = std::vector<BasicBlockIndex>(bbCount, InvalidBasicBlockIndex); idom = std::vector<BasicBlockIndex>(bbCount, InvalidBasicBlockIndex); @@ -873,7 +873,7 @@ private: // - set the current node's depth to that of immediate dominator + 1 std::vector<int> calculateNodeDepths() const { - std::vector<int> nodeDepths(function->basicBlockCount(), -1); + std::vector<int> nodeDepths(size_t(function->basicBlockCount()), -1); nodeDepths[0] = 0; foreach (BasicBlock *bb, function->basicBlocks()) { if (bb->isRemoved()) diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 5729a60ea..74b61fd6e 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -23,7 +23,7 @@ qhp.QtQml.subprojects.classes.indexTitle = Qt QML C++ Classes qhp.QtQml.subprojects.classes.selectors = class fake:headerfile qhp.QtQml.subprojects.classes.sortPages = true qhp.QtQml.subprojects.examples.title = Examples -qhp.QtQml.subprojects.examples.indexTitle = Qt Quick Examples and Tutorials +qhp.QtQml.subprojects.examples.indexTitle = Qt QML Examples qhp.QtQml.subprojects.examples.selectors = fake:example qhp.QtQml.subprojects.qmltypes.title = QML Types qhp.QtQml.subprojects.qmltypes.indexTitle = Qt QML QML Types @@ -50,7 +50,8 @@ imagedirs += images # Add a thumbnail for examples that do not have images manifestmeta.thumbnail.names += "QtQml/Chapter 4*" \ - "QtQml/Chapter 6*" + "QtQml/Chapter 6*" \ + "QtQml/C++ Extensions: *" navigation.landingpage = "Qt QML" navigation.cppclassespage = "Qt QML C++ Classes" diff --git a/src/qml/doc/src/examples.qdoc b/src/qml/doc/src/examples.qdoc new file mode 100644 index 000000000..f3550ae19 --- /dev/null +++ b/src/qml/doc/src/examples.qdoc @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\group qmlextendingexamples +\title Qt QML Examples +\brief List of Qt QML examples for reference. + +The list of examples demonstrating how to extend C++ to QML or the other way +around. +*/ diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc index 25bb0d606..4203cca8b 100644 --- a/src/qml/doc/src/qmlfunctions.qdoc +++ b/src/qml/doc/src/qmlfunctions.qdoc @@ -470,8 +470,8 @@ as any other item). Usage: - // First, define your QML singleton type which provides the functionality. \qml + // First, define your QML singleton type which provides the functionality. pragma Singleton import QtQuick 2.0 Item { diff --git a/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc b/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc index 79bd3df9d..a2397b6cf 100644 --- a/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc +++ b/src/qml/doc/src/qmllanguageref/modules/cppplugins.qdoc @@ -32,96 +32,13 @@ \section1 Creating a Plugin - The \l{QQmlEngine}{QML engine} load C++ plugins for QML. + The \l{QQmlEngine}{QML engine} loads C++ plugins for QML. Such plugins are usually provided in a QML extension module, and can provide types for use by clients in QML documents which import the module. A module requires at least one type registered in order to be considered valid. - QQmlExtensionPlugin is a plugin interface that makes it possible to - create QML extensions that can be loaded dynamically into QML applications. - These extensions allow custom QML types to be made available to the - QML engine. - - To write a QML extension plugin: - \list 1 - \li Subclass QQmlExtensionPlugin - \list - \li Use the Q_PLUGIN_METADATA() macro to register the plugin with - the Qt meta object system - \li Override the \l{QQmlExtensionPlugin::}{registerTypes()} method - and call qmlRegisterType() to register the types to be exported - by the plugin - \endlist - \li Write a project file for the plugin - \li Create a \l{Module Definition qmldir Files}{qmldir file} to - describe the plugin - \endlist - - QML extension plugins are for either application-specific or library-like - plugins. Library plugins should limit themselves to registering types, as - any manipulation of the engine's root context may cause conflicts or other - issues in the library user's code. - -\section1 Plugin Example - - Suppose there is a new \c TimeModel C++ class that should be made available - as a new QML type. It provides the current time through \c hour and \c minute - properties. - - \snippet qmlextensionplugins/plugin.cpp 0 - \dots - - To make this type available, we create a plugin class named \c QExampleQmlPlugin - which is a subclass of \l QQmlExtensionPlugin. It overrides the - \l{QQmlExtensionPlugin::}{registerTypes()} method in order to register the \c TimeModel - type using qmlRegisterType(). It also uses the Q_PLUGIN_METADATA() macro in the class - definition to register the plugin with the Qt meta object system using a unique - identifier for the plugin. - - \snippet qmlextensionplugins/plugin.cpp plugin - - The \c TimeModel class receives a \c{1.0} version of this plugin library, as - a QML type called \c Time. The Q_ASSERT() macro can ensure the type namespace is - imported correctly by any QML components that use this plugin. The - \l{Defining QML Types from C++} article has more information about registering C++ - types into the runtime. - - For this example, the TimeExample source directory is in - \c{imports/TimeExample}. The plugin's type namespace will mirror - this structure, so the types are registered into the namespace - "TimeExample". - - Additionally, the project file, in a \c .pro file, defines the project as a plugin library, - specifies it should be built into the \c imports/TimeExample directory, and registers - the plugin target name and various other details: - - \code - TEMPLATE = lib - CONFIG += qt plugin - QT += qml - - DESTDIR = imports/TimeExample - TARGET = qmlqtimeexampleplugin - SOURCES += qexampleqmlplugin.cpp - \endcode - - Finally, a \l{Module Definition qmldir Files}{qmldir file} is required - in the \c imports/TimeExample directory to describe the plugin and the types that it - exports. The plugin includes a \c Clock.qml file along with the \c qmlqtimeexampleplugin - that is built by the project (as shown above in the \c .pro file) so both of these - need to be specified in the \c qmldir file: - - \quotefile qmlextensionplugins/imports/TimeExample/qmldir - - Once the project is built and installed, the new \c Time component is - accessible by any QML component that imports the \c TimeExample - module - - \snippet qmlextensionplugins/plugins.qml 0 - - The full source code is available in the \l {qmlextensionplugins}{plugins example}. - + \include qqmlextensionplugin.qdocinc \section1 Reference diff --git a/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc b/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc new file mode 100644 index 000000000..7c1d65b09 --- /dev/null +++ b/src/qml/doc/src/qmllanguageref/modules/qqmlextensionplugin.qdocinc @@ -0,0 +1,90 @@ +QQmlExtensionPlugin is a plugin interface that makes it possible to +create QML extensions that can be loaded dynamically into QML applications. +These extensions allow custom QML types to be made available to the +QML engine. + +To write a QML extension plugin: +\list 1 +\li Subclass QQmlExtensionPlugin + \list + \li Use the Q_PLUGIN_METADATA() macro to register the plugin with + the Qt meta object system + \li Override the \l{QQmlExtensionPlugin::}{registerTypes()} method + and call qmlRegisterType() to register the types to be exported + by the plugin + \endlist +\li Write a project file for the plugin +\li Create a \l{Module Definition qmldir Files}{qmldir file} to + describe the plugin +\endlist + +QML extension plugins are for either application-specific or library-like +plugins. Library plugins should limit themselves to registering types, as +any manipulation of the engine's root context may cause conflicts or other +issues in the library user's code. + +\section1 Plugin Example + +Suppose there is a new \c TimeModel C++ class that should be made available +as a new QML type. It provides the current time through \c hour and \c minute +properties. + +\snippet qmlextensionplugins/plugin.cpp 0 +\dots + +To make this type available, we create a plugin class named \c QExampleQmlPlugin +which is a subclass of \l QQmlExtensionPlugin. It overrides the +\l{QQmlExtensionPlugin::}{registerTypes()} method in order to register the \c TimeModel +type using qmlRegisterType(). It also uses the Q_PLUGIN_METADATA() macro in the class +definition to register the plugin with the Qt meta object system using a unique +identifier for the plugin. + +\snippet qmlextensionplugins/plugin.cpp plugin + +This registers the \c TimeModel class with version \c{1.0} of this plugin library, as +a QML type called \c Time. The Q_ASSERT() macro can ensure the type namespace is +imported correctly by any QML components that use this plugin. The +\l{Defining QML Types from C++} article has more information about registering C++ +types into the runtime. + +Additionally, the project file (\c .pro) defines the project as a plugin library, +specifies it should be built into the \c imports/TimeExample directory, and registers +the plugin target name and various other details: + +\code +TEMPLATE = lib +CONFIG += qt plugin +QT += qml + +DESTDIR = imports/TimeExample +TARGET = qmlqtimeexampleplugin +SOURCES += qexampleqmlplugin.cpp +\endcode + +Finally, a \l{Module Definition qmldir Files}{qmldir file} is required +in the \c imports/TimeExample directory to describe the plugin and the types that it +exports. The plugin includes a \c Clock.qml file along with the \c qmlqtimeexampleplugin +that is built by the project (as shown above in the \c .pro file) so both of these +need to be specified in the \c qmldir file: + +\quotefile qmlextensionplugins/imports/TimeExample/qmldir + +To make things easier for this example, the TimeExample source directory is in +\c{imports/TimeExample}, and we build +\l{Source, Build, and Install Directories}{in-source}. However, the structure +of the source directory is not so important, as the \c qmldir file can specify +paths to installed QML files. + +What is important is the name of the directory that the qmldir is installed +into. When the user imports our module, the QML engine uses the +\l{Contents of a Module Definition qmldir File}{module identifier} +(\c TimeExample) to find the plugin, and so the directory in which it is +installed must match the module identifier. + +Once the project is built and installed, the new \c Time component is +accessible by any QML component that imports the \c TimeExample +module + +\snippet qmlextensionplugins/plugins.qml 0 + +The full source code is available in the \l {qmlextensionplugins}{plugins example}. diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc index 61ebbcf69..64d6bb9ac 100644 --- a/src/qml/doc/src/qtqml.qdoc +++ b/src/qml/doc/src/qtqml.qdoc @@ -148,6 +148,7 @@ Further information for writing QML applications: \list \li \l{Qt QML C++ Classes}{C++ Classes} \li \l{Qt QML QML Types}{QML Types} +\li \l{Qt QML Examples}{Examples} \endlist */ diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp index 3106d3af2..23c9695cf 100644 --- a/src/qml/jsruntime/qv4arraybuffer.cpp +++ b/src/qml/jsruntime/qv4arraybuffer.cpp @@ -79,7 +79,7 @@ ReturnedValue ArrayBufferCtor::method_isView(CallContext *ctx) QV4::Scoped<DataView> v(scope, ctx->argument(0)); if (!!v) return Encode(true); - return Encode(true); + return Encode(false); } diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 320ed59fc..7424dc4e4 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -107,6 +107,9 @@ static ReturnedValue throwTypeError(CallContext *ctx) const int MinimumStackSize = 256; // in kbytes +QT_WARNING_PUSH +QT_WARNING_DISABLE_MSVC(4172) // MSVC 2015: warning C4172: returning address of local variable or temporary: dummy + quintptr getStackLimit() { quintptr stackLimit; @@ -171,6 +174,7 @@ quintptr getStackLimit() int dummy; // this is inexact, as part of the stack is used when being called here, // but let's simply default to 1MB from where the stack is right now + // (Note: triggers warning C4172 as of MSVC 2015, returning address of local variable) stackLimit = reinterpret_cast<qintptr>(&dummy) - 1024*1024; #endif @@ -178,6 +182,7 @@ quintptr getStackLimit() return stackLimit + MinimumStackSize*1024; } +QT_WARNING_POP QJSEngine *ExecutionEngine::jsEngine() const { @@ -540,7 +545,7 @@ Heap::Object *ExecutionEngine::newObject(InternalClass *internalClass, QV4::Obje Heap::String *ExecutionEngine::newString(const QString &s) { Scope scope(this); - return ScopedString(scope, memoryManager->alloc<String>(s))->d(); + return ScopedString(scope, memoryManager->allocWithStringData<String>(s.length() * sizeof(QChar), s))->d(); } Heap::String *ExecutionEngine::newIdentifier(const QString &text) @@ -1373,7 +1378,7 @@ QV4::ReturnedValue QV4::ExecutionEngine::fromVariant(const QVariant &variant) QV4::Scope scope(this); if (type == qMetaTypeId<QQmlListReference>()) { typedef QQmlListReferencePrivate QDLRP; - QDLRP *p = QDLRP::get((QQmlListReference*)ptr); + QDLRP *p = QDLRP::get((QQmlListReference*)const_cast<void *>(ptr)); if (p->object) { return QV4::QmlListWrapper::create(scope.engine, p->property, p->propertyType); } else { @@ -1385,7 +1390,7 @@ QV4::ReturnedValue QV4::ExecutionEngine::fromVariant(const QVariant &variant) } else if (type == qMetaTypeId<QList<QObject *> >()) { // XXX Can this be made more by using Array as a prototype and implementing // directly against QList<QObject*>? - const QList<QObject *> &list = *(QList<QObject *>*)ptr; + const QList<QObject *> &list = *(const QList<QObject *>*)ptr; QV4::ScopedArrayObject a(scope, newArrayObject()); a->arrayReserve(list.count()); QV4::ScopedValue v(scope); diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index a18a2d491..98a449021 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -66,7 +66,8 @@ Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit, break; } // duplicate arguments, need some trick to store them - arg = engine->memoryManager->alloc<String>(arg->d(), engine->newString(QString(0xfffe))); + MemoryManager *mm = engine->memoryManager; + arg = mm->alloc<String>(mm, arg->d(), engine->newString(QString(0xfffe))); } } diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp index 096fe9fb4..4ae30a7f3 100644 --- a/src/qml/jsruntime/qv4numberobject.cpp +++ b/src/qml/jsruntime/qv4numberobject.cpp @@ -76,14 +76,10 @@ void NumberPrototype::init(ExecutionEngine *engine, Object *ctor) ctor->defineReadonlyProperty(QStringLiteral("POSITIVE_INFINITY"), Primitive::fromDouble(qInf())); ctor->defineReadonlyProperty(QStringLiteral("MAX_VALUE"), Primitive::fromDouble(1.7976931348623158e+308)); -#ifdef __INTEL_COMPILER -# pragma warning( push ) -# pragma warning(disable: 239) -#endif +QT_WARNING_PUSH +QT_WARNING_DISABLE_INTEL(239) ctor->defineReadonlyProperty(QStringLiteral("MIN_VALUE"), Primitive::fromDouble(5e-324)); -#ifdef __INTEL_COMPILER -# pragma warning( pop ) -#endif +QT_WARNING_POP defineDefaultProperty(QStringLiteral("constructor"), (o = ctor)); defineDefaultProperty(engine->id_toString(), method_toString); diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 529703bda..e5946d8be 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -71,14 +71,9 @@ QT_BEGIN_NAMESPACE -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) -# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 // The code in this file does not violate strict aliasing, but GCC thinks it does // so turn off the warnings for us to have a clean build -# pragma GCC diagnostic ignored "-Wstrict-aliasing" -# endif -#endif - +QT_WARNING_DISABLE_GCC("-Wstrict-aliasing") using namespace QV4; diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 089922d03..b8ea6d7a8 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -524,7 +524,8 @@ QV4::ReturnedValue RuntimeHelpers::addHelper(ExecutionEngine *engine, const Valu return pright->asReturnedValue(); if (!pright->stringValue()->d()->length()) return pleft->asReturnedValue(); - return (engine->memoryManager->alloc<String>(pleft->stringValue()->d(), pright->stringValue()->d()))->asReturnedValue(); + MemoryManager *mm = engine->memoryManager; + return (mm->alloc<String>(mm, pleft->stringValue()->d(), pright->stringValue()->d()))->asReturnedValue(); } double x = RuntimeHelpers::toNumber(pleft); double y = RuntimeHelpers::toNumber(pright); @@ -540,7 +541,8 @@ QV4::ReturnedValue Runtime::addString(ExecutionEngine *engine, const Value &left return right.asReturnedValue(); if (!right.stringValue()->d()->length()) return left.asReturnedValue(); - return (engine->memoryManager->alloc<String>(left.stringValue()->d(), right.stringValue()->d()))->asReturnedValue(); + MemoryManager *mm = engine->memoryManager; + return (mm->alloc<String>(mm, left.stringValue()->d(), right.stringValue()->d()))->asReturnedValue(); } Scope scope(engine); @@ -557,7 +559,8 @@ QV4::ReturnedValue Runtime::addString(ExecutionEngine *engine, const Value &left return pright->asReturnedValue(); if (!pright->stringValue()->d()->length()) return pleft->asReturnedValue(); - return (engine->memoryManager->alloc<String>(pleft->stringValue()->d(), pright->stringValue()->d()))->asReturnedValue(); + MemoryManager *mm = engine->memoryManager; + return (mm->alloc<String>(mm, pleft->stringValue()->d(), pright->stringValue()->d()))->asReturnedValue(); } void Runtime::setProperty(ExecutionEngine *engine, const Value &object, int nameIndex, const Value &value) diff --git a/src/qml/jsruntime/qv4serialize.cpp b/src/qml/jsruntime/qv4serialize.cpp index 090e9c7e6..33b40796a 100644 --- a/src/qml/jsruntime/qv4serialize.cpp +++ b/src/qml/jsruntime/qv4serialize.cpp @@ -116,21 +116,21 @@ static inline void reserve(QByteArray &data, int extra) static inline quint32 popUint32(const char *&data) { - quint32 rv = *((quint32 *)data); + quint32 rv = *((const quint32 *)data); data += sizeof(quint32); return rv; } static inline double popDouble(const char *&data) { - double rv = *((double *)data); + double rv = *((const double *)data); data += sizeof(double); return rv; } static inline void *popPtr(const char *&data) { - void *rv = *((void **)data); + void *rv = *((void *const *)data); data += sizeof(void *); return rv; } @@ -297,7 +297,7 @@ ReturnedValue Serialize::deserialize(const char *&data, ExecutionEngine *engine) case WorkerString: { quint32 size = headersize(header); - QString qstr((QChar *)data, size); + QString qstr((const QChar *)data, size); data += ALIGN(size * sizeof(quint16)); return QV4::Encode(engine->newString(qstr)); } @@ -342,7 +342,7 @@ ReturnedValue Serialize::deserialize(const char *&data, ExecutionEngine *engine) { quint32 flags = headersize(header); quint32 length = popUint32(data); - QString pattern = QString((QChar *)data, length - 1); + QString pattern = QString((const QChar *)data, length - 1); data += ALIGN(length * sizeof(quint16)); return Encode(engine->newRegExpObject(pattern, flags)); } diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp index 2ab608e64..24a13ddd1 100644 --- a/src/qml/jsruntime/qv4string.cpp +++ b/src/qml/jsruntime/qv4string.cpp @@ -117,7 +117,8 @@ bool String::isEqualTo(Managed *t, Managed *o) } -Heap::String::String(const QString &t) +Heap::String::String(MemoryManager *mm, const QString &t) + : mm(mm) { subtype = String::StringType_Unknown; @@ -129,7 +130,8 @@ Heap::String::String(const QString &t) len = text->size; } -Heap::String::String(String *l, String *r) +Heap::String::String(MemoryManager *mm, String *l, String *r) + : mm(mm) { subtype = String::StringType_Unknown; @@ -187,6 +189,7 @@ void Heap::String::simplifyString() const text->ref.ref(); identifier = 0; largestSubLength = 0; + mm->growUnmanagedHeapSizeUsage(size_t(text->size) * sizeof(QChar)); } void Heap::String::createHashValue() const diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h index 568c11261..93a25d7ed 100644 --- a/src/qml/jsruntime/qv4string_p.h +++ b/src/qml/jsruntime/qv4string_p.h @@ -53,8 +53,8 @@ struct Q_QML_PRIVATE_EXPORT String : Base { StringType_ArrayIndex }; - String(const QString &text); - String(String *l, String *n); + String(MemoryManager *mm, const QString &text); + String(MemoryManager *mm, String *l, String *n); ~String() { if (!largestSubLength && !text->ref.deref()) QStringData::deallocate(text); @@ -66,6 +66,9 @@ struct Q_QML_PRIVATE_EXPORT String : Base { len == (uint)text->size); return len; } + std::size_t retainedTextSize() const { + return largestSubLength ? 0 : (std::size_t(text->size) * sizeof(QChar)); + } void createHashValue() const; inline unsigned hashValue() const { if (subtype == StringType_Unknown) @@ -107,6 +110,7 @@ struct Q_QML_PRIVATE_EXPORT String : Base { mutable uint stringHash; mutable uint largestSubLength; uint len; + MemoryManager *mm; private: static void append(const String *data, QChar *ch); }; diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp index fcc6f3dc5..f06eeb08b 100644 --- a/src/qml/jsruntime/qv4typedarray.cpp +++ b/src/qml/jsruntime/qv4typedarray.cpp @@ -85,7 +85,7 @@ void UInt8ClampedArrayWrite(ExecutionEngine *e, char *data, int index, const Val return; } if (d >= 255) { - data[index] = (unsigned char)(255); + data[index] = (char)(255); return; } double f = std::floor(d); @@ -107,7 +107,7 @@ void UInt8ClampedArrayWrite(ExecutionEngine *e, char *data, int index, const Val ReturnedValue Int16ArrayRead(const char *data, int index) { - return Encode((int)*(short *)(data + index)); + return Encode((int)*(const short *)(data + index)); } void Int16ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value) @@ -120,7 +120,7 @@ void Int16ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &val ReturnedValue UInt16ArrayRead(const char *data, int index) { - return Encode((int)*(unsigned short *)(data + index)); + return Encode((int)*(const unsigned short *)(data + index)); } void UInt16ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value) @@ -133,7 +133,7 @@ void UInt16ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &va ReturnedValue Int32ArrayRead(const char *data, int index) { - return Encode(*(int *)(data + index)); + return Encode(*(const int *)(data + index)); } void Int32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value) @@ -146,7 +146,7 @@ void Int32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &val ReturnedValue UInt32ArrayRead(const char *data, int index) { - return Encode(*(unsigned int *)(data + index)); + return Encode(*(const unsigned int *)(data + index)); } void UInt32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value) @@ -159,7 +159,7 @@ void UInt32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &va ReturnedValue Float32ArrayRead(const char *data, int index) { - return Encode(*(float *)(data + index)); + return Encode(*(const float *)(data + index)); } void Float32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value) @@ -172,7 +172,7 @@ void Float32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &v ReturnedValue Float64ArrayRead(const char *data, int index) { - return Encode(*(double *)(data + index)); + return Encode(*(const double *)(data + index)); } void Float64ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value) diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index c0420a38d..6305e6dfb 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -39,6 +39,14 @@ #include "qv4global_p.h" #include <private/qv4heap_p.h> +/* We cannot rely on QT_POINTER_SIZE to be set correctly on host builds. In qmldevtools the Value objects + are only used to store primitives, never object pointers. So we can use the 64-bit encoding. */ +#ifdef V4_BOOTSTRAP +#define QV4_USE_64_BIT_VALUE_ENCODING +#elif QT_POINTER_SIZE == 8 +#define QV4_USE_64_BIT_VALUE_ENCODING +#endif + QT_BEGIN_NAMESPACE namespace QV4 { @@ -94,10 +102,10 @@ struct Q_QML_PRIVATE_EXPORT Value Q_ALWAYS_INLINE quint32 value() const { return _val >> 32; } #endif -#if QT_POINTER_SIZE == 8 +#ifdef QV4_USE_64_BIT_VALUE_ENCODING Q_ALWAYS_INLINE Heap::Base *m() const { Heap::Base *b; memcpy(&b, &_val, 8); return b; } Q_ALWAYS_INLINE void setM(Heap::Base *b) { memcpy(&_val, &b, 8); } -#else // QT_POINTER_SIZE == 4 +#else // !QV4_USE_64_BIT_VALUE_ENCODING Q_ALWAYS_INLINE Heap::Base *m() const { Heap::Base *b; quint32 v = value(); memcpy(&b, &v, 4); return b; } Q_ALWAYS_INLINE void setM(Heap::Base *b) { quint32 v; memcpy(&v, &b, 4); setValue(v); } #endif @@ -106,7 +114,7 @@ struct Q_QML_PRIVATE_EXPORT Value Q_ALWAYS_INLINE void setInt_32(int i) { quint32 u; memcpy(&u, &i, 4); setValue(u); } Q_ALWAYS_INLINE uint uint_32() const { return value(); } -#if QT_POINTER_SIZE == 4 +#ifndef QV4_USE_64_BIT_VALUE_ENCODING enum Masks { SilentNaNBit = 0x00040000, NaN_Mask = 0x7ff80000, @@ -186,7 +194,7 @@ struct Q_QML_PRIVATE_EXPORT Value inline bool isUndefined() const { return tag() == Undefined_Type; } inline bool isNull() const { return tag() == _Null_Type; } inline bool isBoolean() const { return tag ()== _Boolean_Type; } -#if QT_POINTER_SIZE == 8 +#ifdef QV4_USE_64_BIT_VALUE_ENCODING inline bool isInteger() const { return (_val >> IsNumber_Shift) == 1; } inline bool isDouble() const { return (_val >> IsDouble_Shift); } inline bool isNumber() const { return (_val >> IsNumber_Shift); } @@ -219,7 +227,7 @@ struct Q_QML_PRIVATE_EXPORT Value Q_ASSERT(isDouble()); double d; quint64 v = _val; -#if QT_POINTER_SIZE == 8 +#ifdef QV4_USE_64_BIT_VALUE_ENCODING v ^= NaNEncodeMask; #endif memcpy(&d, &v, 8); @@ -227,7 +235,7 @@ struct Q_QML_PRIVATE_EXPORT Value } Q_ALWAYS_INLINE void setDouble(double d) { memcpy(&_val, &d, 8); -#if QT_POINTER_SIZE == 8 +#ifdef QV4_USE_64_BIT_VALUE_ENCODING _val ^= NaNEncodeMask; #endif Q_ASSERT(isDouble()); @@ -287,7 +295,7 @@ struct Q_QML_PRIVATE_EXPORT Value Value v; v.setRawValue(0); v.setM(m); -#if QT_POINTER_SIZE == 4 +#ifndef QV4_USE_64_BIT_VALUE_ENCODING v.setTag(Managed_Type); #endif return v; @@ -368,7 +376,7 @@ struct Q_QML_PRIVATE_EXPORT Value } Value &operator=(Heap::Base *o) { setM(o); -#if QT_POINTER_SIZE == 4 +#ifndef QV4_USE_64_BIT_VALUE_ENCODING setTag(Managed_Type); #endif return *this; @@ -413,7 +421,7 @@ inline double Value::toNumber() const #ifndef V4_BOOTSTRAP inline uint Value::asArrayIndex() const { -#if QT_POINTER_SIZE == 8 +#ifdef QV4_USE_64_BIT_VALUE_ENCODING if (!isNumber()) return UINT_MAX; if (isInteger()) @@ -461,7 +469,7 @@ struct Q_QML_PRIVATE_EXPORT Primitive : public Value inline Primitive Primitive::undefinedValue() { Primitive v; -#if QT_POINTER_SIZE == 8 +#ifdef QV4_USE_64_BIT_VALUE_ENCODING v.setRawValue(quint64(Undefined_Type) << Tag_Shift); #else v.setRawValue(0); @@ -481,7 +489,7 @@ inline Primitive Primitive::emptyValue() inline Primitive Primitive::nullValue() { Primitive v; -#if QT_POINTER_SIZE == 8 +#ifndef QV4_USE_64_BIT_VALUE_ENCODING v.setRawValue(quint64(_Null_Type) << Tag_Shift); #else v.setTagValue(_Null_Type, 0); diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index d0ae44cce..0edd7378a 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -636,7 +636,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_END_INSTR(CallGlobalLookup) MOTH_BEGIN_INSTR(SetExceptionHandler) - exceptionHandler = instr.offset ? ((uchar *)&instr.offset) + instr.offset : 0; + exceptionHandler = instr.offset ? ((const uchar *)&instr.offset) + instr.offset : 0; MOTH_END_INSTR(SetExceptionHandler) MOTH_BEGIN_INSTR(CallBuiltinThrow) @@ -770,21 +770,21 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code MOTH_END_INSTR(ConstructGlobalLookup) MOTH_BEGIN_INSTR(Jump) - code = ((uchar *)&instr.offset) + instr.offset; + code = ((const uchar *)&instr.offset) + instr.offset; MOTH_END_INSTR(Jump) MOTH_BEGIN_INSTR(JumpEq) bool cond = VALUEPTR(instr.condition)->toBoolean(); TRACE(condition, "%s", cond ? "TRUE" : "FALSE"); if (cond) - code = ((uchar *)&instr.offset) + instr.offset; + code = ((const uchar *)&instr.offset) + instr.offset; MOTH_END_INSTR(JumpEq) MOTH_BEGIN_INSTR(JumpNe) bool cond = VALUEPTR(instr.condition)->toBoolean(); TRACE(condition, "%s", cond ? "TRUE" : "FALSE"); if (!cond) - code = ((uchar *)&instr.offset) + instr.offset; + code = ((const uchar *)&instr.offset) + instr.offset; MOTH_END_INSTR(JumpNe) MOTH_BEGIN_INSTR(UNot) diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp index 03e78df91..38b4e1eaf 100644 --- a/src/qml/memory/qv4mm.cpp +++ b/src/qml/memory/qv4mm.cpp @@ -95,6 +95,8 @@ struct MemoryManager::Data uint maxShift; std::size_t maxChunkSize; QVector<PageAllocation> heapChunks; + std::size_t unmanagedHeapSize; // the amount of bytes of heap that is not managed by the memory manager, but which is held onto by managed items. + std::size_t unmanagedHeapSizeGCLimit; struct LargeItem { LargeItem *next; @@ -121,6 +123,8 @@ struct MemoryManager::Data , totalAlloc(0) , maxShift(6) , maxChunkSize(32*1024) + , unmanagedHeapSize(0) + , unmanagedHeapSizeGCLimit(64 * 1024) , largeItems(0) , totalLargeItemsAllocated(0) { @@ -154,8 +158,10 @@ struct MemoryManager::Data namespace { -bool sweepChunk(MemoryManager::Data::ChunkHeader *header, uint *itemsInUse, ExecutionEngine *engine) +bool sweepChunk(MemoryManager::Data::ChunkHeader *header, uint *itemsInUse, ExecutionEngine *engine, std::size_t *unmanagedHeapSize) { + Q_ASSERT(unmanagedHeapSize); + bool isEmpty = true; Heap::Base *tail = &header->freeItems; // qDebug("chunkStart @ %p, size=%x, pos=%x", header->itemStart, header->itemSize, header->itemSize>>4); @@ -164,8 +170,8 @@ bool sweepChunk(MemoryManager::Data::ChunkHeader *header, uint *itemsInUse, Exec #endif for (char *item = header->itemStart; item <= header->itemEnd; item += header->itemSize) { Heap::Base *m = reinterpret_cast<Heap::Base *>(item); -// qDebug("chunk @ %p, size = %lu, in use: %s, mark bit: %s", -// item, m->size, (m->inUse ? "yes" : "no"), (m->markBit ? "true" : "false")); +// qDebug("chunk @ %p, in use: %s, mark bit: %s", +// item, (m->inUse() ? "yes" : "no"), (m->isMarked() ? "true" : "false")); Q_ASSERT((qintptr) item % 16 == 0); @@ -180,6 +186,13 @@ bool sweepChunk(MemoryManager::Data::ChunkHeader *header, uint *itemsInUse, Exec #ifdef V4_USE_VALGRIND VALGRIND_ENABLE_ERROR_REPORTING; #endif + if (std::size_t(header->itemSize) == MemoryManager::align(sizeof(Heap::String)) && m->vtable()->isString) { + std::size_t heapBytes = static_cast<Heap::String *>(m)->retainedTextSize(); + Q_ASSERT(*unmanagedHeapSize >= heapBytes); +// qDebug() << "-- it's a string holding on to" << heapBytes << "bytes"; + *unmanagedHeapSize -= heapBytes; + } + if (m->vtable()->destroy) m->vtable()->destroy(m); @@ -216,7 +229,7 @@ MemoryManager::MemoryManager(ExecutionEngine *engine) m_d->engine = engine; } -Heap::Base *MemoryManager::allocData(std::size_t size) +Heap::Base *MemoryManager::allocData(std::size_t size, std::size_t unmanagedSize) { if (m_d->aggressiveGC) runGC(); @@ -227,11 +240,27 @@ Heap::Base *MemoryManager::allocData(std::size_t size) Q_ASSERT(size >= 16); Q_ASSERT(size % 16 == 0); +// qDebug() << "unmanagedHeapSize:" << m_d->unmanagedHeapSize << "limit:" << m_d->unmanagedHeapSizeGCLimit << "unmanagedSize:" << unmanagedSize; + m_d->unmanagedHeapSize += unmanagedSize; + bool didGCRun = false; + if (m_d->unmanagedHeapSize > m_d->unmanagedHeapSizeGCLimit) { + runGC(); + + if (m_d->unmanagedHeapSizeGCLimit <= m_d->unmanagedHeapSize) + m_d->unmanagedHeapSizeGCLimit = std::max(m_d->unmanagedHeapSizeGCLimit, m_d->unmanagedHeapSize) * 2; + else if (m_d->unmanagedHeapSize * 4 <= m_d->unmanagedHeapSizeGCLimit) + m_d->unmanagedHeapSizeGCLimit /= 2; + else if (m_d->unmanagedHeapSizeGCLimit - m_d->unmanagedHeapSize < 5 * unmanagedSize) + // try preventing running the GC all the time when we're just below the threshold limit and manage to collect just enough to do this one allocation + m_d->unmanagedHeapSizeGCLimit += std::max(std::size_t(8 * 1024), 5 * unmanagedSize); + didGCRun = true; + } + size_t pos = size >> 4; // doesn't fit into a small bucket if (size >= MemoryManager::Data::MaxItemSize) { - if (m_d->totalLargeItemsAllocated > 8 * 1024 * 1024) + if (!didGCRun && m_d->totalLargeItemsAllocated > 8 * 1024 * 1024) runGC(); // we use malloc for this @@ -254,7 +283,7 @@ Heap::Base *MemoryManager::allocData(std::size_t size) } // try to free up space, otherwise allocate - if (m_d->allocCount[pos] > (m_d->availableItems[pos] >> 1) && m_d->totalAlloc > (m_d->totalItems >> 1) && !m_d->aggressiveGC) { + if (!didGCRun && m_d->allocCount[pos] > (m_d->availableItems[pos] >> 1) && m_d->totalAlloc > (m_d->totalItems >> 1) && !m_d->aggressiveGC) { runGC(); header = m_d->nonFullChunks[pos]; if (header) { @@ -405,7 +434,7 @@ void MemoryManager::sweep(bool lastSweep) for (int i = 0; i < m_d->heapChunks.size(); ++i) { Data::ChunkHeader *header = reinterpret_cast<Data::ChunkHeader *>(m_d->heapChunks[i].base()); - chunkIsEmpty[i] = sweepChunk(header, &itemsInUse[header->itemSize >> 4], m_d->engine); + chunkIsEmpty[i] = sweepChunk(header, &itemsInUse[header->itemSize >> 4], m_d->engine, &m_d->unmanagedHeapSize); } QVector<PageAllocation>::iterator chunkIter = m_d->heapChunks.begin(); @@ -545,6 +574,11 @@ size_t MemoryManager::getLargeItemsMem() const return total; } +void MemoryManager::growUnmanagedHeapSizeUsage(size_t delta) +{ + m_d->unmanagedHeapSize += delta; +} + MemoryManager::~MemoryManager() { delete m_persistentValues; diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h index 6d6ce1bad..c01866ff1 100644 --- a/src/qml/memory/qv4mm_p.h +++ b/src/qml/memory/qv4mm_p.h @@ -83,10 +83,10 @@ public: { return (size + 15) & ~0xf; } template<typename ManagedType> - inline typename ManagedType::Data *allocManaged(std::size_t size) + inline typename ManagedType::Data *allocManaged(std::size_t size, std::size_t unmanagedSize = 0) { size = align(size); - Heap::Base *o = allocData(size); + Heap::Base *o = allocData(size, unmanagedSize); o->setVtable(ManagedType::staticVTable()); return static_cast<typename ManagedType::Data *>(o); } @@ -109,6 +109,15 @@ public: return t->d(); } + template <typename ManagedType, typename Arg1> + typename ManagedType::Data *allocWithStringData(std::size_t unmanagedSize, Arg1 arg1) + { + Scope scope(engine()); + Scoped<ManagedType> t(scope, allocManaged<ManagedType>(sizeof(typename ManagedType::Data), unmanagedSize)); + (void)new (t->d()) typename ManagedType::Data(this, arg1); + return t->d(); + } + template <typename ManagedType, typename Arg1, typename Arg2> typename ManagedType::Data *alloc(Arg1 arg1, Arg2 arg2) { @@ -157,10 +166,12 @@ public: size_t getAllocatedMem() const; size_t getLargeItemsMem() const; + void growUnmanagedHeapSizeUsage(size_t delta); // called when a JS object grows itself. Specifically: Heap::String::append + protected: /// expects size to be aligned // TODO: try to inline - Heap::Base *allocData(std::size_t size); + Heap::Base *allocData(std::size_t size, std::size_t unmanagedSize); #ifdef DETAILED_MM_STATS void willAllocate(std::size_t size); diff --git a/src/qml/qml/ftw/qbitfield_p.h b/src/qml/qml/ftw/qbitfield_p.h index 0b7d507b1..e3b6b0e49 100644 --- a/src/qml/qml/ftw/qbitfield_p.h +++ b/src/qml/qml/ftw/qbitfield_p.h @@ -129,15 +129,16 @@ QBitField QBitField::united(const QBitField &o) rv.bits = max; rv.ownData = new quint32[length + 1]; *(rv.ownData) = 1; - rv.data = rv.ownData + 1; + quint32 *rvdata; + rv.data = rvdata = rv.ownData + 1; if (bits > o.bits) { - ::memcpy((quint32 *)rv.data, data, length * sizeof(quint32)); + ::memcpy(rvdata, data, length * sizeof(quint32)); for (quint32 ii = 0; ii < (o.bits + quint32(31)) / 32; ++ii) - ((quint32 *)rv.data)[ii] |= o.data[ii]; + (rvdata)[ii] |= o.data[ii]; } else { - ::memcpy((quint32 *)rv.data, o.data, length * sizeof(quint32)); + ::memcpy(rvdata, o.data, length * sizeof(quint32)); for (quint32 ii = 0; ii < (bits + quint32(31)) / 32; ++ii) - ((quint32 *)rv.data)[ii] |= data[ii]; + (rvdata)[ii] |= data[ii]; } return rv; } diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h index 6ae2e1726..d38fd668f 100644 --- a/src/qml/qml/ftw/qhashedstring_p.h +++ b/src/qml/qml/ftw/qhashedstring_p.h @@ -252,14 +252,14 @@ public: inline bool equals(const QHashedStringRef &string) const { return length == string.length() && hash == string.hash() && - (isQString()?QHashedString::compare(string.constData(), (QChar *)utf16Data(), length): + (isQString()?QHashedString::compare(string.constData(), (const QChar *)utf16Data(), length): QHashedString::compare(string.constData(), cStrData(), length)); } inline bool equals(const QHashedCStringRef &string) const { return length == string.length() && hash == string.hash() && - (isQString()?QHashedString::compare((QChar *)utf16Data(), string.constData(), length): + (isQString()?QHashedString::compare((const QChar *)utf16Data(), string.constData(), length): QHashedString::compare(string.constData(), cStrData(), length)); } }; diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index d6fd7b96f..23cb69e2f 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -502,17 +502,13 @@ namespace QtQml { } #endif -#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wheader-hygiene" -#endif +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wheader-hygiene") // This is necessary to allow for QtQuick1 and QtQuick2 scenes in a single application. using namespace QtQml; -#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) -#pragma clang diagnostic pop -#endif +QT_WARNING_POP //The C++ version of protected namespaces in qmldir Q_QML_EXPORT bool qmlProtectModule(const char* uri, int majVersion); diff --git a/src/qml/qml/qqmlabstracturlinterceptor.cpp b/src/qml/qml/qqmlabstracturlinterceptor.cpp index e64b33b18..cb57bc214 100644 --- a/src/qml/qml/qqmlabstracturlinterceptor.cpp +++ b/src/qml/qml/qqmlabstracturlinterceptor.cpp @@ -58,7 +58,7 @@ To implement support for a custom networked scheme, see setNetworkAccessManagerFactory. */ -/* +/*! \enum QQmlAbstractUrlInterceptor::DataType Specifies where URL interception is taking place. diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index f17009569..3613c1724 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -44,6 +44,7 @@ #include <private/qqmlcontextwrapper_p.h> #include <private/qqmlbuiltinfunctions_p.h> #include <private/qqmlvmemetaobject_p.h> +#include <private/qqmlvaluetypewrapper_p.h> #include <QVariant> #include <QtCore/qdebug.h> @@ -253,6 +254,11 @@ bool QQmlBinding::write(const QQmlPropertyData &core, QUICK_STORE(QString, result.toQStringNoThrow()) break; default: + if (const QV4::QQmlValueTypeWrapper *vtw = result.as<const QV4::QQmlValueTypeWrapper>()) { + if (vtw->d()->valueType->typeId == core.propType) { + return vtw->write(m_target.data(), core.coreIndex); + } + } break; } } @@ -327,7 +333,7 @@ bool QQmlBinding::write(const QQmlPropertyData &core, const char *propertyType = 0; if (value.userType() == QMetaType::QObjectStar) { - if (QObject *o = *(QObject **)value.constData()) { + if (QObject *o = *(QObject *const *)value.constData()) { valueType = o->metaObject()->className(); QQmlMetaObject propertyMetaObject = QQmlPropertyPrivate::rawMetaObjectForType(QQmlEnginePrivate::get(engine), type); diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp index 56326df97..b056731e9 100644 --- a/src/qml/qml/qqmlcontext.cpp +++ b/src/qml/qml/qqmlcontext.cpp @@ -782,7 +782,7 @@ QString QQmlContextData::findObjectId(const QObject *obj) const if (publicContext) { QQmlContextPrivate *p = QQmlContextPrivate::get(publicContext); for (int ii = 0; ii < p->propertyValues.count(); ++ii) - if (p->propertyValues.at(ii) == QVariant::fromValue((QObject *)obj)) + if (p->propertyValues.at(ii) == QVariant::fromValue(const_cast<QObject *>(obj))) return properties.findId(ii); } diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 70c682ded..9c5e48ae3 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -258,6 +258,18 @@ void QQmlEnginePrivate::activateDesignerMode() on producing the image without blocking the main thread. */ +/*! + \fn QQmlImageProviderBase::imageType() const + + Implement this method to return the image type supported by this image provider. +*/ + +/*! + \fn QQmlImageProviderBase::flags() const + + Implement this to return the properties of this image provider. +*/ + /*! \internal */ QQmlImageProviderBase::QQmlImageProviderBase() { @@ -1355,6 +1367,9 @@ QQmlEngine::ObjectOwnership QQmlEngine::objectOwnership(QObject *object) return ddata->indestructible?CppOwnership:JavaScriptOwnership; } +/*! + \reimp +*/ bool QQmlEngine::event(QEvent *e) { Q_D(QQmlEngine); @@ -1496,16 +1511,28 @@ QQmlDataExtended::~QQmlDataExtended() void QQmlData::NotifyList::layout(QQmlNotifierEndpoint *endpoint) { - if (endpoint->next) - layout(endpoint->next); + // Add a temporary sentinel at beginning of list. This will be overwritten + // when the end point is inserted into the notifies further down. + endpoint->prev = 0; - int index = endpoint->sourceSignal; - index = qMin(index, 0xFFFF - 1); + while (endpoint->next) { + Q_ASSERT(reinterpret_cast<QQmlNotifierEndpoint *>(endpoint->next->prev) == endpoint); + endpoint = endpoint->next; + } + + while (endpoint) { + QQmlNotifierEndpoint *ep = (QQmlNotifierEndpoint *) endpoint->prev; - endpoint->next = notifies[index]; - if (endpoint->next) endpoint->next->prev = &endpoint->next; - endpoint->prev = ¬ifies[index]; - notifies[index] = endpoint; + int index = endpoint->sourceSignal; + index = qMin(index, 0xFFFF - 1); + + endpoint->next = notifies[index]; + if (endpoint->next) endpoint->next->prev = &endpoint->next; + endpoint->prev = ¬ifies[index]; + notifies[index] = endpoint; + + endpoint = ep; + } } void QQmlData::NotifyList::layout() @@ -2182,7 +2209,7 @@ QObject *QQmlEnginePrivate::toQObject(const QVariant &v, bool *ok) const int t = v.userType(); if (t == QMetaType::QObjectStar || m_compositeTypes.contains(t)) { if (ok) *ok = true; - return *(QObject **)(v.constData()); + return *(QObject *const *)(v.constData()); } else { return QQmlMetaType::toQObject(v, ok); } diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp index 7b560268b..d86fbc599 100644 --- a/src/qml/qml/qqmlextensionplugin.cpp +++ b/src/qml/qml/qqmlextensionplugin.cpp @@ -44,71 +44,7 @@ QT_BEGIN_NAMESPACE \ingroup plugins - QQmlExtensionPlugin is a plugin interface that makes it possible to - create QML extensions that can be loaded dynamically into QML applications. - These extensions allow custom QML types to be made available to the QML engine. - - To write a QML extension plugin: - - \list - \li Subclass QQmlExtensionPlugin, implement registerTypes() method to register types - using qmlRegisterType(), and export the class using the Q_PLUGIN_METADATA() macro - \li Write an appropriate project file for the plugin - \li Create a \l{Module Definition qmldir Files}{qmldir file} to describe the plugin - \endlist - - QML extension plugins can be used to provide either application-specific or - library-like plugins. Library plugins should limit themselves to registering types, - as any manipulation of the engine's root context may cause conflicts - or other issues in the library user's code. - - - \section1 An Example - - Suppose there is a new \c TimeModel C++ class that should be made available - as a new QML element. It provides the current time through \c hour and \c minute - properties, like this: - - \snippet qmlextensionplugins/plugin.cpp 0 - \dots - - To make this class available as a QML type, create a plugin that registers - this type with a specific \l {QML Modules}{module} using qmlRegisterType(). For this example the plugin - module will be named \c TimeExample (as defined in the project - file further below). - - \snippet qmlextensionplugins/plugin.cpp plugin - - This registers the \c TimeModel class with the 1.0 version of this - plugin library, as a QML type called \c Time. The Q_ASSERT statement - ensures the module is imported correctly by any QML components that use this plugin. - - The project file defines the project as a plugin library and specifies - it should be built into the \c imports/TimeExample directory: - - \code - TEMPLATE = lib - CONFIG += qt plugin - QT += qml - - DESTDIR = imports/TimeExample - TARGET = qmlqtimeexampleplugin - ... - \endcode - - Finally, a \l{Module Definition qmldir Files}{qmldir file} is required in the \c imports/TimeExample directory - that describes the plugin. This directory includes a \c Clock.qml file that - should be bundled with the plugin, so it needs to be specified in the \c qmldir - file: - - \quotefile qmlextensionplugins/imports/TimeExample/qmldir - - Once the project is built and installed, the new \c Time element can be - used by any QML component that imports the \c TimeExample module: - - \snippet qmlextensionplugins/plugins.qml 0 - - The full source code is available in the \l {qmlextensionplugins}{plugins example}. + \include qqmlextensionplugin.qdocinc The \l {Writing QML Extensions with C++} tutorial also contains a chapter on creating QML plugins. diff --git a/src/qml/qml/qqmlfileselector.cpp b/src/qml/qml/qqmlfileselector.cpp index 3ee7bb304..8597e8a5c 100644 --- a/src/qml/qml/qqmlfileselector.cpp +++ b/src/qml/qml/qqmlfileselector.cpp @@ -102,6 +102,9 @@ QQmlFileSelector::QQmlFileSelector(QQmlEngine* engine, QObject* parent) d->engine->setUrlInterceptor(d->myInstance.data()); } +/*! + Destroys the QQmlFileSelector object. +*/ QQmlFileSelector::~QQmlFileSelector() { Q_D(QQmlFileSelector); diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index cf509a96e..b17bb0455 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1653,7 +1653,7 @@ QString QQmlImportDatabase::resolvePlugin(QQmlTypeLoader *typeLoader, \row \li Unix/Linux \li \c .so \row \li AIX \li \c .a \row \li HP-UX \li \c .sl, \c .so (HP-UXi) - \row \li Mac OS X \li \c .dylib, \c .bundle, \c .so + \row \li OS X \li \c .dylib, \c .bundle, \c .so \endtable Version number on unix are ignored. diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 41629801e..fbb21f456 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -225,6 +225,9 @@ void QQmlType::SingletonInstanceInfo::init(QQmlEngine *e) v4->pushGlobalContext(); QObject *o = qobjectCallback(e, e); setQObjectApi(e, o); + if (!o) { + qFatal("qmlRegisterSingletonType(): \"%s\" is not available because the callback function returns a null pointer.", qPrintable(typeName)); + } // if this object can use a property cache, create it now QQmlData::ensurePropertyCache(e, o); v4->popContext(); @@ -1510,7 +1513,7 @@ QObject *QQmlMetaType::toQObject(const QVariant &v, bool *ok) if (ok) *ok = true; - return *(QObject **)v.constData(); + return *(QObject *const *)v.constData(); } bool QQmlMetaType::isQObject(int userType) diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp index 4ce5be4d1..ea3f7a153 100644 --- a/src/qml/qml/qqmlnotifier.cpp +++ b/src/qml/qml/qqmlnotifier.cpp @@ -51,30 +51,52 @@ static Callback QQmlNotifier_callbacks[] = { QQmlVMEMetaObjectEndpoint_callback }; +namespace { + struct NotifyListTraversalData { + NotifyListTraversalData(QQmlNotifierEndpoint *ep = 0) + : originalSenderPtr(0) + , disconnectWatch(0) + , endpoint(ep) + {} + + qintptr originalSenderPtr; + qintptr *disconnectWatch; + QQmlNotifierEndpoint *endpoint; + }; +} + void QQmlNotifier::emitNotify(QQmlNotifierEndpoint *endpoint, void **a) { - qintptr originalSenderPtr; - qintptr *disconnectWatch; - - if (!endpoint->isNotifying()) { - originalSenderPtr = endpoint->senderPtr; - disconnectWatch = &originalSenderPtr; - endpoint->senderPtr = qintptr(disconnectWatch) | 0x1; - } else { - disconnectWatch = (qintptr *)(endpoint->senderPtr & ~0x1); + QVarLengthArray<NotifyListTraversalData> stack; + while (endpoint) { + stack.append(NotifyListTraversalData(endpoint)); + endpoint = endpoint->next; } - if (endpoint->next) - emitNotify(endpoint->next, a); + int i = 0; + for (; i < stack.size(); ++i) { + NotifyListTraversalData &data = stack[i]; + + if (!data.endpoint->isNotifying()) { + data.originalSenderPtr = data.endpoint->senderPtr; + data.disconnectWatch = &data.originalSenderPtr; + data.endpoint->senderPtr = qintptr(data.disconnectWatch) | 0x1; + } else { + data.disconnectWatch = (qintptr *)(data.endpoint->senderPtr & ~0x1); + } + } - if (*disconnectWatch) { + while (--i >= 0) { + const NotifyListTraversalData &data = stack.at(i); + if (*data.disconnectWatch) { - Q_ASSERT(QQmlNotifier_callbacks[endpoint->callback]); - QQmlNotifier_callbacks[endpoint->callback](endpoint, a); + Q_ASSERT(QQmlNotifier_callbacks[data.endpoint->callback]); + QQmlNotifier_callbacks[data.endpoint->callback](data.endpoint, a); - if (disconnectWatch == &originalSenderPtr && originalSenderPtr) { - // End of notifying, restore values - endpoint->senderPtr = originalSenderPtr; + if (data.disconnectWatch == &data.originalSenderPtr && data.originalSenderPtr) { + // End of notifying, restore values + data.endpoint->senderPtr = data.originalSenderPtr; + } } } } diff --git a/src/qml/qml/qqmlnotifier_p.h b/src/qml/qml/qqmlnotifier_p.h index bd2c0e650..90902c089 100644 --- a/src/qml/qml/qqmlnotifier_p.h +++ b/src/qml/qml/qqmlnotifier_p.h @@ -60,6 +60,8 @@ private: class QQmlEngine; class QQmlNotifierEndpoint { + QQmlNotifierEndpoint *next; + QQmlNotifierEndpoint **prev; public: // QQmlNotifierEndpoint can only invoke one of a set of pre-defined callbacks. // To add another callback, extend this enum and add the callback to the top @@ -103,9 +105,6 @@ private: // The index is in the range returned by QObjectPrivate::signalIndex(). // This is different from QMetaMethod::methodIndex(). signed int sourceSignal:28; - - QQmlNotifierEndpoint *next; - QQmlNotifierEndpoint **prev; }; QQmlNotifier::QQmlNotifier() @@ -137,7 +136,7 @@ void QQmlNotifier::notify() } QQmlNotifierEndpoint::QQmlNotifierEndpoint(Callback callback) -: senderPtr(0), callback(callback), sourceSignal(-1), next(0), prev(0) +: next(0), prev(0), senderPtr(0), callback(callback), sourceSignal(-1) { } diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 414bf8fe0..c1120b454 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -1240,12 +1240,12 @@ bool QQmlPropertyPrivate::write(QObject *object, QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, argv); } else if (variantType == propertyType) { - void *a[] = { (void *)value.constData(), 0, &status, &flags }; + void *a[] = { const_cast<void *>(value.constData()), 0, &status, &flags }; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); } else if (qMetaTypeId<QVariant>() == propertyType) { - void *a[] = { (void *)&value, 0, &status, &flags }; + void *a[] = { const_cast<QVariant *>(&value), 0, &status, &flags }; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); } else if (property.isQObject()) { @@ -1255,7 +1255,7 @@ bool QQmlPropertyPrivate::write(QObject *object, if (valMo.isNull()) return false; - QObject *o = *(QObject **)value.constData(); + QObject *o = *(QObject *const *)value.constData(); QQmlMetaObject propMo = rawMetaObjectForType(enginePriv, propertyType); if (o) valMo = o; @@ -1401,7 +1401,7 @@ bool QQmlPropertyPrivate::write(QObject *object, } if (ok) { - void *a[] = { (void *)v.constData(), 0, &status, &flags}; + void *a[] = { const_cast<void *>(v.constData()), 0, &status, &flags}; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); } else { return false; @@ -1411,7 +1411,6 @@ bool QQmlPropertyPrivate::write(QObject *object, return true; } - QQmlMetaObject QQmlPropertyPrivate::rawMetaObjectForType(QQmlEnginePrivate *engine, int userType) { QMetaType metaType(userType); diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 294f3ccdf..cd8eb0d3e 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -271,7 +271,7 @@ QQmlPropertyCache::~QQmlPropertyCache() stringCache.clear(); if (_parent) _parent->release(); - if (_ownMetaObject) free((void *)_metaObject); + if (_ownMetaObject) free(const_cast<QMetaObject *>(_metaObject)); _metaObject = 0; _parent = 0; engine = 0; diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp index 7ebfcd64b..6a71a07e9 100644 --- a/src/qml/qml/qqmlvaluetype.cpp +++ b/src/qml/qml/qqmlvaluetype.cpp @@ -202,7 +202,7 @@ QQmlValueType::~QQmlValueType() QObjectPrivate *op = QObjectPrivate::get(this); Q_ASSERT(op->metaObject == this); op->metaObject = 0; - ::free((void*)_metaObject); + ::free(const_cast<QMetaObject *>(_metaObject)); metaType.destroy(gadgetPtr); } diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index 08b1e09d7..9f02c905f 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -732,7 +732,7 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) int listIndex = data[id].asInt(); const List *list = &listProperties.at(listIndex); *reinterpret_cast<QQmlListProperty<QObject> *>(a[0]) = - QQmlListProperty<QObject>(object, (void *)list, + QQmlListProperty<QObject>(object, const_cast<List *>(list), list_append, list_count, list_at, list_clear); } @@ -1048,7 +1048,7 @@ void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value) } else { bool needActivate = false; if (value.userType() == QMetaType::QObjectStar) { - QObject *o = *(QObject **)value.data(); + QObject *o = *(QObject *const *)value.data(); needActivate = (data[id].dataType() != QMetaType::QObjectStar || data[id].asQObject() != o); data[id].setValue(o, this, id); } else { diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h index 44809a26f..a320163f2 100644 --- a/src/qml/qml/qqmlvmemetaobject_p.h +++ b/src/qml/qml/qqmlvmemetaobject_p.h @@ -119,7 +119,7 @@ struct QQmlVMEMetaData }; PropertyData *propertyData() const { - return (PropertyData *)(((const char *)this) + sizeof(QQmlVMEMetaData)); + return (PropertyData *)(((char *)const_cast<QQmlVMEMetaData *>(this)) + sizeof(QQmlVMEMetaData)); } AliasData *aliasData() const { diff --git a/src/qml/types/qqmlinstantiator.cpp b/src/qml/types/qqmlinstantiator.cpp index 7626ba5a0..735463a05 100644 --- a/src/qml/types/qqmlinstantiator.cpp +++ b/src/qml/types/qqmlinstantiator.cpp @@ -321,7 +321,7 @@ int QQmlInstantiator::count() const Note that an extra variable, index, will be available inside instances of the delegate. This variable refers to the index of the instance inside the Instantiator, - and can be used to obtain the object through the itemAt method of the Instantiator. + and can be used to obtain the object through the objectAt method of the Instantiator. If this property is changed, all instances using the old delegate will be destroyed and new instances will be created using the new delegate. diff --git a/src/qml/util/qqmllistaccessor.cpp b/src/qml/util/qqmllistaccessor.cpp index 55b745ab6..bebab80d2 100644 --- a/src/qml/util/qqmllistaccessor.cpp +++ b/src/qml/util/qqmllistaccessor.cpp @@ -96,7 +96,7 @@ int QQmlListAccessor::count() const case VariantList: return qvariant_cast<QVariantList>(d).count(); case ListProperty: - return ((QQmlListReference *)d.constData())->count(); + return ((const QQmlListReference *)d.constData())->count(); case Instance: return 1; case Integer: @@ -116,7 +116,7 @@ QVariant QQmlListAccessor::at(int idx) const case VariantList: return qvariant_cast<QVariantList>(d).at(idx); case ListProperty: - return QVariant::fromValue(((QQmlListReference *)d.constData())->at(idx)); + return QVariant::fromValue(((const QQmlListReference *)d.constData())->at(idx)); case Instance: return d; case Integer: diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index afe1b9708..7f43dc2c3 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -67,7 +67,8 @@ excludedirs += ../../imports/models \ examples.fileextensions += "*.qm" -manifestmeta.thumbnail.names += "QtQuick/Threaded ListModel Example" +manifestmeta.thumbnail.names += "QtQuick/Threaded ListModel Example" \ + "QtQuick/QML Dynamic View Ordering Tutorial*" navigation.landingpage = "Qt Quick" navigation.cppclassespage = "Qt Quick C++ Classes" diff --git a/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc b/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc index 4e894e5a3..e03b3a9bf 100644 --- a/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc +++ b/src/quick/doc/src/concepts/modelviewsdata/modelview.qdoc @@ -187,7 +187,7 @@ To visualize data, bind the view's \c model property to a model and the QML provides several types of data models among the built-in set of QML types. In addition, models can be created with Qt C++ and then made - available to the \l{QQmlEngine}{QMLEngine} for use by + available to \l{QQmlEngine} for use by QML components. For information about creating these models, visit the \l{Using C++ Models with Qt Quick Views} and \l{qtqml-typesystem-topic.html#qml-object-types} diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 8fa290b95..9932747dd 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -57,7 +57,11 @@ class QQuickCanvasNode : public QSGSimpleTextureNode public: QQuickCanvasNode() { qsgnode_set_description(this, QStringLiteral("canvasnode")); - setOwnsTexture(true); + setOwnsTexture(false); + } + + ~QQuickCanvasNode() { + delete texture(); } }; diff --git a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp index 782d03f9f..4a2c137aa 100644 --- a/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp +++ b/src/quick/items/context2d/qquickcontext2dcommandbuffer.cpp @@ -92,7 +92,7 @@ namespace { { } - void paint(QPainter *p) const { p->fillRect(m_rect, m_brush); } + void paint(QPainter *p) const Q_DECL_OVERRIDE { p->fillRect(m_rect, m_brush); } QRectF boundingRect() const Q_DECL_OVERRIDE { return m_rect; } private: @@ -109,7 +109,7 @@ namespace { { } - void paint(QPainter *p) const { p->fillPath(m_path, m_brush); } + void paint(QPainter *p) const Q_DECL_OVERRIDE { p->fillPath(m_path, m_brush); } QRectF boundingRect() const Q_DECL_OVERRIDE { return m_path.boundingRect(); } private: @@ -126,7 +126,7 @@ namespace { { } - void paint(QPainter *p) const { p->strokePath(m_path, m_pen); } + void paint(QPainter *p) const Q_DECL_OVERRIDE { p->strokePath(m_path, m_pen); } QRectF boundingRect() const Q_DECL_OVERRIDE { @@ -148,7 +148,7 @@ namespace { { } - void paint(QPainter *p) const { p->drawImage(m_offset, m_image); } + void paint(QPainter *p) const Q_DECL_OVERRIDE { p->drawImage(m_offset, m_image); } QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(m_image.rect()).translated(m_offset); } diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index 4d4648571..2612b855b 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -75,7 +75,7 @@ public: } void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE; - void itemParentChanged(QQuickItem *, QQuickItem *parent); + void itemParentChanged(QQuickItem *, QQuickItem *parent) Q_DECL_OVERRIDE; void updatePosition(); void restartDrag(); void deliverEnterEvent(); diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index 3ce4a8cb4..138045271 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -323,7 +323,7 @@ Item { \qmlproperty point QtQuick::WheelEvent::pixelDelta This property holds the delta in screen pixels and is available in plataforms that - have high-resolution trackpads, such as Mac OS X. + have high-resolution trackpads, such as OS X. The x and y cordinate of this property holds the delta in horizontal and vertical orientation. The value should be used directly to scroll content on screen. diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index fc4a3efb8..ea4398bc7 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1004,7 +1004,8 @@ void QQuickFlickablePrivate::maybeBeginDrag(qint64 currentTimestamp, const QPoin } void QQuickFlickablePrivate::drag(qint64 currentTimestamp, QEvent::Type eventType, const QPointF &localPos, - const QVector2D &deltas, bool overThreshold, bool momentum, const QVector2D &velocity) + const QVector2D &deltas, bool overThreshold, bool momentum, + bool velocitySensitiveOverBounds, const QVector2D &velocity) { Q_Q(QQuickFlickable); bool rejectY = false; @@ -1061,9 +1062,13 @@ void QQuickFlickablePrivate::drag(qint64 currentTimestamp, QEvent::Type eventTyp } return; } - qreal overshoot = (newY - minY) * vData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION; - overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio()); - newY = minY + overshoot; + if (velocitySensitiveOverBounds) { + qreal overshoot = (newY - minY) * vData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION; + overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio()); + newY = minY + overshoot; + } else { + newY = minY + (newY - minY) / 2; + } } else if (newY < maxY && maxY - minY <= 0) { // Overshoot beyond the bottom. But don't wait for momentum phase to end before returning to bounds. if (momentum && vData.atEnd) { @@ -1073,9 +1078,13 @@ void QQuickFlickablePrivate::drag(qint64 currentTimestamp, QEvent::Type eventTyp } return; } - qreal overshoot = (newY - maxY) * vData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION; - overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio()); - newY = maxY - overshoot; + if (velocitySensitiveOverBounds) { + qreal overshoot = (newY - maxY) * vData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION; + overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio()); + newY = maxY - overshoot; + } else { + newY = maxY + (newY - maxY) / 2; + } } } if (!rejectY && stealMouse && dy != 0.0 && dy != vData.previousDragDelta) { @@ -1126,9 +1135,13 @@ void QQuickFlickablePrivate::drag(qint64 currentTimestamp, QEvent::Type eventTyp } return; } - qreal overshoot = (newX - minX) * hData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION; - overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio()); - newX = minX + overshoot; + if (velocitySensitiveOverBounds) { + qreal overshoot = (newX - minX) * hData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION; + overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio()); + newX = minX + overshoot; + } else { + newX = minX + (newX - minX) / 2; + } } else if (newX < maxX && maxX - minX <= 0) { // Overshoot beyond the right. But don't wait for momentum phase to end before returning to bounds. if (momentum && hData.atEnd) { @@ -1138,9 +1151,13 @@ void QQuickFlickablePrivate::drag(qint64 currentTimestamp, QEvent::Type eventTyp } return; } - qreal overshoot = (newX - maxX) * hData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION; - overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio()); - newX = maxX - overshoot; + if (velocitySensitiveOverBounds) { + qreal overshoot = (newX - maxX) * hData.velocity / QML_FLICK_DEFAULTMAXVELOCITY / QML_FLICK_OVERSHOOTFRICTION; + overshoot = QML_FLICK_OVERSHOOT * devicePixelRatio() * EaseOvershoot(overshoot / QML_FLICK_OVERSHOOT / devicePixelRatio()); + newX = maxX - overshoot; + } else { + newX = maxX + (newX - maxX) / 2; + } } } @@ -1210,7 +1227,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) if (q->xflick()) overThreshold |= QQuickWindowPrivate::dragOverThreshold(deltas.x(), Qt::XAxis, event); - drag(currentTimestamp, event->type(), event->localPos(), deltas, overThreshold, false, velocity); + drag(currentTimestamp, event->type(), event->localPos(), deltas, overThreshold, false, false, velocity); } void QQuickFlickablePrivate::handleMouseReleaseEvent(QMouseEvent *event) @@ -1433,7 +1450,7 @@ void QQuickFlickable::wheelEvent(QWheelEvent *event) QVector2D velocity(xDelta / elapsed, yDelta / elapsed); d->lastPosTime = currentTimestamp; d->accumulatedWheelPixelDelta += QVector2D(event->pixelDelta()); - d->drag(currentTimestamp, event->type(), event->posF(), d->accumulatedWheelPixelDelta, true, !d->scrollingPhase, velocity); + d->drag(currentTimestamp, event->type(), event->posF(), d->accumulatedWheelPixelDelta, true, !d->scrollingPhase, true, velocity); event->accept(); } diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h index d7148ca57..65bb3e802 100644 --- a/src/quick/items/qquickflickable_p_p.h +++ b/src/quick/items/qquickflickable_p_p.h @@ -250,7 +250,8 @@ public: void maybeBeginDrag(qint64 currentTimestamp, const QPointF &pressPosn); void drag(qint64 currentTimestamp, QEvent::Type eventType, const QPointF &localPos, - const QVector2D &deltas, bool overThreshold, bool momentum, const QVector2D &velocity); + const QVector2D &deltas, bool overThreshold, bool momentum, + bool velocitySensitiveOverBounds, const QVector2D &velocity); qint64 computeCurrentTime(QInputEvent *event); qreal devicePixelRatio(); diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp index 18e786fea..74abd8cf9 100644 --- a/src/quick/items/qquickframebufferobject.cpp +++ b/src/quick/items/qquickframebufferobject.cpp @@ -329,11 +329,17 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode return n; } +/*! + \reimp +*/ bool QQuickFramebufferObject::isTextureProvider() const { return true; } +/*! + \reimp +*/ QSGTextureProvider *QQuickFramebufferObject::textureProvider() const { Q_D(const QQuickFramebufferObject); @@ -347,6 +353,9 @@ QSGTextureProvider *QQuickFramebufferObject::textureProvider() const return d->node; } +/*! + \reimp +*/ void QQuickFramebufferObject::releaseResources() { // When release resources is called on the GUI thread, we only need to diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index ff928a599..3ac9c6eb1 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -60,19 +60,19 @@ public: { } - qreal position() const { + qreal position() const Q_DECL_OVERRIDE { return rowPos(); } - qreal endPosition() const { + qreal endPosition() const Q_DECL_OVERRIDE { return endRowPos(); } - qreal size() const { + qreal size() const Q_DECL_OVERRIDE { return view->flow() == QQuickGridView::FlowLeftToRight ? view->cellHeight() : view->cellWidth(); } - qreal sectionSize() const { + qreal sectionSize() const Q_DECL_OVERRIDE { return 0.0; } diff --git a/src/quick/items/qquickimage_p.h b/src/quick/items/qquickimage_p.h index a780f9a62..421360bd3 100644 --- a/src/quick/items/qquickimage_p.h +++ b/src/quick/items/qquickimage_p.h @@ -88,7 +88,7 @@ public: bool mipmap() const; void setMipmap(bool use); - virtual void emitAutoTransformBaseChanged() { emit autoTransformChanged(); } + virtual void emitAutoTransformBaseChanged() Q_DECL_OVERRIDE { emit autoTransformChanged(); } Q_SIGNALS: void fillModeChanged(); diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 22290d4fc..32c3e651d 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -4321,7 +4321,6 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const /*! \qmlmethod QtQuick::Item::forceActiveFocus() - \overload Forces active focus on the item. @@ -4334,6 +4333,18 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const \sa activeFocus */ +/*! + Forces active focus on the item. + + This method sets focus on the item and ensures that all ancestor + FocusScope objects in the object hierarchy are also given \l focus. + + The reason for the focus change will be \l [CPP] Qt::OtherFocusReason. Use + the overloaded method to specify the focus reason to enable better + handling of the focus change. + + \sa activeFocus +*/ void QQuickItem::forceActiveFocus() { forceActiveFocus(Qt::OtherFocusReason); @@ -4341,7 +4352,19 @@ void QQuickItem::forceActiveFocus() /*! \qmlmethod QtQuick::Item::forceActiveFocus(Qt::FocusReason reason) + \overload + + Forces active focus on the item with the given \a reason. + + This method sets focus on the item and ensures that all ancestor + FocusScope objects in the object hierarchy are also given \l focus. + \since 5.1 + + \sa activeFocus, Qt::FocusReason +*/ +/*! + \overload Forces active focus on the item with the given \a reason. This method sets focus on the item and ensures that all ancestor diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h index f535963fd..0931db4e5 100644 --- a/src/quick/items/qquickitemview_p_p.h +++ b/src/quick/items/qquickitemview_p_p.h @@ -180,7 +180,7 @@ public: void regenerate(bool orientationChanged=false); void layout(); - virtual void animationFinished(QAbstractAnimationJob *); + virtual void animationFinished(QAbstractAnimationJob *) Q_DECL_OVERRIDE; void refill(); void refill(qreal from, qreal to); void mirrorChange() Q_DECL_OVERRIDE; diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index b08a8cfff..a1d765d6e 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -255,7 +255,7 @@ public: static_cast<QQuickListViewAttached*>(attached)->m_sectionItem = s; } - qreal position() const { + qreal position() const Q_DECL_OVERRIDE { if (section()) { if (view->orientation() == QQuickListView::Vertical) return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -section()->height()-section()->y() : section()->y()); @@ -271,7 +271,7 @@ public: else return (view->effectiveLayoutDirection() == Qt::RightToLeft ? -itemWidth()-itemX() : itemX()); } - qreal size() const { + qreal size() const Q_DECL_OVERRIDE { if (section()) return (view->orientation() == QQuickListView::Vertical ? itemHeight()+section()->height() : itemWidth()+section()->width()); else @@ -280,12 +280,12 @@ public: qreal itemSize() const { return (view->orientation() == QQuickListView::Vertical ? itemHeight() : itemWidth()); } - qreal sectionSize() const { + qreal sectionSize() const Q_DECL_OVERRIDE { if (section()) return (view->orientation() == QQuickListView::Vertical ? section()->height() : section()->width()); return 0.0; } - qreal endPosition() const { + qreal endPosition() const Q_DECL_OVERRIDE { if (view->orientation() == QQuickListView::Vertical) { return (view->verticalLayoutDirection() == QQuickItemView::BottomToTop ? -itemY() diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp index b3e4906c4..8d93c577a 100644 --- a/src/quick/items/qquickpainteditem.cpp +++ b/src/quick/items/qquickpainteditem.cpp @@ -549,6 +549,9 @@ QSGNode *QQuickPaintedItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat return node; } +/*! + \reimp +*/ void QQuickPaintedItem::releaseResources() { Q_D(QQuickPaintedItem); @@ -567,11 +570,17 @@ void QQuickPaintedItem::invalidateSceneGraph() d->node = 0; // Managed by the scene graph, just clear the pointer } +/*! + \reimp +*/ bool QQuickPaintedItem::isTextureProvider() const { return true; } +/*! + \reimp +*/ QSGTextureProvider *QQuickPaintedItem::textureProvider() const { Q_D(const QQuickPaintedItem); diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index e81edecde..cc4cec443 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -140,6 +140,10 @@ void QQuickRenderControlPrivate::cleanup() sg = 0; } +/*! + Constructs a QQuickRenderControl object, with parent + object \a parent. +*/ QQuickRenderControl::QQuickRenderControl(QObject *parent) : QObject(*(new QQuickRenderControlPrivate), parent) { diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index a91e6b47c..924c45587 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -100,6 +100,7 @@ QQuickTextPrivate::ExtraData::ExtraData() , minimumPointSize(12) , nbActiveDownloads(0) , maximumLineCount(INT_MAX) + , lineHeightValid(false) , lineHeightMode(QQuickText::ProportionalHeight) , fontSizeMode(QQuickText::FixedSize) { @@ -421,7 +422,7 @@ void QQuickTextPrivate::updateLayout() } textHasChanged = false; } - } else { + } else if (extra.isAllocated() && extra->lineHeightValid) { ensureDoc(); QTextBlockFormat::LineHeightTypes type; type = lineHeightMode() == QQuickText::FixedHeight ? QTextBlockFormat::FixedHeight : QTextBlockFormat::ProportionalHeight; @@ -2480,6 +2481,7 @@ void QQuickText::setLineHeight(qreal lineHeight) if ((d->lineHeight() == lineHeight) || (lineHeight < 0.0)) return; + d->extra.value().lineHeightValid = true; d->extra.value().lineHeight = lineHeight; d->implicitHeightValid = false; d->updateLayout(); @@ -2511,6 +2513,7 @@ void QQuickText::setLineHeightMode(LineHeightMode mode) return; d->implicitHeightValid = false; + d->extra.value().lineHeightValid = true; d->extra.value().lineHeightMode = mode; d->updateLayout(); diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h index f0469fc8e..f43df691b 100644 --- a/src/quick/items/qquicktext_p_p.h +++ b/src/quick/items/qquicktext_p_p.h @@ -104,6 +104,7 @@ public: int minimumPointSize; int nbActiveDownloads; int maximumLineCount; + bool lineHeightValid : 1; QQuickText::LineHeightMode lineHeightMode; QQuickText::FontSizeMode fontSizeMode; QList<QQuickStyledTextImgTag*> imgTags; diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index 19cdc388f..7bc5fab67 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -225,7 +225,7 @@ bool QQuickTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e) return false; } -// Except for pageup and pagedown, Mac OS X has very different behavior, we don't do it all, but +// Except for pageup and pagedown, OS X has very different behavior, we don't do it all, but // here's the breakdown: // Shift still works as an anchor, but only one of the other keys can be down Ctrl (Command), // Alt (Option), or Meta (Control). diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index cf7e91ffe..dc4e301a3 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -1961,13 +1961,6 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * engine.addTextObject(QPointF(0, 0), format, QQuickTextNodeEngine::Unselected, d->document, pos, textFrame->frameFormat().position()); nodeStart = pos; - } else if (qobject_cast<QTextTable*>(textFrame)) { // To keep things simple, map text tables as one text node - QTextFrame::iterator it = textFrame->begin(); - nodeOffset = d->document->documentLayout()->frameBoundingRect(textFrame).topLeft(); - updateNodeTransform(node, nodeOffset); - while (!it.atEnd()) - engine.addTextBlock(d->document, (it++).currentBlock(), -nodeOffset, d->color, QColor(), selectionStart(), selectionEnd() - 1); - nodeStart = textFrame->firstPosition(); } else { // Having nodes spanning across frame boundaries will break the current bookkeeping mechanism. We need to prevent that. QList<int> frameBoundaries; diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 31549451a..c29acf3c8 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -78,7 +78,7 @@ DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD) and setting \l echoMode to an appropriate value enables TextInput to be used for a password input field. - On Mac OS X, the Up/Down key bindings for Home/End are explicitly disabled. + On OS X, the Up/Down key bindings for Home/End are explicitly disabled. If you want such bindings (on any platform), you will need to construct them in QML. \sa TextEdit, Text diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index 204b135b8..2b7f94d8b 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -596,7 +596,6 @@ void QQuickTextNodeEngine::addGlyphsInRange(int rangeStart, int rangeLength, for (int j=0; j<glyphRuns.size(); ++j) { const QGlyphRun &glyphRun = glyphRuns.at(j); addSelectedGlyphs(glyphRun); - addUnselectedGlyphs(glyphRun); } } @@ -762,11 +761,10 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode, parentNode->addRectangleNode(rect, color); } - // Add all unselected text first + // Add all text with unselected color first for (int i = 0; i < nodes.size(); ++i) { const BinaryTreeNode *node = nodes.at(i); - if (node->selectionState == Unselected) - parentNode->addGlyphs(node->position, node->glyphRun, node->color, style, styleColor, 0); + parentNode->addGlyphs(node->position, node->glyphRun, node->color, style, styleColor, 0); } for (int i = 0; i < imageNodes.size(); ++i) { @@ -823,14 +821,14 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode, for (int i = 0; i < node->ranges.size(); ++i) { const QPair<int, int> &range = node->ranges.at(i); - int rangeLength = range.second - range.first + 1; + int rangeLength = range.second - range.first; if (previousNode != 0) { for (int j = 0; j < previousNode->ranges.size(); ++j) { const QPair<int, int> &otherRange = previousNode->ranges.at(j); - if (range.first <= otherRange.second && range.second >= otherRange.first) { + if (range.first < otherRange.second && range.second > otherRange.first) { int start = qMax(range.first, otherRange.first); int end = qMin(range.second, otherRange.second); - rangeLength -= end - start + 1; + rangeLength -= end - start; if (rangeLength == 0) break; } @@ -841,10 +839,10 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode, for (int j = 0; j < nextNode->ranges.size(); ++j) { const QPair<int, int> &otherRange = nextNode->ranges.at(j); - if (range.first <= otherRange.second && range.second >= otherRange.first) { + if (range.first < otherRange.second && range.second > otherRange.first) { int start = qMax(range.first, otherRange.first); int end = qMin(range.second, otherRange.second); - rangeLength -= end - start + 1; + rangeLength -= end - start; if (rangeLength == 0) break; } diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 501b1073a..99dbf1d83 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -112,7 +112,7 @@ public: } protected: - void timerEvent(QTimerEvent *) + void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE { killTimer(m_timer); m_timer = 0; @@ -1110,7 +1110,6 @@ QQuickWindow::~QQuickWindow() { Q_D(QQuickWindow); - d->animationController->deleteLater(); if (d->renderControl) { QQuickRenderControlPrivate::get(d->renderControl)->windowDestroyed(); } else if (d->windowManager) { @@ -3524,7 +3523,7 @@ QQmlIncubationController *QQuickWindow::incubationController() const slot function needs to finish before execution continues, you must make sure that the connection is direct (see Qt::ConnectionType). - \warning Make very sure that a signal handler for afterRendering() leaves the GL + \warning Make very sure that a signal handler for sceneGraphAboutToStop() leaves the GL context in the same state as it was when the signal handler was entered. Failing to do so can result in the scene not rendering properly. diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 6d0ed4ce9..8632ea0b5 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -1523,6 +1523,7 @@ void Renderer::prepareOpaqueBatches() if (gni->clipList() == gnj->clipList() && gni->geometry()->drawingMode() == gnj->geometry()->drawingMode() + && (gni->geometry()->drawingMode() != GL_LINES || gni->geometry()->lineWidth() == gnj->geometry()->lineWidth()) && gni->geometry()->attributes() == gnj->geometry()->attributes() && gni->inheritedOpacity() == gnj->inheritedOpacity() && gni->activeMaterial()->type() == gnj->activeMaterial()->type() @@ -1621,6 +1622,7 @@ void Renderer::prepareAlphaBatches() if (gni->clipList() == gnj->clipList() && gni->geometry()->drawingMode() == gnj->geometry()->drawingMode() + && (gni->geometry()->drawingMode() != GL_LINES || gni->geometry()->lineWidth() == gnj->geometry()->lineWidth()) && gni->geometry()->attributes() == gnj->geometry()->attributes() && gni->inheritedOpacity() == gnj->inheritedOpacity() && gni->activeMaterial()->type() == gnj->activeMaterial()->type() @@ -2283,6 +2285,7 @@ void Renderer::renderMergedBatch(const Batch *batch) m_currentMaterial = material; QSGGeometry* g = gn->geometry(); + updateLineWidth(g); char const *const *attrNames = program->attributeNames(); for (int i=0; i<batch->drawSets.size(); ++i) { const DrawSet &draw = batch->drawSets.at(i); @@ -2413,24 +2416,7 @@ void Renderer::renderUnmergedBatch(const Batch *batch) offset += a.tupleSize * size_of_type(a.type); } - if (g->drawingMode() == GL_LINE_STRIP || g->drawingMode() == GL_LINE_LOOP || g->drawingMode() == GL_LINES) - glLineWidth(g->lineWidth()); -#if !defined(QT_OPENGL_ES_2) - else if (!QOpenGLContext::currentContext()->isOpenGLES() && g->drawingMode() == GL_POINTS) { - QOpenGLFunctions_1_0 *gl1funcs = 0; - QOpenGLFunctions_3_2_Core *gl3funcs = 0; - if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile) - gl3funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>(); - else - gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>(); - Q_ASSERT(gl1funcs || gl3funcs); - if (gl1funcs) - gl1funcs->glPointSize(g->lineWidth()); - else - gl3funcs->glPointSize(g->lineWidth()); - } -#endif - + updateLineWidth(g); if (g->indexCount()) glDrawElements(g->drawingMode(), g->indexCount(), g->indexType(), iOffset); else @@ -2446,6 +2432,27 @@ void Renderer::renderUnmergedBatch(const Batch *batch) } } +void Renderer::updateLineWidth(QSGGeometry *g) +{ + if (g->drawingMode() == GL_LINE_STRIP || g->drawingMode() == GL_LINE_LOOP || g->drawingMode() == GL_LINES) + glLineWidth(g->lineWidth()); +#if !defined(QT_OPENGL_ES_2) + else if (!QOpenGLContext::currentContext()->isOpenGLES() && g->drawingMode() == GL_POINTS) { + QOpenGLFunctions_1_0 *gl1funcs = 0; + QOpenGLFunctions_3_2_Core *gl3funcs = 0; + if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile) + gl3funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>(); + else + gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>(); + Q_ASSERT(gl1funcs || gl3funcs); + if (gl1funcs) + gl1funcs->glPointSize(g->lineWidth()); + else + gl3funcs->glPointSize(g->lineWidth()); + } +#endif +} + void Renderer::renderBatches() { if (Q_UNLIKELY(debug_render())) { diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index c7b5f7368..d19fa0e17 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -603,6 +603,7 @@ private: void nodeWasRemoved(Node *node); void nodeWasAdded(QSGNode *node, Node *shadowParent); BatchRootInfo *batchRootInfo(Node *node); + void updateLineWidth(QSGGeometry *g); inline Batch *newBatch(); void invalidateAndRecycleBatch(Batch *b); diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index 3f54e13c5..1fd37be84 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -522,7 +522,8 @@ void QSGGeometry::setDrawingMode(GLenum mode) /*! Gets the current line or point width or to be used for this geometry. This property only applies to line width when the drawingMode is \c GL_LINES, \c GL_LINE_STRIP, or - \c GL_LINE_LOOP, and only applies to point size when the drawingMode is \c GL_POINTS. + \c GL_LINE_LOOP. For desktop OpenGL, it also applies to point size when the drawingMode + is \c GL_POINTS. The default value is \c 1.0 @@ -536,7 +537,12 @@ float QSGGeometry::lineWidth() const /*! Sets the line or point width to be used for this geometry to \a width. This property only applies to line width when the drawingMode is \c GL_LINES, \c GL_LINE_STRIP, or - \c GL_LINE_LOOP, and only applies to point size when the drawingMode is \c GL_POINTS. + \c GL_LINE_LOOP. For Desktop OpenGL, it also applies to point size when the drawingMode + is \c GL_POINTS. + + \note How line width and point size are treated is implementation dependent: The application + should not rely on these, but rather create triangles or similar to draw areas. On OpenGL ES, + line width support is limited and point size is unsupported. \sa lineWidth(), drawingMode() */ diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 71f4f62db..51f3976ed 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -806,7 +806,7 @@ void QSGBasicGeometryNode::setGeometry(QSGGeometry *geometry) the vertices and their structure, to be drawn. The Material defines how the shape is filled. - The following is a code snipped illustrating how to create a red + The following is a code snippet illustrating how to create a red line using a QSGGeometryNode: \code QSGGeometry *geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 2); diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 6c7fb89b6..3059b750f 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -34,6 +34,7 @@ #include "qsgrenderloop_p.h" #include "qsgthreadedrenderloop_p.h" #include "qsgwindowsrenderloop_p.h" +#include <private/qquickanimatorcontroller_p.h> #include <QtCore/QCoreApplication> #include <QtCore/QTime> @@ -321,6 +322,8 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window) } else if (gl && window == gl->surface() && current) { gl->doneCurrent(); } + + delete d->animationController; } void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 9a7407b42..4b78fefa9 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -477,11 +477,12 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor, qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- cleanup without an OpenGL context"; } + QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window); + QQuickShaderEffectMaterial::cleanupMaterialCache(); // The canvas nodes must be cleaned up regardless if we are in the destructor.. if (wipeSG) { - QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window); dd->cleanupNodesOnShutdown(); } else { qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- persistent SG, avoiding cleanup"; @@ -493,6 +494,8 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor, sgrc->invalidate(); QCoreApplication::processEvents(); QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + if (inDestructor) + delete dd->animationController; if (current) gl->doneCurrent(); qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- invalidating scene graph"; diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index c571e6001..7fd965161 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -32,7 +32,6 @@ ****************************************************************************/ #include "qsgwindowsrenderloop_p.h" - #include <QtCore/QCoreApplication> #include <QtCore/QLibraryInfo> #include <QtCore/QThread> @@ -47,8 +46,8 @@ #include <QtQuick/QQuickWindow> #include <private/qquickprofiler_p.h> - #include <private/qquickshadereffectnode_p.h> +#include <private/qquickanimatorcontroller_p.h> QT_BEGIN_NAMESPACE @@ -219,6 +218,7 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window) hide(window); QQuickWindowPrivate *d = QQuickWindowPrivate::get(window); + bool current = false; QScopedPointer<QOffscreenSurface> offscreenSurface; if (m_gl) { @@ -245,6 +245,8 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window) } else if (m_gl && current) { m_gl->doneCurrent(); } + + delete d->animationController; } bool QSGWindowsRenderLoop::anyoneShowing() const diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp index 8d38e8302..d9f3c4437 100644 --- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp +++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp @@ -223,9 +223,11 @@ QRectF QSGSimpleTextureNode::sourceRect() const void QSGSimpleTextureNode::setTexture(QSGTexture *texture) { Q_ASSERT(texture); + Q_D(QSGSimpleTextureNode); + if (d->ownsTexture) + delete m_material.texture(); m_material.setTexture(texture); m_opaque_material.setTexture(texture); - Q_D(QSGSimpleTextureNode); qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->sourceRect, d->texCoordMode); DirtyState dirty = DirtyMaterial; diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index 016f41d43..0182f8abf 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -135,7 +135,7 @@ void QQuickAnimatorProxyJob::updateState(QAbstractAnimationJob::State newState, void QQuickAnimatorProxyJob::debugAnimation(QDebug d) const { - d << "QuickAnimatorProxyJob("<< hex << (void *) this << dec + d << "QuickAnimatorProxyJob("<< hex << (const void *) this << dec << "state:" << state() << "duration:" << duration() << "proxying: (" << job() << ')'; } @@ -224,7 +224,7 @@ QQuickAnimatorJob::QQuickAnimatorJob() void QQuickAnimatorJob::debugAnimation(QDebug d) const { - d << "QuickAnimatorJob(" << hex << (void *) this << dec + d << "QuickAnimatorJob(" << hex << (const void *) this << dec << ") state:" << state() << "duration:" << duration() << "target:" << m_target << "value:" << m_value; } diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h index 34c106e89..ca70aecb8 100644 --- a/src/quick/util/qquickanimatorjob_p.h +++ b/src/quick/util/qquickanimatorjob_p.h @@ -63,7 +63,7 @@ public: QQuickAnimatorProxyJob(QAbstractAnimationJob *job, QObject *item); ~QQuickAnimatorProxyJob(); - int duration() const { return m_duration; } + int duration() const Q_DECL_OVERRIDE { return m_duration; } QAbstractAnimationJob *job() const { return m_job; } @@ -72,8 +72,8 @@ public: void markJobManagedByController() { m_jobManagedByController = true; } protected: - void updateCurrentTime(int); - void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState); + void updateCurrentTime(int) Q_DECL_OVERRIDE; + void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState) Q_DECL_OVERRIDE; void debugAnimation(QDebug d) const Q_DECL_OVERRIDE; public Q_SLOTS: @@ -116,7 +116,7 @@ public: qreal to() const { return m_to; } void setDuration(int duration) { m_duration = duration; } - int duration() const { return m_duration; } + int duration() const Q_DECL_OVERRIDE { return m_duration; } QEasingCurve easingCurve() const { return m_easing; } void setEasingCurve(const QEasingCurve &curve) { m_easing = curve; } diff --git a/src/quick/util/qquickprofiler_p.h b/src/quick/util/qquickprofiler_p.h index 2eec9bf87..6b6e7fa06 100644 --- a/src/quick/util/qquickprofiler_p.h +++ b/src/quick/util/qquickprofiler_p.h @@ -259,7 +259,7 @@ public: } template<SceneGraphFrameType FrameType, bool Record> - static void reportSceneGraphFrame(quint64 payload = -1) + static void reportSceneGraphFrame(quint64 payload = ~0) { qint64 *timings = s_instance->m_sceneGraphData.timings<FrameType>(); int &offset = s_instance->m_sceneGraphData.offset<FrameType>(); @@ -275,7 +275,7 @@ public: } template<SceneGraphFrameType FrameType, bool Record, SceneGraphFrameType SwitchTo> - static void reportSceneGraphFrame(quint64 payload = -1) + static void reportSceneGraphFrame(quint64 payload = ~0) { reportSceneGraphFrame<FrameType, Record>(payload); s_instance->m_sceneGraphData.offset<SwitchTo>() = 0; diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp index 6b1768e9e..c41120712 100644 --- a/src/quick/util/qquickstyledtext.cpp +++ b/src/quick/util/qquickstyledtext.cpp @@ -542,6 +542,12 @@ void QQuickStyledTextPrivate::parseEntity(const QChar *&ch, const QString &textI textOut += QChar(38); else if (entity == QLatin1String("quot")) textOut += QChar(34); + else if (entity == QLatin1String("nbsp")) + textOut += QChar(QChar::Nbsp); + return; + } else if (*ch == QLatin1Char(' ')) { + QStringRef entity(&textIn, entityStart - 1, entityLength + 1); + textOut += entity + *ch; return; } ++entityLength; diff --git a/src/quickwidgets/qquickwidget_p.h b/src/quickwidgets/qquickwidget_p.h index 9249fa138..fa8bb3beb 100644 --- a/src/quickwidgets/qquickwidget_p.h +++ b/src/quickwidgets/qquickwidget_p.h @@ -70,7 +70,7 @@ public: ~QQuickWidgetPrivate(); void execute(); - void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); + void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; void initResize(); void updateSize(); void updatePosition(); @@ -82,7 +82,7 @@ public: void destroyContext(); void handleContextCreationFailure(const QSurfaceFormat &format, bool isEs); - QObject *focusObject(); + QObject *focusObject() Q_DECL_OVERRIDE; GLuint textureId() const Q_DECL_OVERRIDE; QImage grabFramebuffer() Q_DECL_OVERRIDE; diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index 2ca3e4299..b61eca730 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -25,7 +25,8 @@ PUBLICTESTS += \ qtqmlmodules \ qquickfolderlistmodel \ qqmlapplicationengine \ - qqmlsettings + qqmlsettings \ + qqmlstatemachine PRIVATETESTS += \ animation \ diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp index 81215f7a1..4f1c9ae53 100644 --- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp +++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp @@ -165,6 +165,7 @@ private slots: void readProperty(); void propertyChange(); void disconnectOnDestroy(); + void lotsOfBindings(); private: void createObjects(); @@ -312,6 +313,39 @@ void tst_qqmlnotifier::disconnectOnDestroy() exportedObject->verifyReceiverCount(); } +class TestObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int a READ a NOTIFY aChanged) + +public: + int a() const { return 0; } + +signals: + void aChanged(); +}; + +void tst_qqmlnotifier::lotsOfBindings() +{ + TestObject o; + QQmlEngine *e = new QQmlEngine; + + e->rootContext()->setContextProperty(QStringLiteral("test"), &o); + + QList<QQmlComponent *> components; + for (int i = 0; i < 20000; ++i) { + QQmlComponent *component = new QQmlComponent(e); + component->setData("import QtQuick 2.0; Item { width: test.a; }", QUrl()); + component->create(e->rootContext()); + components.append(component); + } + + o.aChanged(); + + qDeleteAll(components); + delete e; +} + QTEST_MAIN(tst_qqmlnotifier) #include "tst_qqmlnotifier.moc" diff --git a/tests/auto/qml/qqmlproperty/data/readonlyPrimitiveVsVar.qml b/tests/auto/qml/qqmlproperty/data/readonlyPrimitiveVsVar.qml new file mode 100644 index 000000000..253d61d1d --- /dev/null +++ b/tests/auto/qml/qqmlproperty/data/readonlyPrimitiveVsVar.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 + +QtObject { + readonly property var r_var: 1; + readonly property int r_int: 1; + property var w_var: 1; + property int w_int: 1; +} diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 1d6c2d87f..d6b1c86b8 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -146,6 +146,7 @@ private slots: void warnOnInvalidBinding(); void registeredCompositeTypeProperty(); void deeplyNestedObject(); + void readOnlyDynamicProperties(); void copy(); private: @@ -2039,6 +2040,20 @@ void tst_qqmlproperty::deeplyNestedObject() QCOMPARE(p.read(), QVariant(14)); } +void tst_qqmlproperty::readOnlyDynamicProperties() +{ + QQmlComponent comp(&engine, testFileUrl("readonlyPrimitiveVsVar.qml")); + QObject *obj = comp.create(); + QVERIFY(obj != 0); + + QVERIFY(!obj->metaObject()->property(obj->metaObject()->indexOfProperty("r_var")).isWritable()); + QVERIFY(!obj->metaObject()->property(obj->metaObject()->indexOfProperty("r_int")).isWritable()); + QVERIFY(obj->metaObject()->property(obj->metaObject()->indexOfProperty("w_var")).isWritable()); + QVERIFY(obj->metaObject()->property(obj->metaObject()->indexOfProperty("w_int")).isWritable()); + + delete obj; +} + void tst_qqmlproperty::initTestCase() { QQmlDataTest::initTestCase(); diff --git a/tests/auto/qml/qqmlstatemachine/data/cppsignal.qml b/tests/auto/qml/qqmlstatemachine/data/cppsignal.qml new file mode 100644 index 000000000..3d06d823e --- /dev/null +++ b/tests/auto/qml/qqmlstatemachine/data/cppsignal.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Ford Motor Company +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQml 2.0 + +import QtQml.StateMachine 1.0 + +import CppObjectEnum 1.0 + +StateMachine { + id: stateMachine + initialState: state0 + + State { + id: state0 + SignalTransition { + targetState: state1 + signal: _cppObject.mySignal + // signalState is mySignal's parameter + guard: signalState === CppObject.State1 + } + } + + State { + id: state1 + SignalTransition { + targetState: state2 + signal: _cppObject.mySignal + // signalState is mySignal's parameter + guard: signalState === CppObject.State2 + } + onEntered: _cppObject.objectState = CppObject.State1 + } + + FinalState { + id: state2 + onEntered: _cppObject.objectState = CppObject.State2 + } + Component.onCompleted: stateMachine.running = true +} diff --git a/tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro b/tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro new file mode 100644 index 000000000..002af1d70 --- /dev/null +++ b/tests/auto/qml/qqmlstatemachine/qqmlstatemachine.pro @@ -0,0 +1,11 @@ +CONFIG += testcase +TARGET = tst_qqmlstatemachine +osx:CONFIG -= app_bundle + +SOURCES += tst_qqmlstatemachine.cpp + +include (../../shared/util.pri) + +CONFIG += parallel_test +QT += core-private gui-private qml-private quick-private gui testlib +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp new file mode 100644 index 000000000..0d36b66e3 --- /dev/null +++ b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Ford Motor Company +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QQmlComponent> +#include <QQmlContext> +#include <QQmlEngine> +#include <QTest> +#include "../../shared/util.h" + +class tst_qqmlstatemachine : public QQmlDataTest +{ + Q_OBJECT +public: + tst_qqmlstatemachine(); + +private slots: + void tst_cppObjectSignal(); +}; + + +class CppObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(ObjectState objectState READ objectState WRITE setObjectState NOTIFY objectStateChanged) + Q_ENUMS(ObjectState) +public: + enum ObjectState { + State0, + State1, + State2 + }; + +public: + CppObject() + : QObject() + , m_objectState(State0) + {} + + ObjectState objectState() const { return m_objectState; } + void setObjectState(ObjectState objectState) { m_objectState = objectState; emit objectStateChanged();} + +signals: + void objectStateChanged(); + void mySignal(int signalState); + +private: + ObjectState m_objectState; +}; + +tst_qqmlstatemachine::tst_qqmlstatemachine() +{ + QVERIFY(-1 != qmlRegisterUncreatableType<CppObject>("CppObjectEnum", 1, 0, "CppObject", QString())); +} + +void tst_qqmlstatemachine::tst_cppObjectSignal() +{ + CppObject cppObject; + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("cppsignal.qml")); + QVERIFY(!component.isError()); + + QQmlContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("_cppObject", &cppObject); + QScopedPointer<QObject> rootObject(component.create()); + QVERIFY(rootObject != 0); + + // wait for state machine to start + QTRY_VERIFY(rootObject->property("running").toBool()); + + // emit signal from cpp + emit cppObject.mySignal(CppObject::State1); + + // check if the signal was propagated + QTRY_COMPARE(cppObject.objectState(), CppObject::State1); + + // emit signal from cpp + emit cppObject.mySignal(CppObject::State2); + + // check if the signal was propagated + QTRY_COMPARE(cppObject.objectState(), CppObject::State2); + + // wait for state machine to finish + QTRY_VERIFY(!rootObject->property("running").toBool()); +} + + +QTEST_MAIN(tst_qqmlstatemachine) + +#include "tst_qqmlstatemachine.moc" diff --git a/tests/auto/quick/examples/examples.pro b/tests/auto/quick/examples/examples.pro index 6543aa1b2..3d821fc13 100644 --- a/tests/auto/quick/examples/examples.pro +++ b/tests/auto/quick/examples/examples.pro @@ -10,3 +10,5 @@ CONFIG += parallel_test #temporary QT += core-private gui-private qml-private quick-private testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +!qtHaveModule(xmlpatterns): DEFINES += QT_NO_XMLPATTERNS + diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 175955d66..90c78ec94 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -104,7 +104,9 @@ tst_examples::tst_examples() excludedDirs << "demos/twitter"; excludedDirs << "demos/flickr"; excludedDirs << "demos/photoviewer"; - excludedDirs << "snippets/qml/xmlrole.qml"; + excludedFiles << "snippets/qml/xmlrole.qml"; + excludedFiles << "particles/itemparticle/particleview.qml"; + excludedFiles << "views/visualdatamodel/slideshow.qml"; #endif } diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index b49ce3495..c49f01d5a 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -283,7 +283,7 @@ void NodesTest::textureNodeTextureOwnership() QVERIFY(!texture.isNull()); } - { // Check that it is deleted when we so desire + { // Check that it is deleted on destruction when we so desire QPointer<QSGTexture> texture(new QSGPlainTexture()); QSGSimpleTextureNode *tn = new QSGSimpleTextureNode(); @@ -294,6 +294,25 @@ void NodesTest::textureNodeTextureOwnership() delete tn; QVERIFY(texture.isNull()); } + + { // Check that it is deleted on update when we so desire + QPointer<QSGTexture> oldTexture(new QSGPlainTexture()); + QPointer<QSGTexture> newTexture(new QSGPlainTexture()); + + QSGSimpleTextureNode *tn = new QSGSimpleTextureNode(); + tn->setOwnsTexture(true); + QVERIFY(tn->ownsTexture()); + + tn->setTexture(oldTexture); + QVERIFY(!oldTexture.isNull()); + QVERIFY(!newTexture.isNull()); + + tn->setTexture(newTexture); + QVERIFY(oldTexture.isNull()); + QVERIFY(!newTexture.isNull()); + + delete tn; + } } void NodesTest::textureNodeRect() diff --git a/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml b/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml index 87cba880a..cd0f95bc7 100644 --- a/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml +++ b/tests/auto/quick/qquickanimationcontroller/data/tst_parallelanimation.qml @@ -24,7 +24,7 @@ Rectangle { name:"AnimationController" when:windowShown function test_parallelAnimation_data() { - //FIXME:the commented lines fail on MAC OS X + //FIXME:the commented lines fail on OS X return [ {tag:"0.1",progress:0.1, x:5, y:10, color:"#e50019", width:14, height:14}, //{tag:"0.2",progress:0.2, x:10, y:20, color:"#cb0033", width:18, height:18}, diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml index 5960e5355..93f85107a 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_canvas.qml @@ -677,5 +677,27 @@ CanvasTestCase { waitForRendering(implicitlySizedItem); comparePixel(implicitlySizedItem.canvas.context, xCenter, yCenter, 0, 0, 0, 255); } + + Component { + id: simpleTextureNodeUsageComponent + + Canvas { + id: canvas + anchors.fill: parent + + onPaint: { + var ctx = canvas.getContext("2d"); + ctx.clearRect(0, 0, 200, 200); + } + } + } + + function test_simpleTextureNodeUsage() { + var canvas = simpleTextureNodeUsageComponent.createObject(container); + verify(canvas); + wait(0); + // Shouldn't crash. + canvas.requestPaint(); + } } } diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp index 95e495a74..4678f5fbb 100644 --- a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp +++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp @@ -153,6 +153,8 @@ void tst_qquickstyledtext::textOutput_data() QTest::newRow("space trailing bold") << "this is <b>bold </b>" << "this is bold " << (FormatList() << Format(Format::Bold, 8, 5)) << false; QTest::newRow("img") << "a<img src=\"blah.png\"/>b" << "a b" << FormatList() << false; QTest::newRow("tag mix") << "<f6>ds<b></img><pro>gfh</b><w><w>ghj</stron><ql><sl><pl>dfg</j6><img><bol><r><prp>dfg<bkj></b><up><string>ewrq</al><bl>jklhj<zl>" << "dsgfhghjdfgdfgewrqjklhj" << (FormatList() << Format(Format::Bold, 2, 3)) << false; + QTest::newRow("named html entities") << "> < & " " << QLatin1String("> < & \" ") + QChar(QChar::Nbsp) << FormatList() << false; + QTest::newRow("invalid html entities") << "a &hello & a &goodbye;" << "a &hello & a " << FormatList() << false; } void tst_qquickstyledtext::textOutput() diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 968207016..079f73ae3 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -2419,7 +2419,7 @@ void tst_qquicktextinput::navigation() simulateKey(&window, Qt::Key_Left); QVERIFY(input->hasActiveFocus()); - // Up and Down should NOT do Home/End, even on Mac OS X (QTBUG-10438). + // Up and Down should NOT do Home/End, even on OS X (QTBUG-10438). input->setCursorPosition(2); QCOMPARE(input->cursorPosition(),2); simulateKey(&window, Qt::Key_Up); diff --git a/tests/auto/quick/qquickwindow/BLACKLIST b/tests/auto/quick/qquickwindow/BLACKLIST deleted file mode 100644 index 8a19a679a..000000000 --- a/tests/auto/quick/qquickwindow/BLACKLIST +++ /dev/null @@ -1,4 +0,0 @@ -[cursor] -* -[testWindowVisibilityOrder] -osx diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 2c7a3c933..e1ea068a6 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -1753,14 +1753,6 @@ void tst_qquickwindow::testWindowVisibilityOrder() QTest::qWaitForWindowExposed(window5); QVERIFY(window4->isVisible()); QVERIFY(window5->isVisible()); - window4->hide(); - window5->hide(); - - window3->hide(); - QTRY_COMPARE(window2, QGuiApplication::focusWindow()); - - window2->hide(); - QTRY_COMPARE(window1.data(), QGuiApplication::focusWindow()); } void tst_qquickwindow::blockClosing() diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml new file mode 100644 index 000000000..849e4b859 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + TextEdit { + id: textEdit + text: "и в у" + anchors.centerIn: parent + Component.onCompleted: textEdit.select(2, 3) + font.pixelSize: 14 + } +} diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected_all.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected_all.qml new file mode 100644 index 000000000..9580f28e2 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/textedit_cyrillic_selected_all.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + TextEdit { + id: textEdit + text: "и в у" + anchors.centerIn: parent + Component.onCompleted: textEdit.selectAll() + font.pixelSize: 14 + } +} diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_table_selected.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_table_selected.qml new file mode 100644 index 000000000..749c37904 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/textedit_table_selected.qml @@ -0,0 +1,40 @@ +import QtQuick 2.0 + +Item { + width: 320 + height: 480 + + TextEdit { + id: textEdit + anchors.centerIn: parent + verticalAlignment: Text.AlignBottom + font.family: "Arial" + font.pixelSize: 16 + textFormat: Text.RichText + Component.onCompleted: textEdit.selectAll() + text: + "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + + "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" + + "<body >\n" + + "<table >\n" + + "<tr >\n" + + "<td >\n" + + "Cell 1\n" + + "</td>\n" + + "</tr>\n" + + "<tr >\n" + + "<td >\n" + + "Cell 2\n" + + "</td>\n" + + "</tr>\n" + + "<tr >\n" + + "<td >\n" + + "Cell 3\n" + + "</td>\n" + + "</tr>\n" + + "</table>\n" + + "</body>\n" + + "</html>\n" + + } +} diff --git a/tests/manual/v4/typedarrays.js b/tests/manual/v4/typedarrays.js index d7a863e57..d52fd6bab 100644 --- a/tests/manual/v4/typedarrays.js +++ b/tests/manual/v4/typedarrays.js @@ -67,6 +67,15 @@ function assertArrayEquals(a, b) assertEquals(a[i], b[i]) } +function TestIsViewFalse() { + assertTrue(!ArrayBuffer.isView()); + assertTrue(!ArrayBuffer.isView(42)); + assertTrue(!ArrayBuffer.isView('foo')); + assertTrue(!ArrayBuffer.isView(new ArrayBuffer())); +} + +TestIsViewFalse(); + function TestByteLength(param, expectedByteLength) { var ab = new ArrayBuffer(param); assertSame(expectedByteLength, ab.byteLength); diff --git a/tools/qmlprofiler/qmlprofilerclient.cpp b/tools/qmlprofiler/qmlprofilerclient.cpp index 4bebd7457..72e11eade 100644 --- a/tools/qmlprofiler/qmlprofilerclient.cpp +++ b/tools/qmlprofiler/qmlprofilerclient.cpp @@ -37,6 +37,8 @@ #include <QtCore/QStringList> #include <QtCore/QDataStream> +#include <limits> + ProfilerClient::ProfilerClient(const QString &clientName, QQmlDebugConnection *client) : QQmlDebugClient(clientName, client), diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp index 5d49dc670..ac7b51159 100644 --- a/tools/qmlprofiler/qmlprofilerdata.cpp +++ b/tools/qmlprofiler/qmlprofilerdata.cpp @@ -39,6 +39,8 @@ #include <QFile> #include <QXmlStreamReader> +#include <limits> + const char PROFILER_FILE_VERSION[] = "1.02"; static const char *RANGE_TYPE_STRINGS[] = { |