From 0c51b832f59d536513eaa85732bc02ad72b99455 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 18 Apr 2018 12:23:29 +0200 Subject: Also support reset notification on non-nvidia In 5.11 robustness was added for nvidia drivers, this patch extends that to other opengl drivers, and fixes the reported format. Change-Id: Ia81934c3bcf13e7300fb4e75674ea63317039870 Reviewed-by: Laszlo Agocs --- .../gl_integrations/xcb_glx/qglxintegration.cpp | 40 ++++++++++++++-------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index baf3dbd42a..cc982b3379 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -90,10 +90,18 @@ typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXC #define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 #endif +#ifndef GL_RESET_NOTIFICATION_STRATEGY_ARB +#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#endif + #ifndef GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB #define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 #endif +#ifndef GL_LOSE_CONTEXT_ON_RESET_ARB +#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#endif + #ifndef GLX_LOSE_CONTEXT_ON_RESET_ARB #define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 #endif @@ -157,6 +165,11 @@ static void updateFormatFromContext(QSurfaceFormat &format) format.setOption(QSurfaceFormat::StereoBuffers); if (format.renderableType() == QSurfaceFormat::OpenGL) { + GLint value = 0; + glGetIntegerv(GL_RESET_NOTIFICATION_STRATEGY_ARB, &value); + if (value == GL_LOSE_CONTEXT_ON_RESET_ARB) + format.setOption(QSurfaceFormat::ResetNotification); + if (format.version() < qMakePair(3, 0)) { format.setOption(QSurfaceFormat::DeprecatedFunctions); return; @@ -164,7 +177,7 @@ static void updateFormatFromContext(QSurfaceFormat &format) // Version 3.0 onwards - check if it includes deprecated functionality or is // a debug context - GLint value = 0; + value = 0; glGetIntegerv(GL_CONTEXT_FLAGS, &value); if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)) format.setOption(QSurfaceFormat::DeprecatedFunctions); @@ -302,20 +315,17 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share) contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_ES2_PROFILE_BIT_EXT; } - if (supportsRobustness && supportsVideoMemoryPurge && m_format.testOption(QSurfaceFormat::ResetNotification)) { - QVector contextAttributesWithNvidiaReset = contextAttributes; - - contextAttributesWithNvidiaReset << GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB << GLX_LOSE_CONTEXT_ON_RESET_ARB; - contextAttributesWithNvidiaReset << GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV << GL_TRUE; - - contextAttributesWithNvidiaReset << None; - m_context = glXCreateContextAttribsARB(m_display, config, m_shareContext, true, contextAttributesWithNvidiaReset.data()); - if (!m_context && m_shareContext) { - // re-try without a shared glx context - m_context = glXCreateContextAttribsARB(m_display, config, 0, true, contextAttributesWithNvidiaReset.data()); - if (m_context) - m_shareContext = 0; - } + if (supportsRobustness && m_format.testOption(QSurfaceFormat::ResetNotification)) { + QVector contextAttributesWithRobustness = contextAttributes; + contextAttributesWithRobustness << GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB << GLX_LOSE_CONTEXT_ON_RESET_ARB; + if (supportsVideoMemoryPurge) + contextAttributesWithRobustness << GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV << GL_TRUE; + + contextAttributesWithRobustness << None; + m_context = glXCreateContextAttribsARB(m_display, config, m_shareContext, true, + contextAttributesWithRobustness.data()); + // Context creation against a shared context may fail specifically due to this request, so try + // without before dropping sharing. } if (m_context) { -- cgit v1.2.3 From c579a77f841ed44df25553972f8807110c55808d Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 13 Apr 2018 16:27:36 +0200 Subject: Document libdbus-1 code in Qt D-Bus [ChangeLog][Third-Party Code] Libdbus-1 code in Qt D-Bus is now properly documented. The code is licensed under AFL-2.1 OR GPL-2.0-or-later. Change-Id: I38bd6f38175562fff03ae84fc7a5c435de4cb972 Reviewed-by: Thiago Macieira --- src/dbus/LIBDBUS-1-LICENSE.txt | 157 +++++++++++++++++++++++++++++++++++++ src/dbus/doc/src/qtdbus-index.qdoc | 7 +- src/dbus/qt_attribution.json | 15 ++++ 3 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 src/dbus/LIBDBUS-1-LICENSE.txt create mode 100644 src/dbus/qt_attribution.json diff --git a/src/dbus/LIBDBUS-1-LICENSE.txt b/src/dbus/LIBDBUS-1-LICENSE.txt new file mode 100644 index 0000000000..ff2c19be45 --- /dev/null +++ b/src/dbus/LIBDBUS-1-LICENSE.txt @@ -0,0 +1,157 @@ +Copyright (C) 2002, 2003 CodeFactory AB +Copyright (C) 2004, 2005 Red Hat, Inc. + +Licensed under the Academic Free License version 2.1 + +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 2 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, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +--- + +The Academic Free License +v.2.1 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following notice immediately following the copyright notice for the Original Work: + +Licensed under the Academic Free License version 2.1 + + 1) Grant of Copyright License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license to do the following: + a) to reproduce the Original Work in copies; + b) to prepare derivative works ("Derivative Works") based upon the Original Work; + c) to distribute copies of the Original Work and Derivative Works to the public; + d) to perform the Original Work publicly; and + e) to display the Original Work publicly. + 2) Grant of Patent License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, to make, use, sell and offer for sale the Original Work and Derivative Works. + 3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor hereby agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work, and by publishing the address of that information repository in a notice immediately following the copyright notice that applies to the Original Work. + 4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior written permission of the Licensor. Nothing in this License shall be deemed to grant any rights to trademarks, copyrights, patents, trade secrets or any other intellectual property of Licensor except as expressly stated herein. No patent license is granted to make, use, sell or offer to sell embodiments of any patent claims other than the licensed claims defined in Section 2. No right is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under different terms from this License any Original Work that Licensor otherwise would have a right to license. + 5) This section intentionally omitted. + 6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + 7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately proceeding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to Original Work is granted hereunder except under this disclaimer. + 8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to any person for any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to liability for death or personal injury resulting from Licensor's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You. + 9) Acceptance and Termination. If You distribute copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. Nothing else but this License (or another written agreement between Licensor and You) grants You permission to create Derivative Works based upon the Original Work or to exercise any of the rights granted in Section 1 herein, and any attempt to do so except under the terms of this License (or another written agreement between Licensor and You) is expressly prohibited by U.S. copyright law, the equivalent laws of other countries, and by international treaty. Therefore, by exercising any of the rights granted to You in Section 1 herein, You indicate Your acceptance of this License and all of its terms and conditions. + 10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + 11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et seq., the equivalent laws of other countries, and international treaty. This section shall survive the termination of this License. + 12) Attorneys Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + 13) Miscellaneous. This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + 14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + 15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + +This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved. +Permission is hereby granted to copy and distribute this license without modification. This license may not be modified without the express written permission of its copyright owner. + + +--- + +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 , USA + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) 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 this service 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 make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. 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. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + + Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + + You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + + In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + + The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + + If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + + If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + + It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + + This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + 9. The Free Software Foundation may publish revised and/or new versions of the 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 a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + + NO WARRANTY + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 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. + +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 convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 , USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author Gnomovision 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, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. + +, 1 April 1989 Ty Coon, President of Vice diff --git a/src/dbus/doc/src/qtdbus-index.qdoc b/src/dbus/doc/src/qtdbus-index.qdoc index eed5e42731..18a4aa6d0f 100644 --- a/src/dbus/doc/src/qtdbus-index.qdoc +++ b/src/dbus/doc/src/qtdbus-index.qdoc @@ -200,7 +200,7 @@ Information about the messages will be written to the console the application was launched from. - \section1 Licenses + \section1 Licenses and Attributions The Qt D-Bus module is available under commercial licenses from \l{The Qt Company}. In addition, it is available under free software licenses. Since Qt 5.4, @@ -209,6 +209,11 @@ the \l{GNU General Public License, version 2}. See \l{Qt Licensing} for further details. + Furthermore, Qt D-Bus in Qt \QtVersion may contain third party + modules under following permissive licenses: + + \generatelist{groupsbymodule attributions-qtdbus} + \section1 Further Reading The following documents contain information about Qt's D-Bus integration diff --git a/src/dbus/qt_attribution.json b/src/dbus/qt_attribution.json new file mode 100644 index 0000000000..52636ba89b --- /dev/null +++ b/src/dbus/qt_attribution.json @@ -0,0 +1,15 @@ +{ + "Id": "libdbus-1-headers", + "Name": "libdus-1 headers", + "QDocModule": "qtdbus", + "QtUsage": "Qt D-Bus uses constants and typedefs from libdbus-1 headers.", + + "Description": "D-Bus is a message bus system, a simple way for applications to talk to one another.", + "Homepage": "https://www.freedesktop.org/wiki/Software/dbus/", + "LicenseId": "AFL-2.1 OR GPL-2.0-or-later", + "License": "Academic Free License v2.1, or GNU General Public License v2.0 or later", + "LicenseFile": "LIBDBUS-1-LICENSE.txt", + "Files": "dbus_minimal_p.h", + "Copyright": "Copyright (C) 2002, 2003 CodeFactory AB +Copyright (C) 2004, 2005 Red Hat, Inc." +} -- cgit v1.2.3 From 8c57663ed21855ad6b888bd01785b7f4e9251ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Tue, 24 Apr 2018 10:00:03 +0200 Subject: Fix documentation of setBackendConfigurationOption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduced by mistake in f55c73ede28d4455f555a28e401407326ac9b954 Change-Id: Ieac8fc0a6bb536e5ef3770a22785fe41d4033ee9 Reviewed-by: Mårten Nordheim Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslconfiguration.cpp | 8 ++++---- src/network/ssl/qsslconfiguration.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index 116a6693c4..1071662d96 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -876,7 +876,7 @@ void QSslConfiguration::setDiffieHellmanParameters(const QSslDiffieHellmanParame Returns the backend-specific configuration. - Only options set by addBackendConfiguration() or setBackendConfiguration() will be + Only options set by setBackendConfigurationOption() or setBackendConfiguration() will be returned. The internal standard configuration of the backend is not reported. \sa setBackendConfigurationOption(), setBackendConfiguration() @@ -916,13 +916,13 @@ void QSslConfiguration::setBackendConfigurationOption(const QByteArray &name, co Without a \a backendConfiguration parameter this function will clear the backend-specific configuration. More information about the supported - options is available in the documentation of addBackendConfiguration(). + options is available in the documentation of setBackendConfigurationOption(). \sa backendConfiguration(), setBackendConfigurationOption() */ -void QSslConfiguration::setBackendConfiguration(const QMap &backendConfig) +void QSslConfiguration::setBackendConfiguration(const QMap &backendConfiguration) { - d->backendConfig = backendConfig; + d->backendConfig = backendConfiguration; } /*! diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h index a5561d9828..fe4181d755 100644 --- a/src/network/ssl/qsslconfiguration.h +++ b/src/network/ssl/qsslconfiguration.h @@ -152,7 +152,7 @@ public: QMap backendConfiguration() const; void setBackendConfigurationOption(const QByteArray &name, const QVariant &value); - void setBackendConfiguration(const QMap &backendConfig = QMap()); + void setBackendConfiguration(const QMap &backendConfiguration = QMap()); static QSslConfiguration defaultConfiguration(); static void setDefaultConfiguration(const QSslConfiguration &configuration); -- cgit v1.2.3 From 967bb3f0d8d8c65bd1e09011d9daac21ab51b585 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 19 Apr 2018 17:12:15 +0200 Subject: syncqt: don't write INJECTED_*HEADERS these are actually redundant with INJECTIONS. Change-Id: I0a71930401e00d30c9898b4d958de5e89c496d18 Reviewed-by: Joerg Bornemann Reviewed-by: Alexandru Croitor --- bin/syncqt.pl | 13 ++----------- mkspecs/features/qt_module_headers.prf | 8 ++++---- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/bin/syncqt.pl b/bin/syncqt.pl index c6aced4412..3616db6f4b 100755 --- a/bin/syncqt.pl +++ b/bin/syncqt.pl @@ -922,9 +922,7 @@ foreach my $lib (@modules_to_sync) { #information used after the syncing my $pri_install_gfiles = ""; my $pri_install_files = ""; - my $pri_install_ifiles = ""; my $pri_install_pfiles = ""; - my $pri_install_ipfiles = ""; my $pri_install_qpafiles = ""; my $pri_injections = ""; my $pri_clean_files = ""; @@ -1092,9 +1090,7 @@ foreach my $lib (@modules_to_sync) { $injection .= ":$class"; } - if ($shadow) { - $pri_install_ifiles .= "$pri_install_iheader "; - } else { + if (!$shadow) { # put it into the master file $master_contents{$public_header} = $requires if (shouldMasterInclude($iheader)); @@ -1106,10 +1102,7 @@ foreach my $lib (@modules_to_sync) { elsif ($qpa_header) { $pri_install_qpafiles.= "$pri_install_iheader ";; } - elsif ($shadow) { - $pri_install_ipfiles .= "$pri_install_iheader "; - } - else { + elsif (!$shadow) { $pri_install_pfiles.= "$pri_install_iheader ";; } $pri_injections .= fixPaths($iheader, "$out_basedir/include/$lib") @@ -1232,10 +1225,8 @@ foreach my $lib (@modules_to_sync) { #handle the headers.pri for each module my $headers_pri_contents = ""; $headers_pri_contents .= "SYNCQT.HEADER_FILES = $pri_install_files\n"; - $headers_pri_contents .= "SYNCQT.INJECTED_HEADER_FILES = $pri_install_ifiles\n"; $headers_pri_contents .= "SYNCQT.GENERATED_HEADER_FILES = $pri_install_gfiles\n"; $headers_pri_contents .= "SYNCQT.PRIVATE_HEADER_FILES = $pri_install_pfiles\n"; - $headers_pri_contents .= "SYNCQT.INJECTED_PRIVATE_HEADER_FILES = $pri_install_ipfiles\n"; $headers_pri_contents .= "SYNCQT.QPA_HEADER_FILES = $pri_install_qpafiles\n"; $headers_pri_contents .= "SYNCQT.CLEAN_HEADER_FILES = $pri_clean_files\n"; $headers_pri_contents .= "SYNCQT.INJECTIONS = $pri_injections\n"; diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf index 38e293db9e..7d97fb083a 100644 --- a/mkspecs/features/qt_module_headers.prf +++ b/mkspecs/features/qt_module_headers.prf @@ -114,8 +114,6 @@ syncQtResolve(HEADER_FILES, $$_PRO_FILE_PWD_) syncQtResolve(PRIVATE_HEADER_FILES, $$_PRO_FILE_PWD_) syncQtResolve(QPA_HEADER_FILES, $$_PRO_FILE_PWD_) syncQtResolve(GENERATED_HEADER_FILES, $$INC_PATH/include/$$MODULE_INCNAME) -syncQtResolve(INJECTED_HEADER_FILES, $$OUT_PWD) -syncQtResolve(INJECTED_PRIVATE_HEADER_FILES, $$OUT_PWD) !lib_bundle: \ # Headers are embedded into the bundle, so don't install them separately. CONFIG += qt_install_headers @@ -128,8 +126,6 @@ exists($$OUT_PWD/qt$${MODULE}-config.h) { SYNCQT.INJECTIONS += \ $$fwd_rel/qt$${MODULE}-config.h:qt$${MODULE}-config.h \ $$fwd_rel/qt$${MODULE}-config_p.h:$$MODULE_VERSION/$$MODULE_INCNAME/private/qt$${MODULE}-config_p.h - SYNCQT.INJECTED_HEADER_FILES += $$OUT_PWD/qt$${MODULE}-config.h - SYNCQT.INJECTED_PRIVATE_HEADER_FILES += $$OUT_PWD/qt$${MODULE}-config_p.h } for (injection, SYNCQT.INJECTIONS) { @@ -142,6 +138,10 @@ for (injection, SYNCQT.INJECTIONS) { write_file($$MAIN_FWD, MAIN_FWD_CONT)|error() equals(fwd_hdr, ofwd_hdr): touch($$MAIN_FWD, $$dst_hdr) !git_build: QMAKE_DISTCLEAN += $$MAIN_FWD + !contains(ofwd_hdr, .*/private/.*): \ + SYNCQT.INJECTED_HEADER_FILES += $$dst_hdr + else: \ + SYNCQT.INJECTED_PRIVATE_HEADER_FILES += $$dst_hdr injects = $$member(injects, 2, -1) for (inject, injects) { CLASS_FWD = $$MODULE_INC_OUTDIR/$$inject -- cgit v1.2.3 From e46f9d68d8a8cc75c011fb304f064b927a784d56 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 19 Apr 2018 18:19:13 +0200 Subject: syncqt: fix CamelCase aliases for injected headers don't put them into GENERATED_HEADER_FILES, as they obviously cannot be found in a pre-synced source dir. instead, let the injection code itself add them to INJECTED_HEADER_FILES. Task-number: QTBUG-67813 Change-Id: Id2a7c565b14fcba8aba9d1dd8b1dd39c586d0d91 Reviewed-by: Joerg Bornemann Reviewed-by: Alexandru Croitor --- bin/syncqt.pl | 2 +- mkspecs/features/qt_module_headers.prf | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/syncqt.pl b/bin/syncqt.pl index 3616db6f4b..f202599fe0 100755 --- a/bin/syncqt.pl +++ b/bin/syncqt.pl @@ -1086,7 +1086,7 @@ foreach my $lib (@modules_to_sync) { # } my $class_header = "$class "; $pri_install_gfiles .= $class_header - unless($pri_install_gfiles =~ $class_header); + unless ($shadow || $pri_install_gfiles =~ $class_header); $injection .= ":$class"; } diff --git a/mkspecs/features/qt_module_headers.prf b/mkspecs/features/qt_module_headers.prf index 7d97fb083a..e45ac94966 100644 --- a/mkspecs/features/qt_module_headers.prf +++ b/mkspecs/features/qt_module_headers.prf @@ -149,6 +149,7 @@ for (injection, SYNCQT.INJECTIONS) { write_file($$CLASS_FWD, CLASS_FWD_CONT)|error() touch($$CLASS_FWD, $$MAIN_FWD) !git_build: QMAKE_DISTCLEAN += $$CLASS_FWD + SYNCQT.INJECTED_HEADER_FILES += $$CLASS_FWD } } -- cgit v1.2.3 From 8863b8f24fc0751d9b8015b7f1344f76942dbb82 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 24 Apr 2018 10:38:03 -0700 Subject: QSysInfo: Correct the \since for {machine,boot}UniqueId() The code was written before 5.10 was released, but took long to be merged. Change-Id: If90a92b041d3442fa0a4fffd15286fe079b058e1 Reviewed-by: Edward Welbourne --- src/corelib/global/qglobal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b75b218201..ad015ee048 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2856,7 +2856,7 @@ enum { }; /*! - \since 5.10 + \since 5.11 Returns a unique ID for this machine, if one can be determined. If no unique ID could be determined, this function returns an empty byte array. @@ -2929,7 +2929,7 @@ QByteArray QSysInfo::machineUniqueId() } /*! - \since 5.10 + \since 5.11 Returns a unique ID for this machine's boot, if one can be determined. If no unique ID could be determined, this function returns an empty byte -- cgit v1.2.3 From a7863a58545a6c59eaf16f36905efcbf0e4f94f9 Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Fri, 20 Apr 2018 14:18:25 +0300 Subject: Add changes file for Qt 5.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Done-with: Thiago Macieira Done-with: Oswald Buddenhagen Done-with: Richard Moe Gustavsen Done-with: Timur Pocheptsov Done-with: Mårten Nordheim Done-with: Lars Knoll Change-Id: I7584f8d010ab6abffcd5c92ac6192a04dc20074d Reviewed-by: Thiago Macieira Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne Reviewed-by: Lars Knoll --- dist/changes-5.11.0 | 399 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 399 insertions(+) create mode 100644 dist/changes-5.11.0 diff --git a/dist/changes-5.11.0 b/dist/changes-5.11.0 new file mode 100644 index 0000000000..7f3bdf4b9b --- /dev/null +++ b/dist/changes-5.11.0 @@ -0,0 +1,399 @@ +Qt 5.11 introduces many new features and improvements as well as bugfixes +over the 5.10.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.11 series is binary compatible with the 5.10.x series. +Applications compiled for 5.10 will continue to run with 5.11. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + + - [QTBUG-63150] Characters invalid in XML, such as 0x0 or 0xfffe, as well + as strings containing unmatched UTF-16 surrogates are now suppressed + from the output of QXmlStreamWriter and cause the error flag to be set. + + - Logging (including qDebug and qWarning): + * The QT_LOGGING_TO_CONSOLE environment variable has been deprecated. + Use the more specific QT_ASSUME_STDERR_HAS_CONSOLE or + QT_FORCE_STDERR_LOGGING, depending on your usecase. + +**************************************************************************** +* General Notes * +**************************************************************************** + +Deprecation Notices +------------------- + + - Microsoft Visual Studio 2013 (compiler version 12.0) is no longer + supported with this Qt version. + - macOS 10.10 is no longer supported with this Qt version. + +Third-Party Code +---------------- + + - Removed attribution for QTemporaryFile: The original code got rewritten. + - Documented use of "Unicode Character Database (UCD)" in Qt Core. + - Clarified use of "Unicode Common Local Data Repository (CLDR)" in the + documentation. Also updated SPDX license name / ID. + - Sqlite was updated to version 3.23.1 + - Libdbus-1 code in Qt D-Bus is now properly documented. The code is + licensed under AFL-2.1 OR GPL-2.0-or-later. + - Bundled HarfBuzz-NG copy updated to 1.7.4. + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + + - [QTBUG-38156] Apple Unified Logging is now supported on Apple platforms. + + - QAbstractItemModel: + * Added QAbstractItemModel::checkIndex(), a debugging function for + QAbstractItemModel subclasses. + + - QBitArray: + * Added fromBits(), which creates a QBitArray from a dense bit array, + and bits(), which returns that. + + - QDateTime: + * [QTBUG-64401] Years up to 9999 can now be parsed without error + (previously 8000 and beyond were treated as invalid) in all formats + (not only in ISO format). Widgets handling dates now support dates to + 9999, likewise. + * [QTBUG-63072] When parsing dates and times from strings, fixed-width + date-time fields, such as a "dd" for day, QDateTime now rejects all + values that should be padded, rather than only doing so when the value + is a prefix of some value that would fill the field-width. Use a + single letter for the field, e.g. "d" for day, if you want to accept + short values. (QDateTimeEdit is not affected.) + + - QJsonValue: + * fromVariant() conversion now converts from QUrl and QUuid using + special encoding forms to ensure best JSON compatibility. + + - QLockFile: + * [QTBUG-63425] QLockFile can now properly conclude that a lock file + from a previous boot of the same device is stale and can be removed. + This is implemented only for Linux and Apple operating systems. + + - QMetaObject: + * [QTBUG-66744] It is now possible to use template class instances + inheriting from a Q_GADGET in Qml. + + - QSaveFile: + * [QTBUG-66268] Fixed an issue that would cause QSaveFile::commit() to + fail if Unix signals were delivered at the same time. + + - QScopedPointer: + * Added get(), for compatibility with std::shared_ptr. + + - QSharedPointer: + * Added get(), for compatibility with std::shared_ptr. + + - QString: + * Added remove() overload taking QLatin1String. + + - QStringBuilder: + * Added support for char16_t characters and strings. + * Added support for QStringView. + + - QSysInfo: + * [QTBUG-63425] Added machineUniqueId() and bootUniqueId(). + + - QThread: + * [QTBUG-53357] Changed how Qt thread priorities are mapped to QNX + system thread priorities. + + - QUrl: + * Fixed a bug in parsing IPv6 addresses with more than 4 hex digits in a + component. + + - QUuid: + * Added a parameter to both toString() and toByteArray() to allow + controlling the use or not of the braces and dashes in the string + form. + + - QVarLengthArray: + * Added rvalue overloads of prepend and insert. + * QVarLengthArray can now contain movable but non-copyable types, such as + std::unique_ptr. + * Added missing rvalue overload of operator+=() and operator<<(). + + - QVariant: + * Conversions of QDateTime to strings now contain the millisecond + components. + + - QVector: + * Added rvalue overloads of prepend and insert. + * Added missing rvalue overload of operator+=() and operator<<() + +QtGui +----- + + - [QTBUG-59762] The QT_QPA_PLATFORM environment variable and the -platform + argument now support a list of platform plugins in prioritized + order. Platforms are separated by semicolons. + + - QGuiApplication: + * Added fontChanged() signal. + + - QIcon: + * [QTBUG-33123] Added fallbackSearchPaths() that will be used to find + icons missing in the current icon theme. + + - QStaticText: + * [QTBUG-65836] Fixed explicitly set width not being respected. + + - Text: + * [QTBUG-45957] Fixed a bug where QStaticText would not use the + QPainter's pen color for text when other text colors were also in use. + Internally this reserves QColor(0, 0, 0, 0) for use with QStaticText. + * Added QFontMetrics::horizontalAdvance() and + QFontMetricsF::horizontalAdvance() to replace the confusingly named + width() function. The latter has now been deprecated. + * [QTBUG-65345] Fixed an issue where changing the letter spacing type of + a QTextCharFormat would not cause its font to update. + +QtNetwork +--------- + + - QHostAddress: + * Added isGlobal(), isLinkLocal(), isSiteLocal(), + isUniqueLocalUnicast(), and isBroadcast() classification functions to + complement isLoopback() and isMulticast(). + * Fixed a bug in parsing IPv6 addresses with more than 4 hex digits in a + component. + +- QNetworkAccessManager: + * [QTBUG-61397] Added Http2DirectAttribute to enable 'direct' HTTP/2 + protocol without ALPN/NPN and without protocol upgrade negotiations. + * [QTBUG-66913] Fixed a crash in HTTP/2 protocol handler (when server + responds with redirect or some error status code early, not wating + for a stream to be closed on client side). + + - QNetworkInterface: + * Added type(). + * Added maximumTransmissionUnit(). + * Added preferredLifetime() and validityLifetime() to + QNetworkAddressEntry that report the remaining lifetime of the address + in the network interface. + * Added dnsEligibility() to QNetworkAddressEntry to indicate whether the + address is eligible or not for publication in DNS or similar + mechanisms. + * [QTBUG-67226] Fixed a regression in reporting the local address of a + point-to-point tunnel network interface. + + - QSslSocket: + * [QTBUG-67584] When using OpenSSL 1.1, it now correctly sets protocol + version for QSsl::TlsV1_0, QSsl::TlsV1_1 and QSsl::TlsV1_2. + * [QTBUG-67112] On WinRT QSsl::SecureProtocols (default) now enables + TLSv1.1 and TLSv1.2. + * On WinRT QSsl::TlsV1SslV3 now enables SSLv3 and not just TLSv1. + +QtPrintSupport +-------------- + + - Larger improvements to the CUPS print dialog. + * Added an advanced options tab in the printer properties, containing + all the printer options exposed through the CUPS API. + * Implemented support for installable options (add-ons to the printer). + * Added support for storing the selected settings between application runs. + * Added support for localized options in the advanced tab. + * The CUPS print dialog now supports printing of arbitrary ranges. + + - QPrintDialog + * [QTBUG-58733] Fixed handling of custom page sizes. + +QtSql +----- + + - OCI support: + * [QTBUG-23] Added support for the TIMESTAMP data type. + + - PostgreSQL support: + * [QTBUG-63714] Added support for forward-only queries (requires libpq + version 9.2 or later). + * Added support for multiple result sets. + + - QSqlDatabase: + * [QTBUG-216] QSqlDatabase::database() will return an invalid + QSqlDatabase if the calling thread does not own the requested + QSqlDatabase. + +QtTest +------ + + - The qtest_global.h header is now deprecated. Include qttestglobal.h + instead. + - Added QAbstractItemModelTester, a class to help testing item models. + +QtWidgets +--------- + + - [QTBUG-62094] QDesktopWidget has been deprecated. Use the corresponding + QScreen functions instead. + - [QTBUG-49374][QTBUG-65237][QTBUG-49374] Fixed several issues related + to HiDPI support in QStyle. + + - Item views: + * [QTBUG-48725] QTreeView now calls canFetchMore() and fetchMore() when + the bottom of the QTreeView is scrolled to. + * [QTBUG-65082] Add ability to show QJsonValue::Bool/Double to + QTreeView, QTableView and QListView. + + - QAbstractItemModel: + * Implemented improved support for the optional "role" parameter in the + "dataChanged" signal. + + - QColorDialog: + * [QTBUG-64500] Fixed persistence of custom colors when relaunching an + application. + + - QHeaderView: + * Flat treeviews can now allow the user to move the first column (like + in Qt 4.x) using the new method QHeaderView::setFirstSectionMovable(). + * MinimumSectionSize/MaximumSectionSize is now respected when calling + resizeSection(). + + - QLineEdit: + * Implemented quick text selection by mouse in QLineEdit. + * Placeholder text is now used as accessible description if the latter + has not been set. + + - QListView: + * QListView now honors css :first/:middle/:last Pseudo-States. + + - QMenu: + * [QTBUG-25669] Fixed a bug in QMenu that caused QMenuBar::triggered() to + be fired multiple times. + + - QMenuBar: + * Added overloads of addAction() using Qt 5 signals and slots. + + - QStandardItemModel: + * [QTBUG-45114][QTBUG-10872] Fixed setItemData() incorrectly deleting + unmodified data. That behavior is not following QAbstractItemModel's + documented behavior which is no modification of data not provided in + parameter. + + - QStyle: + * [QTBUG-53094] Added SH_ComboBox_AllowWheelScrolling as a style hint to + enable/disable the use of the mouse wheel in a QComboBox. This + defaults to true in all styles except the macOS one so there is no + change in existing behavior. + + - QTextEdit/QPlainTextEdit + * [QTBUG-63868] context menus will now open on right mouse click even if + the focus policy is Qt::NoFcous (allowing text copy). + + - QTreeWidgetItem: + * QTreeWidgetItem::insertChildren now ignores insertions happening at + invalid indices, for consistency with QTreeWidgetItem::insertChild. + +**************************************************************************** +* Platform-specific Changes * +**************************************************************************** + +Android +------- + + - The application and dependent Qt libraries are now loaded on the same + thread as main() is run on, ensuring that global static initializers, + constructor functions, and main() are all run on the same thread. The + same applies during application shutdown, for destructors of global + objects, and destructor functions. + +Linux/EGLFS +----------- + + - [QTBUG-63088] The DRM+GBM backend now exposes the DRM/GBM device handle + under the key "dri_fd", queriable via nativeResourceForIntegration(). + +Linux/XCB +--------- + + - [QTBUG-56452] Added missing dead key symbols, enabling their use with + the "compose" input module. + - Added support for flatpak portals. Flatpak is a software utility for + software deployment and package management. It provides a sandbox + environment in which users can run applications in isolation from the + rest of the system. To communicate with the system flatpak uses portals, + which are designed to be a bridge between sandboxed applications and + desktop/system running on user's computer. Flatpak runs automatically + this as service, called xdg-desktop-portal, which exports portals on DBus + and which are by default visible to all applications running under + Flatpak. + - [QTBUG-44938] Qt now falls back to X11 core keycode information if an XKB + keymap could not be determined through the connection. + + - ibus: + * Support ForwardKeyEvent signal + +Windows +------- + + - [QTPM-487][QTBUG-53024][QTBUG-43190][QTBUG-61926][QTBUG-38499] + [QTBUG-38337][QTBUG-38501][QTBUG-38502][QTBUG-38504][QTBUG-38505] + [QTBUG-38507] The Windows Accessibility back end, formerly based on + Microsoft Active Accessibility, was replaced with a new implementation + based on Microsoft UI Automation. + + - [QTBUG-44594] Added support for End-User Defined Characters in Qt. + +iOS +--- + + - [QTBUG-59042] The Apple Pencil now generates QTabletEvents, with the + complete feature set (tilt, rotation, pressure). + +macOS +----- + + - QMacStyle does no longer depend on HITheme — or Carbon for that matter. + Its implementation now relies exclusively on AppKit and custom code for + rendering and pixel metrics. + +**************************************************************************** +* Tools * +**************************************************************************** + +configure & build system +------------------------ + + - [QTBUG-61260] Fixed build with -sanitize address. + - [QTBUG-61373][Windows] Restored default -prefix to C:\Qt\Qt-\. + - [QTBUG-66355] pkg-config is now tried first to find system pcre2-16. + - [QTBUG-66675] Fixed -debug-and-release builds with qtquickcompiler. + - [Windows] OpenSSL 1.1 detection is now automatic. + - [X11] The -xkb-config-root command line switch has been removed as it + is no longer needed when configuring with -qt-xkbcommon-x11. + - Added the -gdb-index option to speed up debugging with GDB. + - More Qt features were made optional as part of the Qt Lite project. + - Removed compatibility of the modules with CMake < 3.1. + +qmake +----- + + - [QTBUG-35131][Xcode] Fixed build breakage when an extra compiler's + output directory (OBJECTS_DIR, MOC_DIR, etc.) contains "/../". + - [QTBUG-45211][iOS] Fixed building of QML based test cases. + - [QTBUG-66265][VS2017] Fixed building projects with Windows 8.1 SDK. + - [QTBUG-66770][Android][x86] The clang makespec now adds -mstackrealign. + - [QTBUG-67011] Fixed immediate RESOURCES when using an absolute RCC_DIR. + - [QTBUG-67286][Darwin] Fixed error messages when SDK cannot be resolved. + - [Darwin] Fixed the selected SDK's compilers not being used for plain C + sources. + - [Darwin] Fixed QMAKE_BUNDLE_DATA with extra compiler generated files. -- cgit v1.2.3 From b32c0ecc4c6df97134d3a27927abc9dc0be3a13b Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Tue, 8 May 2018 15:45:48 +0900 Subject: Fix build without features.completer Change-Id: Idc79921f85a920bc8c1280513ce78ee0cb00d415 Reviewed-by: Oswald Buddenhagen --- src/widgets/widgets/qcombobox.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index e70d096e04..04a44e1f37 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -73,7 +73,9 @@ #include #include #include +#if QT_CONFIG(completer) #include +#endif #include #if QT_CONFIG(effects) # include -- cgit v1.2.3 From a2df0ef57add82ccfb3bc3bcfaccc7510d709d98 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 8 May 2018 21:57:07 -0700 Subject: Fix build with GCC 8: memset/memcpy/memmove of non-trivials MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qarraydataops.h:73:17: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct TCBPoint’; use assignment or value-initialization instead [-Werror=class-memaccess] Change-Id: I5d0ee9389a794d80983efffd152ce10eb557341f Reviewed-by: Ville Voutilainen --- src/corelib/tools/qarraydataops.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index d0f83d2b6a..7e1b43f9b1 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -65,7 +65,7 @@ struct QPodArrayOps Q_ASSERT(newSize > uint(this->size)); Q_ASSERT(newSize <= this->alloc); - ::memset(this->end(), 0, (newSize - this->size) * sizeof(T)); + ::memset(static_cast(this->end()), 0, (newSize - this->size) * sizeof(T)); this->size = int(newSize); } @@ -121,8 +121,9 @@ struct QPodArrayOps Q_ASSERT(e <= where || b > this->end()); // No overlap Q_ASSERT(size_t(e - b) <= this->alloc - uint(this->size)); - ::memmove(where + (e - b), where, (static_cast(this->end()) - where) * sizeof(T)); - ::memcpy(where, b, (e - b) * sizeof(T)); + ::memmove(static_cast(where + (e - b)), static_cast(where), + (static_cast(this->end()) - where) * sizeof(T)); + ::memcpy(static_cast(where), static_cast(b), (e - b) * sizeof(T)); this->size += (e - b); } @@ -133,7 +134,8 @@ struct QPodArrayOps Q_ASSERT(b >= this->begin() && b < this->end()); Q_ASSERT(e > this->begin() && e < this->end()); - ::memmove(b, e, (static_cast(this->end()) - e) * sizeof(T)); + ::memmove(static_cast(b), static_cast(e), + (static_cast(this->end()) - e) * sizeof(T)); this->size -= (e - b); } }; -- cgit v1.2.3 From e110ab6c282790f6f035d52747b8589c448a362b Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Mon, 9 Apr 2018 13:37:33 +0300 Subject: tests/auto/widgets/itemviews: Avoid unconditional qWait()s Task-number: QTBUG-63992 Change-Id: Id4fcb0c2e4f83edd9508565468e16f57e100c780 Reviewed-by: Friedemann Kleint Reviewed-by: Frederik Gladhorn --- .../qabstractitemview/tst_qabstractitemview.cpp | 10 +--- .../itemviews/qcolumnview/tst_qcolumnview.cpp | 4 +- .../itemviews/qheaderview/tst_qheaderview.cpp | 48 +++++++------------- .../itemviews/qitemdelegate/tst_qitemdelegate.cpp | 43 ++++++------------ .../widgets/itemviews/qlistview/tst_qlistview.cpp | 53 ++++++++-------------- .../itemviews/qlistwidget/tst_qlistwidget.cpp | 2 +- .../itemviews/qtableview/tst_qtableview.cpp | 40 ++++++---------- .../widgets/itemviews/qtreeview/tst_qtreeview.cpp | 41 +++++++---------- .../itemviews/qtreewidget/tst_qtreewidget.cpp | 19 ++------ 9 files changed, 90 insertions(+), 170 deletions(-) diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index da52a7ea27..231474c71c 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -1168,8 +1168,7 @@ void tst_QAbstractItemView::task221955_selectedEditor() //We set the focus to the button, the index need to be selected button->setFocus(); - QTest::qWait(100); - QVERIFY(tree.selectionModel()->selectedIndexes().contains(tree.model()->index(3,0))); + QTRY_VERIFY(tree.selectionModel()->selectedIndexes().contains(tree.model()->index(3,0))); tree.setCurrentIndex(tree.model()->index(1,0)); QVERIFY(! tree.selectionModel()->selectedIndexes().contains(tree.model()->index(3,0))); @@ -1179,7 +1178,6 @@ void tst_QAbstractItemView::task221955_selectedEditor() tree.setSelectionMode(QAbstractItemView::NoSelection); tree.clearSelection(); QVERIFY(tree.selectionModel()->selectedIndexes().isEmpty()); - QTest::qWait(10); button->setFocus(); QTest::qWait(50); QVERIFY(tree.selectionModel()->selectedIndexes().isEmpty()); @@ -1267,15 +1265,11 @@ void tst_QAbstractItemView::task257481_emptyEditor() QCOMPARE(lineEditors.count(), 1); QVERIFY(!lineEditors.first()->size().isEmpty()); - QTest::qWait(30); - treeView.edit(model.index(1,0)); lineEditors = treeView.viewport()->findChildren(); QCOMPARE(lineEditors.count(), 1); QVERIFY(!lineEditors.first()->size().isEmpty()); - QTest::qWait(30); - treeView.edit(model.index(2,0)); lineEditors = treeView.viewport()->findChildren(); QCOMPARE(lineEditors.count(), 1); @@ -1462,7 +1456,6 @@ void tst_QAbstractItemView::QTBUG6407_extendedSelection() QCOMPARE(static_cast(&view), QApplication::activeWindow()); view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum()); - QTest::qWait(20); QModelIndex index49 = view.model()->index(49,0); QPoint p = view.visualRect(index49).center(); @@ -1506,7 +1499,6 @@ void tst_QAbstractItemView::QTBUG6753_selectOnSelection() QRect itemRect = table.visualRect(item); QTest::mouseMove(table.viewport(), itemRect.center()); QTest::mouseClick(table.viewport(), Qt::LeftButton, Qt::NoModifier, itemRect.center()); - QTest::qWait(20); QCOMPARE(table.selectedItems().count(), 1); QCOMPARE(table.selectedItems().first(), table.item(item.row(), item.column())); diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index 38e6d95ba4..58b34e8aea 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp @@ -703,7 +703,7 @@ void tst_QColumnView::moveGrip() view.setCurrentIndex(home); view.resize(640, 200); topLevel.show(); - QTest::qWait(ANIMATION_DELAY); + QVERIFY(QTest::qWaitForWindowActive(&topLevel)); int columnNum = view.createdColumns.count() - 2; QVERIFY(columnNum >= 0); @@ -934,7 +934,6 @@ void tst_QColumnView::parentCurrentIndex() QVERIFY(second.isValid()); QVERIFY(third.isValid()); view.setCurrentIndex(third); - QTest::qWait(ANIMATION_DELAY); QTRY_COMPARE(view.createdColumns[0]->currentIndex(), first); QTRY_COMPARE(view.createdColumns[1]->currentIndex(), second); QTRY_COMPARE(view.createdColumns[2]->currentIndex(), third); @@ -946,7 +945,6 @@ void tst_QColumnView::parentCurrentIndex() QVERIFY(second.isValid()); QVERIFY(third.isValid()); view.setCurrentIndex(third); - QTest::qWait(ANIMATION_DELAY); QTRY_COMPARE(view.createdColumns[0]->currentIndex(), first); QTRY_COMPARE(view.createdColumns[1]->currentIndex(), second); diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 08597d5eb1..fd83228c8b 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -240,8 +240,8 @@ private slots: void testStreamWithHide(); void testStylePosition(); void stretchAndRestoreLastSection(); - void testMinMaxSectionSizeStretched(); - void testMinMaxSectionSizeNotStretched(); + void testMinMaxSectionSize_data(); + void testMinMaxSectionSize(); void sizeHintCrash(); protected: @@ -2268,22 +2268,21 @@ void tst_QHeaderView::QTBUG6058_reset() QHeaderView view(Qt::Vertical); view.setModel(&proxy); view.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowActive(&view)); proxy.setSourceModel(&model1); - QApplication::processEvents(); view.swapSections(0,2); view.swapSections(1,4); - QApplication::processEvents(); - QCOMPARE(checkHeaderViewOrder(&view, QVector() << 2 << 4 << 0 << 3 << 1 << 5) , 0); + QVector expectedOrder{2, 4, 0, 3, 1, 5}; + QTRY_COMPARE(checkHeaderViewOrder(&view, expectedOrder) , 0); proxy.setSourceModel(&model2); - QApplication::processEvents(); - QCOMPARE(checkHeaderViewOrder(&view, QVector() << 2 << 0 << 1 ) , 0); + expectedOrder = {2, 0, 1}; + QTRY_COMPARE(checkHeaderViewOrder(&view, expectedOrder) , 0); proxy.setSourceModel(&model1); - QApplication::processEvents(); - QCOMPARE(checkHeaderViewOrder(&view, QVector() << 2 << 0 << 1 << 3 << 4 << 5 ) , 0); + expectedOrder = {2, 0, 1, 3, 4, 5}; + QTRY_COMPARE(checkHeaderViewOrder(&view, expectedOrder) , 0); } void tst_QHeaderView::QTBUG7833_sectionClicked() @@ -3269,28 +3268,17 @@ void tst_QHeaderView::stretchAndRestoreLastSection() QCOMPARE(header.sectionSize(9), someOtherSectionSize); } -void tst_QHeaderView::testMinMaxSectionSizeStretched() +void tst_QHeaderView::testMinMaxSectionSize_data() { - testMinMaxSectionSize(true); + QTest::addColumn("stretchLastSection"); + QTest::addRow("stretched") << true; + QTest::addRow("not stretched") << false; } -void tst_QHeaderView::testMinMaxSectionSizeNotStretched() +void tst_QHeaderView::testMinMaxSectionSize() { - testMinMaxSectionSize(false); -} + QFETCH(bool, stretchLastSection); -static void waitFor(const std::function &func) -{ - for (int i = 0; i < 100; i++) - { - if (func()) - return; - QTest::qWait(10); - } -} - -void tst_QHeaderView::testMinMaxSectionSize(bool stretchLastSection) -{ QStandardItemModel m(5, 5); QTableView tv; tv.setModel(&m); @@ -3326,8 +3314,7 @@ void tst_QHeaderView::testMinMaxSectionSize(bool stretchLastSection) header.resizeSection(0, sectionSizeMax); QCOMPARE(header.sectionSize(0), sectionSizeMax); header.setMaximumSectionSize(defaultSectionSize); - waitFor([&header, defaultSectionSize]() { return header.sectionSize(0) == defaultSectionSize; }); - QCOMPARE(header.sectionSize(0), defaultSectionSize); + QTRY_COMPARE(header.sectionSize(0), defaultSectionSize); // change section size on min change header.setMinimumSectionSize(sectionSizeMin); @@ -3335,8 +3322,7 @@ void tst_QHeaderView::testMinMaxSectionSize(bool stretchLastSection) header.resizeSection(0, sectionSizeMin); QCOMPARE(header.sectionSize(0), sectionSizeMin); header.setMinimumSectionSize(defaultSectionSize); - waitFor([&header, defaultSectionSize]() { return header.sectionSize(0) == defaultSectionSize; }); - QCOMPARE(header.sectionSize(0), defaultSectionSize); + QTRY_COMPARE(header.sectionSize(0), defaultSectionSize); } diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 802a04b4bf..a8f6906056 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -1276,7 +1276,7 @@ void tst_QItemDelegate::enterKey() view.show(); QApplication::setActiveWindow(&view); view.setFocus(); - QTest::qWait(30); + QVERIFY(QTest::qWaitForWindowActive(&view)); struct TestDelegate : public QItemDelegate { @@ -1306,7 +1306,6 @@ void tst_QItemDelegate::enterKey() QModelIndex index = model.index(0, 0); view.setCurrentIndex(index); // the editor will only selectAll on the current index view.edit(index); - QTest::qWait(30); QList lineEditors = view.viewport()->findChildren(QString::fromLatin1("TheEditor")); QCOMPARE(lineEditors.count(), 1); @@ -1315,7 +1314,6 @@ void tst_QItemDelegate::enterKey() QCOMPARE(editor->hasFocus(), true); QTest::keyClick(editor, Qt::Key(key)); - QApplication::processEvents(); if (expectedFocus) { QVERIFY(!editor.isNull()); @@ -1335,11 +1333,10 @@ void tst_QItemDelegate::task257859_finalizeEdit() view.show(); QApplication::setActiveWindow(&view); view.setFocus(); - QTest::qWait(30); + QVERIFY(QTest::qWaitForWindowActive(&view)); QModelIndex index = model.index(0, 0); view.edit(index); - QTest::qWait(30); QList lineEditors = view.viewport()->findChildren(); QCOMPARE(lineEditors.count(), 1); @@ -1454,28 +1451,26 @@ void tst_QItemDelegate::testLineEditValidation() QApplication::setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowActive(&view)); - QList lineEditors; QPointer editor; QPersistentModelIndex index = model.indexFromItem(item); view.setCurrentIndex(index); view.edit(index); - QTest::qWait(30); - lineEditors = view.findChildren(QStringLiteral("TheEditor")); - QCOMPARE(lineEditors.count(), 1); - editor = lineEditors.at(0); + const auto findEditors = [&]() { + return view.findChildren(QStringLiteral("TheEditor")); + }; + QCOMPARE(findEditors().count(), 1); + editor = findEditors().at(0); editor->clear(); // first try to set a valid text QTest::keyClicks(editor, QStringLiteral("foo,bar")); - QTest::qWait(30); // close the editor QTest::keyClick(editor, Qt::Key(key)); - QTest::qWait(30); - QVERIFY(editor.isNull()); + QTRY_VERIFY(editor.isNull()); if (key != Qt::Key_Escape) QCOMPARE(item->data(Qt::DisplayRole).toString(), QStringLiteral("foo,bar")); else @@ -1484,20 +1479,16 @@ void tst_QItemDelegate::testLineEditValidation() // now an invalid (but partially matching) text view.setCurrentIndex(index); view.edit(index); - QTest::qWait(30); - lineEditors = view.findChildren(QStringLiteral("TheEditor")); - QCOMPARE(lineEditors.count(), 1); - editor = lineEditors.at(0); + QTRY_COMPARE(findEditors().count(), 1); + editor = findEditors().at(0); editor->clear(); // edit QTest::keyClicks(editor, QStringLiteral("foobar")); - QTest::qWait(30); // try to close the editor QTest::keyClick(editor, Qt::Key(key)); - QTest::qWait(30); if (key != Qt::Key_Escape) { QVERIFY(!editor.isNull()); @@ -1505,33 +1496,29 @@ void tst_QItemDelegate::testLineEditValidation() QCOMPARE(editor->text(), QStringLiteral("foobar")); QCOMPARE(item->data(Qt::DisplayRole).toString(), QStringLiteral("foo,bar")); } else { - QVERIFY(editor.isNull()); + QTRY_VERIFY(editor.isNull()); QCOMPARE(item->data(Qt::DisplayRole).toString(), QStringLiteral("abc,def")); } // reset the view to forcibly close the editor view.reset(); - QTest::qWait(30); + QTRY_COMPARE(findEditors().count(), 0); // set a valid text again view.setCurrentIndex(index); view.edit(index); - QTest::qWait(30); - lineEditors = view.findChildren(QStringLiteral("TheEditor")); - QCOMPARE(lineEditors.count(), 1); - editor = lineEditors.at(0); + QTRY_COMPARE(findEditors().count(), 1); + editor = findEditors().at(0); editor->clear(); // set a valid text QTest::keyClicks(editor, QStringLiteral("gender,bender")); - QTest::qWait(30); // close the editor QTest::keyClick(editor, Qt::Key(key)); - QTest::qWait(30); - QVERIFY(editor.isNull()); + QTRY_VERIFY(editor.isNull()); if (key != Qt::Key_Escape) QCOMPARE(item->data(Qt::DisplayRole).toString(), QStringLiteral("gender,bender")); else diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 1d8286b3cf..d0c9dae313 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -293,7 +293,7 @@ public: void tst_QListView::cleanup() { - QVERIFY(QApplication::topLevelWidgets().isEmpty()); + QTRY_VERIFY(QApplication::topLevelWidgets().isEmpty()); } void tst_QListView::noDelegate() @@ -779,7 +779,6 @@ void tst_QListView::hideFirstRow() view.setRowHidden(0,true); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(10); } static int modelIndexCount(const QAbstractItemView *view) @@ -857,7 +856,6 @@ void tst_QListView::setCurrentIndex() QCOMPARE(sb->value(), offset + 1); ++offset; } - //QTest::qWait(50); } --i; // item 20 does not exist @@ -870,7 +868,6 @@ void tst_QListView::setCurrentIndex() QCOMPARE(sb->value(), offset - 1); --offset; } - //QTest::qWait(50); } } } @@ -1397,21 +1394,17 @@ void tst_QListView::scrollBarAsNeeded() lv.setModel(&model); lv.resize(size); topLevel.show(); + QVERIFY(QTest::qWaitForWindowActive(&topLevel)); for (uint r = 0; r < sizeof(rowCounts)/sizeof(int); ++r) { QStringList list; - int i; - for (i = 0; i < rowCounts[r]; ++i) + for (int i = 0; i < rowCounts[r]; ++i) list << QLatin1String("Item ") + QString::number(i); model.setStringList(list); - QApplication::processEvents(); - QTest::qWait(50); model.setStringList(generateList(QLatin1String("Item "), itemCount)); - QApplication::processEvents(); - QTRY_COMPARE(lv.horizontalScrollBar()->isVisible(), horizontalScrollBarVisible); QTRY_COMPARE(lv.verticalScrollBar()->isVisible(), verticalScrollBarVisible); } @@ -1577,14 +1570,14 @@ void tst_QListView::task228566_infiniteRelayout() view.setFixedHeight(itemHeight * 12); view.show(); + QVERIFY(QTest::qWaitForWindowActive(&view)); QTest::qWait(100); //make sure the layout is done once QSignalSpy spy(view.horizontalScrollBar(), SIGNAL(rangeChanged(int,int))); - QTest::qWait(200); //the layout should already have been done //so there should be no change made to the scrollbar - QCOMPARE(spy.count(), 0); + QVERIFY(!spy.wait(200)); } void tst_QListView::task248430_crashWith0SizedItem() @@ -1619,7 +1612,7 @@ void tst_QListView::task250446_scrollChanged() QTRY_COMPARE(view.currentIndex(), index); view.showNormal(); - QTest::qWait(50); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_COMPARE(view.verticalScrollBar()->value(), scrollValue); QTRY_COMPARE(view.currentIndex(), index); } @@ -1709,19 +1702,14 @@ void tst_QListView::keyboardSearch() qApp->setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowActive(&view)); -// QCOMPARE(view.currentIndex() , model.index(0,0)); - QTest::keyClick(&view, Qt::Key_K); - QTest::qWait(10); - QCOMPARE(view.currentIndex() , model.index(5,0)); //KAFEINE + QTRY_COMPARE(view.currentIndex() , model.index(5,0)); //KAFEINE QTest::keyClick(&view, Qt::Key_O); - QTest::qWait(10); - QCOMPARE(view.currentIndex() , model.index(6,0)); //KONQUEROR + QTRY_COMPARE(view.currentIndex() , model.index(6,0)); //KONQUEROR QTest::keyClick(&view, Qt::Key_N); - QTest::qWait(10); - QCOMPARE(view.currentIndex() , model.index(6,0)); //KONQUEROR + QTRY_COMPARE(view.currentIndex() , model.index(6,0)); //KONQUEROR } void tst_QListView::shiftSelectionWithNonUniformItemSizes() @@ -1751,8 +1739,7 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes() QCOMPARE(view.currentIndex(), index); QTest::keyClick(&view, Qt::Key_Up, Qt::ShiftModifier); - QTest::qWait(10); - QCOMPARE(view.currentIndex(), model.index(1, 0)); + QTRY_COMPARE(view.currentIndex(), model.index(1, 0)); QModelIndexList selected = view.selectionModel()->selectedIndexes(); QCOMPARE(selected.count(), 3); @@ -1781,8 +1768,7 @@ void tst_QListView::shiftSelectionWithNonUniformItemSizes() QCOMPARE(view.currentIndex(), index); QTest::keyClick(&view, Qt::Key_Left, Qt::ShiftModifier); - QTest::qWait(10); - QCOMPARE(view.currentIndex(), model.index(1, 0)); + QTRY_COMPARE(view.currentIndex(), model.index(1, 0)); QModelIndexList selected = view.selectionModel()->selectedIndexes(); QCOMPARE(selected.count(), 3); @@ -1833,10 +1819,8 @@ void tst_QListView::task262152_setModelColumnNavigate() QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(static_cast(&view), QApplication::activeWindow()); QTest::keyClick(&view, Qt::Key_Down); - QTest::qWait(30); QTRY_COMPARE(view.currentIndex(), model.index(1,1)); QTest::keyClick(&view, Qt::Key_Down); - QTest::qWait(30); QTRY_COMPARE(view.currentIndex(), model.index(2,1)); } @@ -1888,14 +1872,11 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems() int nbVisibleItem = rowCount / 2 - bar->maximum(); bar->setValue(bar->maximum()); - QApplication::processEvents(); for (int i = rowCount; i > rowCount / 2; i--) { view.setRowHidden(i, true); } - QApplication::processEvents(); - QTest::qWait(50); + QTRY_COMPARE(bar->maximum(), rowCount/4 - nbVisibleItem); QCOMPARE(bar->value(), bar->maximum()); - QCOMPARE(bar->maximum(), rowCount/4 - nbVisibleItem); } void tst_QListView::taskQTBUG_633_changeModelData() @@ -1911,10 +1892,12 @@ void tst_QListView::taskQTBUG_633_changeModelData() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); model.setData( model.index(1, 0), QLatin1String("long long text")); - QTest::qWait(100); //leave time for relayouting the items - QRect rectLongText = view.visualRect(model.index(1,0)); - QRect rect2 = view.visualRect(model.index(2,0)); - QVERIFY( ! rectLongText.intersects(rect2) ); + const auto longTextDoesNotIntersectNextItem = [&]() { + QRect rectLongText = view.visualRect(model.index(1,0)); + QRect rect2 = view.visualRect(model.index(2,0)); + return !rectLongText.intersects(rect2); + }; + QTRY_VERIFY(longTextDoesNotIntersectNextItem()); } void tst_QListView::taskQTBUG_435_deselectOnViewportClick() diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index f7332a15f5..98b44fe8aa 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -1565,7 +1565,7 @@ void tst_QListWidget::task217070_scrollbarsAdjusted() v.setResizeMode(QListView::Adjust); v.setUniformItemSizes(true); v.resize(160,100); - QTest::qWait(50); + QVERIFY(QTest::qWaitForWindowActive(&v)); QScrollBar *hbar = v.horizontalScrollBar(); QScrollBar *vbar = v.verticalScrollBar(); QVERIFY(hbar && vbar); diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 06c80bf8d2..8427b04be7 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -2781,15 +2781,14 @@ void tst_QTableView::scrollTo() for (int c = 0; c < columnCount; ++c) view.setColumnWidth(c, columnWidth); - QTest::qWait(150); // ### needed to pass the test view.horizontalScrollBar()->setValue(horizontalScroll); view.verticalScrollBar()->setValue(verticalScroll); QModelIndex index = model.index(row, column); QVERIFY(index.isValid()); view.scrollTo(index, (QAbstractItemView::ScrollHint)scrollHint); - QCOMPARE(view.verticalScrollBar()->value(), expectedVerticalScroll); - QCOMPARE(view.horizontalScrollBar()->value(), expectedHorizontalScroll); + QTRY_COMPARE(view.verticalScrollBar()->value(), expectedVerticalScroll); + QTRY_COMPARE(view.horizontalScrollBar()->value(), expectedHorizontalScroll); } void tst_QTableView::indexAt_data() @@ -2936,14 +2935,12 @@ void tst_QTableView::indexAt() for (int c = 0; c < columnCount; ++c) view.setColumnWidth(c, columnWidth); - QTest::qWait(20); view.horizontalScrollBar()->setValue(horizontalScroll); view.verticalScrollBar()->setValue(verticalScroll); - QTest::qWait(20); QModelIndex index = view.indexAt(QPoint(x, y)); - QCOMPARE(index.row(), expectedRow); - QCOMPARE(index.column(), expectedColumn); + QTRY_COMPARE(index.row(), expectedRow); + QTRY_COMPARE(index.column(), expectedColumn); } void tst_QTableView::span_data() @@ -3261,7 +3258,7 @@ void tst_QTableView::spansAfterRowInsertion() view.setModel(&model); view.setSpan(3, 3, 3, 3); view.show(); - QTest::qWait(50); + QVERIFY(QTest::qWaitForWindowActive(&view)); // Insertion before the span only shifts the span. view.model()->insertRows(0, 2); @@ -3297,7 +3294,7 @@ void tst_QTableView::spansAfterColumnInsertion() view.setModel(&model); view.setSpan(3, 3, 3, 3); view.show(); - QTest::qWait(50); + QVERIFY(QTest::qWaitForWindowActive(&view)); // Insertion before the span only shifts the span. view.model()->insertColumns(0, 2); @@ -3345,7 +3342,7 @@ void tst_QTableView::spansAfterRowRemoval() view.setSpan(span.top(), span.left(), span.height(), span.width()); view.show(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(&view)); view.model()->removeRows(3, 3); QList expectedSpans; @@ -3385,7 +3382,7 @@ void tst_QTableView::spansAfterColumnRemoval() view.setSpan(span.left(), span.top(), span.width(), span.height()); view.show(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(&view)); view.model()->removeColumns(3, 3); QList expectedSpans; @@ -4083,7 +4080,6 @@ void tst_QTableView::task259308_scrollVerticalHeaderSwappedSections() QTRY_COMPARE(tv.currentIndex().row(), newRow); tv.setCurrentIndex(model.index(0, 0)); - QTest::qWait(60); QTest::keyClick(&tv, Qt::Key_PageDown); // PageDown won't scroll when at the bottom QTRY_COMPARE(tv.rowAt(tv.viewport()->height() - 1), tv.verticalHeader()->logicalIndex(model.rowCount() - 1)); } @@ -4104,7 +4100,7 @@ void tst_QTableView::task191545_dragSelectRows() table.setSelectionMode(QAbstractItemView::ExtendedSelection); table.setMinimumSize(1000, 400); table.show(); - QTest::qWait(200); + QVERIFY(QTest::qWaitForWindowActive(&table)); ValueSaver saver(QApplicationPrivate::modifier_buttons); QApplicationPrivate::modifier_buttons = Qt::ControlModifier; @@ -4214,27 +4210,22 @@ void tst_QTableView::task234926_setHeaderSorting() QTableView view; view.setModel(&model); // view.show(); - QTest::qWait(20); - QCOMPARE(model.stringList(), data); + QTRY_COMPARE(model.stringList(), data); view.setSortingEnabled(true); view.sortByColumn(0, Qt::AscendingOrder); - QApplication::processEvents(); - QCOMPARE(model.stringList() , sortedDataA); + QTRY_COMPARE(model.stringList() , sortedDataA); view.horizontalHeader()->setSortIndicator(0, Qt::DescendingOrder); - QApplication::processEvents(); - QCOMPARE(model.stringList() , sortedDataD); + QTRY_COMPARE(model.stringList() , sortedDataD); QHeaderView *h = new QHeaderView(Qt::Horizontal); h->setModel(&model); view.setHorizontalHeader(h); h->setSortIndicator(0, Qt::AscendingOrder); - QApplication::processEvents(); - QCOMPARE(model.stringList() , sortedDataA); + QTRY_COMPARE(model.stringList() , sortedDataA); h->setSortIndicator(0, Qt::DescendingOrder); - QApplication::processEvents(); - QCOMPARE(model.stringList() , sortedDataD); + QTRY_COMPARE(model.stringList() , sortedDataD); } void tst_QTableView::taskQTBUG_5062_spansInconsistency() @@ -4288,9 +4279,8 @@ void tst_QTableView::changeHeaderData() QVERIFY(view.verticalHeader()->width() < textWidth); model.setHeaderData(2, Qt::Vertical, text); - QTest::qWait(100); //leave time for layout - QVERIFY(view.verticalHeader()->width() > textWidth); + QTRY_VERIFY(view.verticalHeader()->width() > textWidth); } #if QT_CONFIG(wheelevent) diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 347d2a81e6..4c637573d0 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -3464,6 +3464,7 @@ void tst_QTreeView::addRowsWhileSectionsAreHidden() QStandardItemModel *model = new QStandardItemModel(6, pass, &view); view.setModel(model); view.show(); + QVERIFY(QTest::qWaitForWindowActive(&view)); int i; for (i = 0; i < 3; ++i) @@ -3487,12 +3488,15 @@ void tst_QTreeView::addRowsWhileSectionsAreHidden() } for (col = 0; col < pass; ++col) view.setColumnHidden(col, false); - QTest::qWait(250); - for (i = 0; i < 6; ++i) { - QRect rect = view.visualRect(model->index(i, 0)); - QCOMPARE(rect.isValid(), true); - } + auto allVisualRectsValid = [](QTreeView *view, QStandardItemModel *model) { + for (int i = 0; i < 6; ++i) { + if (!view->visualRect(model->index(i, 0)).isValid()) + return false; + } + return true; + }; + QTRY_VERIFY(allVisualRectsValid(&view, model)); delete model; } @@ -3515,11 +3519,9 @@ void tst_QTreeView::task216717_updateChildren() tree.refreshed = false; QTreeWidgetItem *parent = new QTreeWidgetItem(QStringList() << "parent"); tree.addTopLevelItem(parent); - QTest::qWait(10); QTRY_VERIFY(tree.refreshed); tree.refreshed = false; parent->addChild(new QTreeWidgetItem(QStringList() << "child")); - QTest::qWait(10); QTRY_VERIFY(tree.refreshed); } @@ -3553,11 +3555,10 @@ void tst_QTreeView::task220298_selectColumns() Model model; view.setModel(&model); view.show(); - QTest::qWait(50); + QVERIFY(QTest::qWaitForWindowActive(&view)); QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.visualRect(view.model()->index(1, 1)).center()); - QTest::qWait(50); - QVERIFY(view.selectedIndexes().contains(view.model()->index(1, 2))); + QTRY_VERIFY(view.selectedIndexes().contains(view.model()->index(1, 2))); QVERIFY(view.selectedIndexes().contains(view.model()->index(1, 1))); QVERIFY(view.selectedIndexes().contains(view.model()->index(1, 0))); } @@ -3575,15 +3576,14 @@ void tst_QTreeView::task224091_appendColumns() qApp->setActiveWindow(topLevel); QVERIFY(QTest::qWaitForWindowActive(topLevel)); + QVERIFY(!treeView->verticalScrollBar()->isVisible()); + QList projlist; for (int k = 0; k < 10; ++k) projlist.append(new QStandardItem(QLatin1String("Top Level ") + QString::number(k))); model->appendColumn(projlist); model->invisibleRootItem()->appendRow(new QStandardItem("end")); - QTest::qWait(50); - qApp->processEvents(); - QTRY_VERIFY(treeView->verticalScrollBar()->isVisible()); delete topLevel; @@ -3741,11 +3741,10 @@ void tst_QTreeView::task238873_avoidAutoReopening() view.setModel(&model); view.show(); view.expandAll(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(&view)); QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.visualRect(child.index()).center()); - QTest::qWait(20); - QCOMPARE(view.currentIndex(), child.index()); + QTRY_COMPARE(view.currentIndex(), child.index()); view.setExpanded(item1.index(), false); @@ -3810,7 +3809,6 @@ void tst_QTreeView::task246536_scrollbarsNotWorking() QTest::qWait(100); o.count = 0; tree.verticalScrollBar()->setValue(50); - QTest::qWait(100); QTRY_VERIFY(o.count > 0); } @@ -3826,7 +3824,7 @@ void tst_QTreeView::task250683_wrongSectionSize() treeView.setColumnHidden(3, true); treeView.show(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(&treeView)); QCOMPARE(treeView.header()->sectionSize(0) + treeView.header()->sectionSize(1), treeView.viewport()->width()); } @@ -3863,7 +3861,6 @@ void tst_QTreeView::task239271_addRowsWithFirstColumnHidden() QStandardItem sub1("sub1"), sub11("sub11"); root0.appendRow(QList() << &sub1 << &sub11); - QTest::qWait(20); //items in the 2nd column should have been painted QTRY_VERIFY(!delegate.paintedIndexes.isEmpty()); QVERIFY(delegate.paintedIndexes.contains(sub00.index())); @@ -3976,7 +3973,6 @@ void tst_QTreeView::doubleClickedWithSpans() //end the previous edition QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p); - QTest::qWait(150); QTest::mousePress(view.viewport(), Qt::LeftButton, 0, p); QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, p); QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, p); @@ -4041,7 +4037,6 @@ void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint() view.painted = 0; view.doCompare = true; model.setData(model.index(0, 0), QVariant(QSize(50, 50)), Qt::SizeHintRole); - QTest::qWait(100); QTRY_VERIFY(view.painted > 0); } @@ -4249,7 +4244,6 @@ void tst_QTreeView::taskQTBUG_11466_keyboardNavigationRegression() QVERIFY(QTest::qWaitForWindowExposed(&treeView)); QTest::keyPress(treeView.viewport(), Qt::Key_Down); - QTest::qWait(10); QTRY_COMPARE(treeView.currentIndex(), treeView.selectionModel()->selection().indexes().first()); } @@ -4269,8 +4263,7 @@ void tst_QTreeView::taskQTBUG_13567_removeLastItemRegression() view.setCurrentIndex(model.index(199, 0)); model.removeLastRow(); - QTest::qWait(10); - QCOMPARE(view.currentIndex(), model.index(198, 0)); + QTRY_COMPARE(view.currentIndex(), model.index(198, 0)); CHECK_VISIBLE(198, 0); } diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index d0e6407283..321e4bcd0e 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -2026,7 +2026,6 @@ void tst_QTreeWidget::setHeaderItem() headerItem->setText(0, "0"); headerItem->setText(1, "1"); testWidget->setHeaderItem(headerItem); - QTest::qWait(100); QCOMPARE(testWidget->headerItem(), headerItem); QCOMPARE(headerItem->treeWidget(), static_cast(testWidget)); @@ -2981,7 +2980,7 @@ void tst_QTreeWidget::task191552_rtl() item->setCheckState(0, Qt::Checked); QCOMPARE(item->checkState(0), Qt::Checked); tw.show(); - QTest::qWait(50); + QVERIFY(QTest::qWaitForWindowActive(&tw)); QStyleOptionViewItem opt; opt.initFrom(&tw); opt.rect = tw.visualItemRect(item); @@ -2991,7 +2990,6 @@ void tst_QTreeWidget::task191552_rtl() opt.widget = &tw; const QRect checkRect = tw.style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, &tw); QTest::mouseClick(tw.viewport(), Qt::LeftButton, Qt::NoModifier, checkRect.center()); - QTest::qWait(200); QCOMPARE(item->checkState(0), Qt::Unchecked); qApp->setLayoutDirection(oldDir); @@ -3088,7 +3086,7 @@ void tst_QTreeWidget::task253109_itemHeight() QTreeWidget treeWidget; treeWidget.setColumnCount(1); treeWidget.show(); - QTest::qWait(200); + QVERIFY(QTest::qWaitForWindowActive(&treeWidget)); QTreeWidgetItem item(&treeWidget); class MyWidget : public QWidget @@ -3097,9 +3095,7 @@ void tst_QTreeWidget::task253109_itemHeight() } w; treeWidget.setItemWidget(&item, 0, &w); - QTest::qWait(200); - QCOMPARE(w.geometry(), treeWidget.visualItemRect(&item)); - + QTRY_COMPARE(w.geometry(), treeWidget.visualItemRect(&item)); } void tst_QTreeWidget::task206367_duplication() @@ -3306,16 +3302,15 @@ void tst_QTreeWidget::setTextUpdate() treeWidget.setItemDelegate(&delegate); treeWidget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&treeWidget)); QStringList strList; strList << "variable1" << "0"; QTreeWidgetItem *item = new QTreeWidgetItem(strList); treeWidget.insertTopLevelItem(0, item); - QTest::qWait(50); QTRY_VERIFY(delegate.numPaints > 0); delegate.numPaints = 0; item->setText(1, "42"); - QApplication::processEvents(); QTRY_VERIFY(delegate.numPaints > 0); } @@ -3356,34 +3351,30 @@ void tst_QTreeWidget::setChildIndicatorPolicy() treeWidget.setItemDelegate(&delegate); treeWidget.show(); + QVERIFY(QTest::qWaitForWindowExposed(&treeWidget)); QTreeWidgetItem *item = new QTreeWidgetItem(QStringList("Hello")); treeWidget.insertTopLevelItem(0, item); - QTest::qWait(50); QTRY_VERIFY(delegate.numPaints > 0); delegate.numPaints = 0; delegate.expectChildren = true; item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator); - QApplication::processEvents(); QTRY_COMPARE(delegate.numPaints, 1); delegate.numPaints = 0; delegate.expectChildren = false; item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless); - QApplication::processEvents(); QTRY_COMPARE(delegate.numPaints, 1); delegate.numPaints = 0; delegate.expectChildren = true; new QTreeWidgetItem(item); - QApplication::processEvents(); QTRY_COMPARE(delegate.numPaints, 1); delegate.numPaints = 0; delegate.expectChildren = false; item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicator); - QApplication::processEvents(); QTRY_COMPARE(delegate.numPaints, 1); } -- cgit v1.2.3 From 7eab9ec63bf6c9048e8a561fbee8655f24f6b916 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Tue, 8 May 2018 13:19:06 +0300 Subject: Stabilize tst_QMdiArea::subWindowList Flakily failed on openSUSE. Task-number: QTBUG-68170 Change-Id: Ic75e081238ccf4bad54de39e6bdaa892796b599e Reviewed-by: Friedemann Kleint --- tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index c8a92f3751..ecad7267dd 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -1400,6 +1400,7 @@ void tst_QMdiArea::subWindowList() QMdiArea workspace; workspace.show(); qApp->setActiveWindow(&workspace); + QVERIFY(QTest::qWaitForWindowActive(&workspace)); QList activationOrder; QVector windows; @@ -1418,8 +1419,7 @@ void tst_QMdiArea::subWindowList() windows[staysOnTop1]->setWindowFlags(windows[staysOnTop1]->windowFlags() | Qt::WindowStaysOnTopHint); workspace.setActiveSubWindow(windows[activeSubWindow]); - qApp->processEvents(); - QCOMPARE(workspace.activeSubWindow(), windows[activeSubWindow]); + QTRY_COMPARE(workspace.activeSubWindow(), windows[activeSubWindow]); activationOrder.move(activationOrder.indexOf(windows[activeSubWindow]), windowCount - 1); QList subWindows = workspace.subWindowList(windowOrder); @@ -1441,13 +1441,11 @@ void tst_QMdiArea::subWindowList() windows[staysOnTop2]->setWindowFlags(windows[staysOnTop2]->windowFlags() | Qt::WindowStaysOnTopHint); workspace.setActiveSubWindow(windows[staysOnTop2]); - qApp->processEvents(); - QCOMPARE(workspace.activeSubWindow(), windows[staysOnTop2]); + QTRY_COMPARE(workspace.activeSubWindow(), windows[staysOnTop2]); activationOrder.move(activationOrder.indexOf(windows[staysOnTop2]), windowCount - 1); workspace.setActiveSubWindow(windows[activeSubWindow]); - qApp->processEvents(); - QCOMPARE(workspace.activeSubWindow(), windows[activeSubWindow]); + QTRY_COMPARE(workspace.activeSubWindow(), windows[activeSubWindow]); activationOrder.move(activationOrder.indexOf(windows[activeSubWindow]), windowCount - 1); QList widgets = workspace.subWindowList(windowOrder); -- cgit v1.2.3 From ebcc6687b0ffb7b158c430ef40f6347228a57cb8 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Tue, 8 May 2018 15:54:52 +0300 Subject: Blacklist tst_QWidget::raise on openSUSE The test occasionally gets an unexpected paint event on openSUSE. Task-number: QTBUG-68175 Change-Id: I998d79dd12aac1f924c14d7ff7e864c4f081983c Reviewed-by: Friedemann Kleint Reviewed-by: Gatis Paeglis --- tests/auto/widgets/kernel/qwidget/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 02cdd1a895..6cebce26e8 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -20,6 +20,8 @@ osx [setGeometry] osx [raise] +# QTBUG-68175 +opensuse osx [resizeEvent] osx -- cgit v1.2.3 From fae53562ae23ac99621c1987522015c0da59e374 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 25 Apr 2018 19:59:20 +0200 Subject: QLineEdit example: fix link to QLineEdit::setInputMask MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a typo to properly link to setInputMask instead setMask. Task-number: QTBUG-61775 Change-Id: I0cb00de8dcaece613467e25b41e93661d6e98308 Reviewed-by: Paul Wicking Reviewed-by: André Hartmann Reviewed-by: Venugopal Shivashankar --- examples/widgets/doc/src/lineedits.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/widgets/doc/src/lineedits.qdoc b/examples/widgets/doc/src/lineedits.qdoc index 5cf321bbb1..08de3c08dd 100644 --- a/examples/widgets/doc/src/lineedits.qdoc +++ b/examples/widgets/doc/src/lineedits.qdoc @@ -148,7 +148,7 @@ \snippet widgets/lineedits/window.cpp 12 Each entry in the relevant combobox is associated with an input mask. We set - a new mask by calling the QLineEdit::setMask() function with a suitable string; + a new mask by calling the QLineEdit::setInputMask() function with a suitable string; the mask is disabled if an empty string is used. The \c accessChanged() slot handles changes to the combobox in the -- cgit v1.2.3 From 68e6d64fe36511d0d9d8004e7fc1c36bf6c26ed2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 9 May 2018 19:52:26 -0700 Subject: QString: fix off-by-one error The check for having N valid characters is ptr + N <= end, because ptr + N == end indicates that we have exactly N characters in the string. Change-Id: I5d0ee9389a794d80983efffd152d28d5aa485ce4 Reviewed-by: Allan Sandfeld Jensen --- src/corelib/tools/qstring.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index f6360f5504..b2dcb6d8da 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -259,7 +259,7 @@ static bool simdTestMask(const char *&ptr, const char *end, quint32 maskval) # if defined(__AVX2__) // AVX2 implementation: test 32 bytes at a time const __m256i mask256 = _mm256_broadcastd_epi32(_mm_cvtsi32_si128(maskval)); - while (ptr + 32 < end) { + while (ptr + 32 <= end) { __m256i data = _mm256_loadu_si256(reinterpret_cast(ptr)); if (!_mm256_testz_si256(mask256, data)) return false; @@ -271,7 +271,7 @@ static bool simdTestMask(const char *&ptr, const char *end, quint32 maskval) // SSE 4.1 implementation: test 32 bytes at a time (two 16-byte // comparisons, unrolled) const __m128i mask = _mm_set1_epi32(maskval); - while (ptr + 32 < end) { + while (ptr + 32 <= end) { __m128i data1 = _mm_loadu_si128(reinterpret_cast(ptr)); __m128i data2 = _mm_loadu_si128(reinterpret_cast(ptr + 16)); if (!_mm_testz_si128(mask, data1)) @@ -283,7 +283,7 @@ static bool simdTestMask(const char *&ptr, const char *end, quint32 maskval) # endif # if defined(__SSE4_1__) // AVX2 and SSE4.1: final 16-byte comparison - if (ptr + 16 < end) { + if (ptr + 16 <= end) { __m128i data1 = _mm_loadu_si128(reinterpret_cast(ptr)); if (!_mm_testz_si128(mask, data1)) return false; @@ -325,7 +325,7 @@ bool QtPrivate::isAscii(QLatin1String s) Q_DECL_NOTHROW } #endif - while (ptr + 4 < end) { + while (ptr + 4 <= end) { quint32 data = qFromUnaligned(ptr); if (data & 0x80808080U) return false; -- cgit v1.2.3 From 5134ff882a5b62a692a330a57f135870eccfa2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 9 May 2018 12:50:59 +0200 Subject: OpenSSL v1.1.1: fix qtbug18498_peek Previously the test worked because the client was the last party to know when encryption was established. However, due to changes in the TLSv1.3 handshake the server is now the last one. In either case, relying on both to be encrypted when one of them is finished is not great, so now we only quit the event loop when both client and server have emitted 'encrypted'. Change-Id: Ic1fc75671206d866f7ea983805fd58a99657aac6 Reviewed-by: Timur Pocheptsov --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index de759ae051..e32fa7c724 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -2838,11 +2838,19 @@ void tst_QSslSocket::qtbug18498_peek() client->setObjectName("client"); client->ignoreSslErrors(); - connect(client, SIGNAL(encrypted()), this, SLOT(exitLoop())); + int encryptedCounter = 2; + connect(client, &QSslSocket::encrypted, this, [&encryptedCounter, this](){ + if (!--encryptedCounter) + exitLoop(); + }); + WebSocket *serversocket = server.socket; + connect(serversocket, &QSslSocket::encrypted, this, [&encryptedCounter, this](){ + if (!--encryptedCounter) + exitLoop(); + }); connect(client, SIGNAL(disconnected()), this, SLOT(exitLoop())); client->startClientEncryption(); - WebSocket *serversocket = server.socket; QVERIFY(serversocket); serversocket->setObjectName("server"); -- cgit v1.2.3 From 8c029e98bf668725979424766c0bbbfc012448b3 Mon Sep 17 00:00:00 2001 From: Christoph Keller Date: Tue, 13 Mar 2018 18:27:58 +0100 Subject: Fix build of applications on iOS When QMAKE_TARGET_BUNDLE_PREFIX is set in the .pro file then this value should be used instead of the default value for PRODUCT_BUNDLE_IDENTIFIER. Therefore, PRODUCT_BUNDLE_IDENTIFIER should be set inside default_post.prf so that it can take the value of QMAKE_TARGET_BUNDLE_PREFIX after it may have been set. Task-number: QTBUG-66462 Change-Id: Iec1e2a43632efe6021b9d6bfdb78bd941326c456 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/mac/default_post.prf | 7 +++++++ mkspecs/features/mac/default_pre.prf | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index 50a1ec6764..21d487f1f9 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -210,3 +210,10 @@ cache(QMAKE_XCODE_DEVELOPER_PATH, stash) cache(QMAKE_XCODE_VERSION, stash) QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix() + +xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER +xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX +isEmpty(xcode_product_bundle_identifier_setting.value): \ + xcode_product_bundle_identifier_setting.value = "com.yourcompany" +xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.${PRODUCT_NAME:rfc1034identifier}" +QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf index f1a4ca77b2..e3534561a5 100644 --- a/mkspecs/features/mac/default_pre.prf +++ b/mkspecs/features/mac/default_pre.prf @@ -58,10 +58,3 @@ QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX xcode_copy_phase_strip_setting.name = COPY_PHASE_STRIP xcode_copy_phase_strip_setting.value = NO QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting - -xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER -xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX -isEmpty(xcode_product_bundle_identifier_setting.value): \ - xcode_product_bundle_identifier_setting.value = "com.yourcompany" -xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.${PRODUCT_NAME:rfc1034identifier}" -QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting -- cgit v1.2.3 From 69e0393399e4aba077f29b36611670dbe5813e27 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 10 May 2018 23:25:43 -0700 Subject: QByteArray::setNum: use the existing latin1 lowercasing table Not sure this makes the code faster, but it removes two functions. Change-Id: I5d0ee9389a794d80983efffd152d830da44b1bfe Reviewed-by: Lars Knoll --- src/corelib/tools/qbytearray.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index 83b9f19094..7c601e1336 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -782,19 +782,6 @@ QByteArray qUncompress(const uchar* data, int nbytes) } #endif -static inline bool qIsUpper(char c) -{ - return c >= 'A' && c <= 'Z'; -} - -static inline char qToLower(char c) -{ - if (c >= 'A' && c <= 'Z') - return c - 'A' + 'a'; - else - return c; -} - /*! \class QByteArray \inmodule QtCore @@ -4136,9 +4123,10 @@ QByteArray &QByteArray::setNum(double n, char f, int prec) QLocaleData::DoubleForm form = QLocaleData::DFDecimal; uint flags = QLocaleData::ZeroPadExponent; - if (qIsUpper(f)) + char lower = latin1_lowercased[uchar(f)]; + if (f != lower) flags |= QLocaleData::CapitalEorX; - f = qToLower(f); + f = lower; switch (f) { case 'f': -- cgit v1.2.3 From 627de835b1b87280741eb96ae77ea42b1f6ef5dc Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Tue, 10 Apr 2018 15:43:07 +0300 Subject: tests/auto/widgets/graphicsview: Avoid unconditional qWait()s Task-number: QTBUG-63992 Change-Id: Ibbcf5bf968fcf1b1c3a043c805bdcc23a4005f00 Reviewed-by: Qt CI Bot Reviewed-by: Friedemann Kleint Reviewed-by: Gatis Paeglis --- .../tst_qgraphicsanchorlayout1.cpp | 2 - .../tst_qgraphicsgridlayout.cpp | 2 +- .../qgraphicsitem/tst_qgraphicsitem.cpp | 202 ++++++--------------- .../tst_qgraphicslinearlayout.cpp | 5 +- .../qgraphicsscene/tst_qgraphicsscene.cpp | 6 - .../qgraphicsview/tst_qgraphicsview.cpp | 41 ++--- 6 files changed, 70 insertions(+), 188 deletions(-) diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index 9124ff0070..65480bf665 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -3066,8 +3066,6 @@ void tst_QGraphicsAnchorLayout1::testComplexCases() widget->resize(size); QCOMPARE(widget->size(), size); -// QTest::qWait(500); // layouting is asynchronous.. - // Validate for (int i = 0; i < result.count(); ++i) { const BasicLayoutTestResult item = result[i]; diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 6924b78397..34646a9074 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -1826,7 +1826,7 @@ void tst_QGraphicsGridLayout::removeLayout() QGraphicsView view(&scene); view.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowActive(&view)); QRectF r1 = textEdit->geometry(); QRectF r2 = pushButton->geometry(); diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 4f4a11a79c..6c1abaedb3 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -1689,7 +1689,6 @@ void tst_QGraphicsItem::selected_textItem() QGraphicsView view(&scene); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(20); QTRY_VERIFY(!text->isSelected()); QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, @@ -1723,107 +1722,88 @@ void tst_QGraphicsItem::selected_multi() QGraphicsView view(&scene); view.show(); view.fitInView(scene.sceneRect()); - qApp->processEvents(); + QVERIFY(QTest::qWaitForWindowActive(&view)); QVERIFY(!item1->isSelected()); QVERIFY(!item2->isSelected()); - // Start clicking - QTest::qWait(200); - // Click on item1 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); // Click on item2 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(item2->scenePos())); - QTest::qWait(20); QVERIFY(item2->isSelected()); QVERIFY(!item1->isSelected()); // Ctrl-click on item1 QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(item2->isSelected()); QVERIFY(item1->isSelected()); // Ctrl-click on item1 again QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(item2->isSelected()); QVERIFY(!item1->isSelected()); // Ctrl-click on item2 QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, view.mapFromScene(item2->scenePos())); - QTest::qWait(20); QVERIFY(!item2->isSelected()); QVERIFY(!item1->isSelected()); // Click on item1 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); // Click on scene QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(0, 0)); - QTest::qWait(20); QVERIFY(!item1->isSelected()); QVERIFY(!item2->isSelected()); // Click on item1 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); // Ctrl-click on scene QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, view.mapFromScene(0, 0)); - QTest::qWait(20); QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); // Click on scene QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(0, 0)); - QTest::qWait(20); QVERIFY(!item1->isSelected()); QVERIFY(!item2->isSelected()); // Click on item1 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); // Press on item2 QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(item2->scenePos())); - QTest::qWait(20); QVERIFY(!item1->isSelected()); QVERIFY(item2->isSelected()); // Release on item2 QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(item2->scenePos())); - QTest::qWait(20); QVERIFY(!item1->isSelected()); QVERIFY(item2->isSelected()); // Click on item1 QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); // Ctrl-click on item1 QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(!item1->isSelected()); QVERIFY(!item2->isSelected()); // Ctrl-press on item1 QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::ControlModifier, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(!item1->isSelected()); QVERIFY(!item2->isSelected()); @@ -1831,14 +1811,12 @@ void tst_QGraphicsItem::selected_multi() // Ctrl-move on item1 QMouseEvent event(QEvent::MouseMove, view.mapFromScene(item1->scenePos()) + QPoint(1, 0), Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier); QApplication::sendEvent(view.viewport(), &event); - QTest::qWait(20); QVERIFY(!item1->isSelected()); QVERIFY(!item2->isSelected()); } // Release on item1 QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::ControlModifier, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); @@ -1847,7 +1825,6 @@ void tst_QGraphicsItem::selected_multi() // Ctrl-press on item1 QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::ControlModifier, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(!item1->isSelected()); QVERIFY(!item2->isSelected()); @@ -1855,14 +1832,12 @@ void tst_QGraphicsItem::selected_multi() // Ctrl-move on item1 QMouseEvent event(QEvent::MouseMove, view.mapFromScene(item1->scenePos()) + QPoint(1, 0), Qt::LeftButton, Qt::LeftButton, Qt::ControlModifier); QApplication::sendEvent(view.viewport(), &event); - QTest::qWait(20); QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); } // Release on item1 QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::ControlModifier, view.mapFromScene(item1->scenePos())); - QTest::qWait(20); QVERIFY(item1->isSelected()); QVERIFY(!item2->isSelected()); } @@ -3383,9 +3358,8 @@ void tst_QGraphicsItem::childrenBoundingRect() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(30); - QCOMPARE(parent->childrenBoundingRect(), QRectF(-500, -100, 600, 800)); + QTRY_COMPARE(parent->childrenBoundingRect(), QRectF(-500, -100, 600, 800)); } void tst_QGraphicsItem::childrenBoundingRectTransformed() @@ -3576,7 +3550,6 @@ void tst_QGraphicsItem::group() QCOMPARE(scene.items().size(), 4); QCOMPARE(scene.items(group->sceneBoundingRect()).size(), 3); - QTest::qWait(25); QRectF parent2SceneBoundingRect = parent2->sceneBoundingRect(); group->addToGroup(parent2); @@ -3588,8 +3561,6 @@ void tst_QGraphicsItem::group() QCOMPARE(scene.items().size(), 4); QCOMPARE(scene.items(group->sceneBoundingRect()).size(), 4); - QTest::qWait(25); - QList newItems; for (int i = 0; i < 100; ++i) { QGraphicsItem *item = scene.addRect(QRectF(-25, -25, 50, 50), QPen(Qt::black, 0), @@ -3603,12 +3574,9 @@ void tst_QGraphicsItem::group() view.fitInView(scene.itemsBoundingRect()); - int n = 0; foreach (QGraphicsItem *item, newItems) { group->addToGroup(item); QCOMPARE(item->group(), group); - if ((n++ % 100) == 0) - QTest::qWait(10); } } @@ -3798,7 +3766,6 @@ void tst_QGraphicsItem::handlesChildEvents() QGraphicsView view(&scene); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(20); // Pull out the items, closest item first QList items = scene.items(scene.itemsBoundingRect()); @@ -4011,7 +3978,6 @@ void tst_QGraphicsItem::filtersChildEvents() QGraphicsView view(&scene); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(20); QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress); QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); @@ -4137,7 +4103,6 @@ void tst_QGraphicsItem::ensureVisible() } item->ensureVisible(-100, -100, 25, 25); - QTest::qWait(25); for (int x = -100; x < 100; x += 25) { for (int y = -100; y < 100; y += 25) { @@ -4217,8 +4182,6 @@ void tst_QGraphicsItem::cursor() QTest::mouseMove(&view, view.rect().center()); - QTest::qWait(25); - const Qt::CursorShape viewportShape = view.viewport()->cursor().shape(); { @@ -5039,7 +5002,6 @@ void tst_QGraphicsItem::sceneEventFilter() gv.setScene(anotherScene); gv.show(); QVERIFY(QTest::qWaitForWindowExposed(&gv)); - QTest::qWait(25); ti->installSceneEventFilter(ti2); ti3->installSceneEventFilter(ti); delete ti2; @@ -5112,30 +5074,25 @@ void tst_QGraphicsItem::paint() QGraphicsView view2(&scene2); view2.show(); QVERIFY(QTest::qWaitForWindowExposed(&view2)); - QTest::qWait(25); PaintTester tester2; scene2.addItem(&tester2); - qApp->processEvents(); //First show one paint QTRY_COMPARE(tester2.painted, 1); //nominal case, update call paint tester2.update(); - qApp->processEvents(); QTRY_COMPARE(tester2.painted, 2); //we remove the item from the scene, number of updates is still the same tester2.update(); scene2.removeItem(&tester2); - qApp->processEvents(); QTRY_COMPARE(tester2.painted, 2); //We re-add the item, the number of paint should increase scene2.addItem(&tester2); tester2.update(); - qApp->processEvents(); QTRY_COMPARE(tester2.painted, 3); } @@ -6259,7 +6216,6 @@ void tst_QGraphicsItem::untransformable() view.rotate(13); view.shear(qreal(0.01), qreal(0.01)); view.translate(10, 10); - QTest::qWait(25); } } @@ -6298,7 +6254,6 @@ void tst_QGraphicsItem::contextMenuEventPropagation() view.show(); view.resize(200, 200); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(20); QContextMenuEvent event(QContextMenuEvent::Mouse, QPoint(10, 10), view.viewport()->mapToGlobal(QPoint(10, 10))); @@ -6576,15 +6531,12 @@ void tst_QGraphicsItem::ensureUpdateOnTextItem() QGraphicsView view(&scene); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(25); TextItem *text1 = new TextItem(QLatin1String("123")); scene.addItem(text1); - qApp->processEvents(); QTRY_COMPARE(text1->updates,1); //same bouding rect but we have to update text1->setText(QLatin1String("321")); - qApp->processEvents(); QTRY_COMPARE(text1->updates,2); } @@ -6862,7 +6814,6 @@ void tst_QGraphicsItem::opacity2() RESET_REPAINT_COUNTERS child->setOpacity(0.0); - QTest::qWait(10); QTRY_COMPARE(view.repaints, 1); QCOMPARE(parent->repaints, 1); QCOMPARE(child->repaints, 0); @@ -6871,7 +6822,6 @@ void tst_QGraphicsItem::opacity2() RESET_REPAINT_COUNTERS child->setOpacity(1.0); - QTest::qWait(10); QTRY_COMPARE(view.repaints, 1); QCOMPARE(parent->repaints, 1); QCOMPARE(child->repaints, 1); @@ -6880,7 +6830,6 @@ void tst_QGraphicsItem::opacity2() RESET_REPAINT_COUNTERS parent->setOpacity(0.0); - QTest::qWait(10); QTRY_COMPARE(view.repaints, 1); QCOMPARE(parent->repaints, 0); QCOMPARE(child->repaints, 0); @@ -6889,7 +6838,6 @@ void tst_QGraphicsItem::opacity2() RESET_REPAINT_COUNTERS parent->setOpacity(1.0); - QTest::qWait(10); QTRY_COMPARE(view.repaints, 1); QCOMPARE(parent->repaints, 1); QCOMPARE(child->repaints, 1); @@ -6899,7 +6847,6 @@ void tst_QGraphicsItem::opacity2() RESET_REPAINT_COUNTERS child->setOpacity(0.0); - QTest::qWait(10); QTRY_COMPARE(view.repaints, 1); QCOMPARE(parent->repaints, 1); QCOMPARE(child->repaints, 0); @@ -6909,7 +6856,7 @@ void tst_QGraphicsItem::opacity2() child->setOpacity(0.0); // Already 0.0; no change. QTest::qWait(10); - QTRY_COMPARE(view.repaints, 0); + QCOMPARE(view.repaints, 0); QCOMPARE(parent->repaints, 0); QCOMPARE(child->repaints, 0); QCOMPARE(grandChild->repaints, 0); @@ -6933,7 +6880,7 @@ void tst_QGraphicsItem::opacityZeroUpdates() view.reset(); parent->setOpacity(0.0); - QTest::qWait(20); + QTRY_COMPARE(view.repaints, 1); // transforming items bounding rect to view coordinates const QRect childDeviceBoundingRect = child->deviceTransform(view.viewportTransform()) @@ -7002,7 +6949,6 @@ void tst_QGraphicsItem::itemStacksBehindParent() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_VERIFY(!paintedItems.isEmpty()); - QTest::qWait(100); paintedItems.clear(); view.viewport()->update(); QApplication::processEvents(); @@ -7021,34 +6967,32 @@ void tst_QGraphicsItem::itemStacksBehindParent() child11->setFlag(QGraphicsItem::ItemStacksBehindParent); scene.update(); paintedItems.clear(); - QApplication::processEvents(); QTRY_COMPARE(scene.items(rect), (QList() << grandChild121 << child12 << parent1 << grandChild111 << child11 << grandChild211 << child21 << grandChild221 << child22 << parent2)); - QCOMPARE(paintedItems, QList() - << parent2 << child22 << grandChild221 - << child21 << grandChild211 - << child11 << grandChild111 - << parent1 << child12 << grandChild121); + QTRY_COMPARE(paintedItems, QList() + << parent2 << child22 << grandChild221 + << child21 << grandChild211 + << child11 << grandChild111 + << parent1 << child12 << grandChild121); child12->setFlag(QGraphicsItem::ItemStacksBehindParent); paintedItems.clear(); scene.update(); - QApplication::processEvents(); QTRY_COMPARE(scene.items(rect), (QList() << parent1 << grandChild111 << child11 << grandChild121 << child12 << grandChild211 << child21 << grandChild221 << child22 << parent2)); - QCOMPARE(paintedItems, QList() - << parent2 << child22 << grandChild221 - << child21 << grandChild211 - << child12 << grandChild121 - << child11 << grandChild111 << parent1); + QTRY_COMPARE(paintedItems, QList() + << parent2 << child22 << grandChild221 + << child21 << grandChild211 + << child12 << grandChild121 + << child11 << grandChild111 << parent1); } class ClippingAndTransformsScene : public QGraphicsScene @@ -7100,7 +7044,6 @@ void tst_QGraphicsItem::nestedClipping() view.setOptimizationFlag(QGraphicsView::IndirectPainting); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(25); QList expected; expected << root << l1 << l2 << l3; @@ -7293,16 +7236,13 @@ void tst_QGraphicsItem::tabChangesFocus() QTRY_VERIFY(scene.isActive()); dial1->setFocus(); - QTest::qWait(15); QTRY_VERIFY(dial1->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(15); QTRY_VERIFY(view->hasFocus()); QTRY_VERIFY(item->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(15); if (tabChangesFocus) { QTRY_VERIFY(!view->hasFocus()); @@ -7324,10 +7264,6 @@ void tst_QGraphicsItem::cacheMode() QApplication::setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowActive(&view)); - // Increase the probability of window activation - // not causing another repaint of test items. - QTest::qWait(50); - EventTester *tester = new EventTester; EventTester *testerChild = new EventTester; testerChild->setParentItem(tester); @@ -7336,7 +7272,6 @@ void tst_QGraphicsItem::cacheMode() testerChild2->setFlag(QGraphicsItem::ItemIgnoresTransformations); scene.addItem(tester); - QTest::qWait(10); for (int i = 0; i < 2; ++i) { // No visual change. @@ -7361,7 +7296,6 @@ void tst_QGraphicsItem::cacheMode() tester->setPos(10, 10); testerChild->setPos(10, 10); testerChild2->setPos(10, 10); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 2); QCOMPARE(testerChild->repaints, 2); QCOMPARE(testerChild2->repaints, 2); @@ -7378,13 +7312,12 @@ void tst_QGraphicsItem::cacheMode() // Translating does not result in a repaint. tester->setTransform(QTransform::fromTranslate(10, 10), true); QTest::qWait(25); - QTRY_COMPARE(tester->repaints, 2); + QCOMPARE(tester->repaints, 2); QCOMPARE(testerChild->repaints, 2); QCOMPARE(testerChild2->repaints, 2); // Rotating results in a repaint. tester->setTransform(QTransform().rotate(45), true); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 3); QCOMPARE(testerChild->repaints, 3); QCOMPARE(testerChild2->repaints, 2); @@ -7393,7 +7326,6 @@ void tst_QGraphicsItem::cacheMode() tester->setCacheMode(QGraphicsItem::ItemCoordinateCache); // autosize testerChild->setCacheMode(QGraphicsItem::ItemCoordinateCache); // autosize testerChild2->setCacheMode(QGraphicsItem::ItemCoordinateCache); // autosize - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 4); QCOMPARE(testerChild->repaints, 4); QCOMPARE(testerChild2->repaints, 3); @@ -7403,16 +7335,15 @@ void tst_QGraphicsItem::cacheMode() testerChild->setTransform(QTransform().rotate(22), true); testerChild2->setTransform(QTransform().rotate(22), true); QTest::qWait(25); - QTRY_COMPARE(tester->repaints, 4); - QTRY_COMPARE(testerChild->repaints, 4); - QTRY_COMPARE(testerChild2->repaints, 3); + QCOMPARE(tester->repaints, 4); + QCOMPARE(testerChild->repaints, 4); + QCOMPARE(testerChild2->repaints, 3); tester->resetTransform(); testerChild->resetTransform(); testerChild2->resetTransform(); // Explicit update causes a repaint. tester->update(0, 0, 5, 5); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 5); QCOMPARE(testerChild->repaints, 4); QCOMPARE(testerChild2->repaints, 3); @@ -7420,14 +7351,13 @@ void tst_QGraphicsItem::cacheMode() // Updating outside the item's bounds does not cause a repaint. tester->update(10, 10, 5, 5); QTest::qWait(25); - QTRY_COMPARE(tester->repaints, 5); + QCOMPARE(tester->repaints, 5); QCOMPARE(testerChild->repaints, 4); QCOMPARE(testerChild2->repaints, 3); // Resizing an item should cause a repaint of that item. (because of // autosize). tester->setGeometry(QRectF(-15, -15, 30, 30)); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 6); QCOMPARE(testerChild->repaints, 4); QCOMPARE(testerChild2->repaints, 3); @@ -7436,22 +7366,20 @@ void tst_QGraphicsItem::cacheMode() tester->setCacheMode(QGraphicsItem::ItemCoordinateCache, QSize(30, 30)); testerChild->setCacheMode(QGraphicsItem::ItemCoordinateCache, QSize(30, 30)); testerChild2->setCacheMode(QGraphicsItem::ItemCoordinateCache, QSize(30, 30)); - QTest::qWait(20); QTRY_COMPARE(tester->repaints, 7); QCOMPARE(testerChild->repaints, 5); QCOMPARE(testerChild2->repaints, 4); // Resizing the item should cause a repaint. testerChild->setGeometry(QRectF(-15, -15, 30, 30)); - QTest::qWait(25); - QTRY_COMPARE(tester->repaints, 7); - QCOMPARE(testerChild->repaints, 6); + QTRY_COMPARE(testerChild->repaints, 6); + QCOMPARE(tester->repaints, 7); QCOMPARE(testerChild2->repaints, 4); // Scaling the view does not cause a repaint. view.scale(0.7, 0.7); QTest::qWait(25); - QTRY_COMPARE(tester->repaints, 7); + QCOMPARE(tester->repaints, 7); QCOMPARE(testerChild->repaints, 6); QCOMPARE(testerChild2->repaints, 4); @@ -7459,46 +7387,42 @@ void tst_QGraphicsItem::cacheMode() tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache); testerChild->setCacheMode(QGraphicsItem::DeviceCoordinateCache); testerChild2->setCacheMode(QGraphicsItem::DeviceCoordinateCache); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 8); QCOMPARE(testerChild->repaints, 7); QCOMPARE(testerChild2->repaints, 5); // Scaling the view back should cause repaints for two of the items. view.setTransform(QTransform()); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 9); QCOMPARE(testerChild->repaints, 8); QCOMPARE(testerChild2->repaints, 5); // Rotating the base item (perspective) should repaint two items. tester->setTransform(QTransform().rotate(10, Qt::XAxis)); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 10); QCOMPARE(testerChild->repaints, 9); QCOMPARE(testerChild2->repaints, 5); - // Moving the middle item should case a repaint even if it's a move, + // Moving the middle item should cause a repaint even if it's a move, // because the parent is rotated with a perspective. testerChild->setPos(1, 1); - QTest::qWait(25); QTRY_COMPARE(tester->repaints, 11); QTRY_COMPARE(testerChild->repaints, 10); - QTRY_COMPARE(testerChild2->repaints, 5); + QCOMPARE(testerChild2->repaints, 5); tester->resetTransform(); // Make a huge item tester->setGeometry(QRectF(-4000, -4000, 8000, 8000)); QTRY_COMPARE(tester->repaints, 12); QTRY_COMPARE(testerChild->repaints, 11); - QTRY_COMPARE(testerChild2->repaints, 5); + QCOMPARE(testerChild2->repaints, 5); // Move the large item - will cause a repaint as the // cache is clipped. tester->setPos(5, 0); QTRY_COMPARE(tester->repaints, 13); QTRY_COMPARE(testerChild->repaints, 11); - QTRY_COMPARE(testerChild2->repaints, 5); + QCOMPARE(testerChild2->repaints, 5); // Hiding and showing should invalidate the cache tester->hide(); @@ -7518,66 +7442,56 @@ void tst_QGraphicsItem::cacheMode2() QApplication::setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowActive(&view)); - // Increase the probability of window activation - // not causing another repaint of test items. - QTest::qWait(50); - EventTester *tester = new EventTester; scene.addItem(tester); - QTest::qWait(10); QTRY_COMPARE(tester->repaints, 1); // Switching from NoCache to NoCache (no repaint) tester->setCacheMode(QGraphicsItem::NoCache); QTest::qWait(50); - QTRY_COMPARE(tester->repaints, 1); + QCOMPARE(tester->repaints, 1); // Switching from NoCache to DeviceCoordinateCache (no repaint) tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache); QTest::qWait(50); - QTRY_COMPARE(tester->repaints, 1); + QCOMPARE(tester->repaints, 1); // Switching from DeviceCoordinateCache to DeviceCoordinateCache (no repaint) tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache); QTest::qWait(50); - QTRY_COMPARE(tester->repaints, 1); + QCOMPARE(tester->repaints, 1); // Switching from DeviceCoordinateCache to NoCache (no repaint) tester->setCacheMode(QGraphicsItem::NoCache); QTest::qWait(50); - QTRY_COMPARE(tester->repaints, 1); + QCOMPARE(tester->repaints, 1); // Switching from NoCache to ItemCoordinateCache (repaint) tester->setCacheMode(QGraphicsItem::ItemCoordinateCache); - QTest::qWait(50); QTRY_COMPARE(tester->repaints, 2); // Switching from ItemCoordinateCache to ItemCoordinateCache (no repaint) tester->setCacheMode(QGraphicsItem::ItemCoordinateCache); QTest::qWait(50); - QTRY_COMPARE(tester->repaints, 2); + QCOMPARE(tester->repaints, 2); // Switching from ItemCoordinateCache to ItemCoordinateCache with different size (repaint) tester->setCacheMode(QGraphicsItem::ItemCoordinateCache, QSize(100, 100)); - QTest::qWait(50); QTRY_COMPARE(tester->repaints, 3); // Switching from ItemCoordinateCache to NoCache (repaint) tester->setCacheMode(QGraphicsItem::NoCache); - QTest::qWait(50); QTRY_COMPARE(tester->repaints, 4); // Switching from DeviceCoordinateCache to ItemCoordinateCache (repaint) tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache); QTest::qWait(50); - QTRY_COMPARE(tester->repaints, 4); + QCOMPARE(tester->repaints, 4); tester->setCacheMode(QGraphicsItem::ItemCoordinateCache); - QTest::qWait(50); QTRY_COMPARE(tester->repaints, 5); // Switching from ItemCoordinateCache to DeviceCoordinateCache (repaint) tester->setCacheMode(QGraphicsItem::DeviceCoordinateCache); - QTest::qWait(50); QTRY_COMPARE(tester->repaints, 6); } @@ -7595,7 +7509,6 @@ void tst_QGraphicsItem::updateCachedItemAfterMove() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(12); QTRY_VERIFY(tester->repaints > 0); tester->repaints = 0; @@ -7607,8 +7520,7 @@ void tst_QGraphicsItem::updateCachedItemAfterMove() // Move then update, should cause one repaint tester->setPos(20, 0); tester->update(); - QTest::qWait(12); - QCOMPARE(tester->repaints, 1); + QTRY_COMPARE(tester->repaints, 1); // Hiding the item doesn't cause a repaint tester->hide(); @@ -7745,28 +7657,25 @@ void tst_QGraphicsItem::update() EventTester *item = new EventTester; scene.addItem(item); - QTest::qWait(100); // Make sure all pending updates are processed. + QTRY_VERIFY(item->repaints > 0); // Wait for painting item->repaints = 0; item->update(); // Item marked as dirty scene.update(); // Entire scene marked as dirty - qApp->processEvents(); - QCOMPARE(item->repaints, 1); + QTRY_COMPARE(item->repaints, 1); // Make sure the dirty state from the previous update is reset so that // the item don't think it is already dirty and discards this update. item->update(); - qApp->processEvents(); - QCOMPARE(item->repaints, 2); + QTRY_COMPARE(item->repaints, 2); // Make sure a partial update doesn't cause a full update to be discarded. view.reset(); item->repaints = 0; item->update(QRectF(0, 0, 5, 5)); item->update(); - qApp->processEvents(); - QCOMPARE(item->repaints, 1); - QCOMPARE(view.repaints, 1); + QTRY_COMPARE(item->repaints, 1); + QTRY_COMPARE(view.repaints, 1); QRect itemDeviceBoundingRect = item->deviceTransform(view.viewportTransform()) .mapRect(item->boundingRect()).toAlignedRect(); QRegion expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2); @@ -7828,13 +7737,11 @@ void tst_QGraphicsItem::update() item->setPos(originalPos + QPoint(50, 50)); viewPrivate->updateAll(); QVERIFY(viewPrivate->fullUpdatePending); - QTest::qWait(50); + QTRY_VERIFY(view.repaints > 1 && item->repaints > 1); item->repaints = 0; view.reset(); item->setPos(originalPos); - QTest::qWait(50); - qApp->processEvents(); - QCOMPARE(item->repaints, 1); + QTRY_COMPARE(item->repaints, 1); QCOMPARE(view.repaints, 1); COMPARE_REGIONS(view.paintedRegion, expectedRegion + expectedRegion.translated(50, 50)); @@ -7845,7 +7752,6 @@ void tst_QGraphicsItem::update() item->setParentItem(parent); item->setPos(400, 0); scene.addItem(parent); - QTest::qWait(50); itemDeviceBoundingRect = item->deviceTransform(view.viewportTransform()) .mapRect(item->boundingRect()).toAlignedRect(); expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2); @@ -7987,6 +7893,7 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) { + ++repaints; if (startTrack) { //Doesn't use the extended style option so the exposed rect is the boundingRect if (!(flags() & QGraphicsItem::ItemUsesExtendedStyleOption)) { @@ -8001,6 +7908,7 @@ public: QGraphicsRectItem::paint(painter, option, widget); } bool startTrack; + int repaints = 0; }; void tst_QGraphicsItem::itemUsesExtendedStyleOption() @@ -8023,17 +7931,21 @@ void tst_QGraphicsItem::itemUsesExtendedStyleOption() rect->startTrack = false; topLevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); - QTest::qWait(60); + QTRY_VERIFY(rect->repaints > 0); + rect->repaints = 0; rect->startTrack = true; rect->update(10, 10, 10, 10); - QTest::qWait(60); + QTRY_COMPARE(rect->repaints, 1); + rect->repaints = 0; rect->startTrack = false; rect->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true); QVERIFY((rect->flags() & QGraphicsItem::ItemUsesExtendedStyleOption)); - QTest::qWait(60); + QTRY_COMPARE(rect->repaints, 1); + rect->repaints = 0; rect->startTrack = true; rect->update(10, 10, 10, 10); QTest::qWait(60); + // MyStyleOptionTester does not receive a paint event. Why not? } void tst_QGraphicsItem::itemSendsGeometryChanges() @@ -8116,8 +8028,9 @@ void tst_QGraphicsItem::moveItem() grandChild->repaints = 0; \ view.reset(); + RESET_COUNTERS scene.addItem(parent); - QTest::qWait(100); + QTRY_COMPARE(view.repaints, 1); RESET_COUNTERS @@ -8195,15 +8108,13 @@ void tst_QGraphicsItem::moveLineItem() // Make sure the calculated region is correct. item->update(); - QTest::qWait(10); QTRY_COMPARE(view.paintedRegion, expectedRegion); view.reset(); // Old position: (50, 50) item->setPos(50, 100); expectedRegion += expectedRegion.translated(0, 50); - QTest::qWait(10); - QCOMPARE(view.paintedRegion, expectedRegion); + QTRY_COMPARE(view.paintedRegion, expectedRegion); } void tst_QGraphicsItem::sorting_data() @@ -8251,7 +8162,7 @@ void tst_QGraphicsItem::sorting() view.show(); qApp->setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowActive(&view)); - QTest::qWait(100); + QTRY_VERIFY(_paintedItems.count() > 0); _paintedItems.clear(); @@ -8334,7 +8245,6 @@ void tst_QGraphicsItem::hitTestUntransformableItem() item3->setPos(80, 80); scene.addItem(item1); - QTest::qWait(100); QList items = scene.items(QPointF(80, 80)); QCOMPARE(items.size(), 1); @@ -8391,7 +8301,8 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() item3->brush = Qt::blue; scene.addItem(item1); - QTest::qWait(100); + QTRY_COMPARE(item2->repaints, 1); + QCOMPARE(item3->repaints, 1); item1->repaints = 0; item2->repaints = 0; @@ -8401,10 +8312,9 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem() QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect; shadow->setOffset(-20, -20); item1->setGraphicsEffect(shadow); - QTest::qWait(50); // Make sure all visible items are repainted. - QCOMPARE(item1->repaints, 1); + QTRY_COMPARE(item1->repaints, 1); QCOMPARE(item2->repaints, 1); QCOMPARE(item3->repaints, 1); diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 97f3eb4a60..f9b6fe3ebd 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -612,7 +612,6 @@ void tst_QGraphicsLinearLayout::insertStretch() } } - //QTest::qWait(1000); delete widget; } @@ -639,7 +638,6 @@ void tst_QGraphicsLinearLayout::invalidate() layout.setContentsMargins(0, 0, 0, 0); view.show(); widget->show(); - //QTest::qWait(1000); QVERIFY(QTest::qWaitForWindowExposed(&view)); qApp->processEvents(); layout.layoutRequest = 0; @@ -1218,7 +1216,6 @@ void tst_QGraphicsLinearLayout::testStretch() //view->setSceneRect(-50, -50, 800, 800); //view->show(); //QVERIFY(QTest::qWaitForWindowExposed(view)); - //QTest::qWait(5000); QCOMPARE(form->geometry().size(), QSizeF(600,600)); QCOMPARE(w1->geometry(), QRectF(0, 0, 100, 100)); QCOMPARE(w2->geometry(), QRectF(400, 0, 200, 200)); @@ -1521,7 +1518,7 @@ void tst_QGraphicsLinearLayout::removeLayout() QGraphicsView view(&scene); view.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowActive(&view)); QRectF r1 = textEdit->geometry(); QRectF r2 = pushButton->geometry(); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 3b340d06ab..0071c39f49 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -3108,7 +3108,6 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems() // Check that everyone loses focus when the widget is hidden. widget.hide(); - QTest::qWait(15); QTRY_VERIFY(!view->hasFocus()); QVERIFY(!view->viewport()->hasFocus()); QVERIFY(!scene.hasFocus()); @@ -4056,7 +4055,6 @@ void tst_QGraphicsScene::isActive() QVERIFY(!scene2.hasFocus()); toplevel1.hide(); - QTest::qWait(50); QTRY_VERIFY(!scene1.isActive()); QTRY_VERIFY(!scene2.isActive()); QVERIFY(!scene1.hasFocus()); @@ -4381,7 +4379,6 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts() QVERIFY(QTest::qWaitForWindowExposed(view)); view->repaints = 0; proxy->update(10, 10, 10, 10); - QTest::qWait(50); QTRY_VERIFY(view->repaints > 0); QPixmap pix; @@ -4427,7 +4424,6 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() QVERIFY(QTest::qWaitForWindowExposed(view)); view->repaints = 0; rectItem->update(10, 10, 10, 10); - QTest::qWait(50); QTRY_VERIFY(view->repaints > 0); QPixmap pix; @@ -4469,7 +4465,6 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() QVERIFY(QTest::qWaitForWindowExposed(view)); view->repaints = 0; rectItem->update(10, 10, 10, 10); - QTest::qWait(50); QTRY_VERIFY(view->repaints > 0); QPixmap pix; @@ -4510,7 +4505,6 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() QVERIFY(QTest::qWaitForWindowExposed(view)); view->repaints = 0; rectItem->update(10, 10, 10, 10); - QTest::qWait(50); QTRY_VERIFY(view->repaints > 0); QPixmap pix; diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 10129eb10c..f52bbce53a 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -507,10 +507,8 @@ void tst_QGraphicsView::setScene() view.setScene(0); - QTest::qWait(25); - - QVERIFY(!view.horizontalScrollBar()->isVisible()); - QVERIFY(!view.verticalScrollBar()->isVisible()); + QTRY_VERIFY(!view.horizontalScrollBar()->isVisible()); + QTRY_VERIFY(!view.verticalScrollBar()->isVisible()); QVERIFY(!view.horizontalScrollBar()->isHidden()); QVERIFY(!view.verticalScrollBar()->isHidden()); @@ -572,13 +570,12 @@ void tst_QGraphicsView::sceneRect_growing() QGraphicsView view(&scene, &toplevel); view.setFixedSize(200, 200); toplevel.show(); + QVERIFY(QTest::qWaitForWindowActive(&toplevel)); int size = 200; scene.setSceneRect(-size, -size, size * 2, size * 2); QCOMPARE(view.sceneRect(), scene.sceneRect()); - QTest::qWait(25); - QPointF topLeft = view.mapToScene(0, 0); for (int i = 0; i < 5; ++i) { @@ -641,14 +638,14 @@ void tst_QGraphicsView::viewport() QVERIFY(view.viewport() != 0); view.show(); - QTest::qWait(25); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QPointer widget = new QWidget; view.setViewport(widget); QCOMPARE(view.viewport(), (QWidget *)widget); view.show(); - QTest::qWait(25); + QVERIFY(QTest::qWaitForWindowExposed(&view)); view.setViewport(0); QVERIFY(widget.isNull()); @@ -656,7 +653,7 @@ void tst_QGraphicsView::viewport() QVERIFY(view.viewport() != widget); view.show(); - QTest::qWait(25); + QVERIFY(QTest::qWaitForWindowExposed(&view)); } #ifndef QT_NO_OPENGL @@ -888,8 +885,6 @@ void tst_QGraphicsView::dragMode_rubberBand() // We don't use QRubberBand as of 4.3; the band is drawn internally. QVERIFY(!view.findChild()); - QTest::qWait(25); - { // Move QMouseEvent event(QEvent::MouseMove, @@ -902,8 +897,6 @@ void tst_QGraphicsView::dragMode_rubberBand() QCOMPARE(view.horizontalScrollBar()->value(), horizontalScrollBarValue); QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue); - QTest::qWait(25); - { // Release QMouseEvent event(QEvent::MouseButtonRelease, @@ -919,8 +912,6 @@ void tst_QGraphicsView::dragMode_rubberBand() QCOMPARE(view.viewport()->cursor().shape(), cursorShape); #endif - QTest::qWait(25); - if (view.scene()) QCOMPARE(scene.selectedItems().size(), 1); @@ -1074,7 +1065,7 @@ void tst_QGraphicsView::backgroundBrush() QCOMPARE(scene.backgroundBrush(), QBrush(Qt::blue)); view.show(); - QTest::qWait(25); + QVERIFY(QTest::qWaitForWindowExposed(&view)); scene.setBackgroundBrush(QBrush()); QCOMPARE(scene.backgroundBrush(), QBrush()); @@ -1096,7 +1087,7 @@ void tst_QGraphicsView::foregroundBrush() QCOMPARE(scene.foregroundBrush(), QBrush(Qt::blue)); view.show(); - QTest::qWait(25); + QVERIFY(QTest::qWaitForWindowExposed(&view)); scene.setForegroundBrush(QBrush()); QCOMPARE(scene.foregroundBrush(), QBrush()); @@ -2052,7 +2043,7 @@ void tst_QGraphicsView::mapFromSceneRect() view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); topLevel.show(); - QTest::qWait(25); + QVERIFY(QTest::qWaitForWindowActive(&view)); QPolygon polygon; polygon << QPoint(98, 98); @@ -2459,7 +2450,6 @@ void tst_QGraphicsView::viewportUpdateMode() // Issue two scene updates. scene.update(QRectF(0, 0, 10, 10)); scene.update(QRectF(20, 0, 10, 10)); - QTest::qWait(50); // The view gets two updates for the update scene updates. QTRY_VERIFY(!view.lastUpdateRegions.isEmpty()); @@ -2565,8 +2555,7 @@ void tst_QGraphicsView::viewportUpdateMode2() view.lastUpdateRegions.clear(); viewPrivate->processPendingUpdates(); - QTest::qWait(50); - QCOMPARE(view.lastUpdateRegions.size(), 1); + QTRY_COMPARE(view.lastUpdateRegions.size(), 1); // Note that we adjust by 2 for antialiasing. QCOMPARE(view.lastUpdateRegions.at(0), QRegion(boundingRect.adjusted(-2, -2, 2, 2) & viewportRect)); #endif @@ -2763,8 +2752,7 @@ void tst_QGraphicsView::optimizationFlags_dontSavePainterState2() // Make sure the view is repainted; otherwise the tests below will fail. view.viewport()->repaint(); - QTest::qWait(200); - QVERIFY(view.painted); + QTRY_VERIFY(view.painted); // Make sure the painter's world transform is preserved after drawItems. QTransform expectedTransform = view.viewportTransform(); @@ -3676,7 +3664,6 @@ void tst_QGraphicsView::centerOnDirtyItem() toplevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&toplevel)); - QTest::qWait(50); QImage before(view.viewport()->size(), QImage::Format_ARGB32); view.viewport()->render(&before); @@ -3684,8 +3671,6 @@ void tst_QGraphicsView::centerOnDirtyItem() item->setPos(20, 0); view.centerOn(item); - QTest::qWait(50); - QImage after(view.viewport()->size(), QImage::Format_ARGB32); view.viewport()->render(&after); @@ -4279,8 +4264,6 @@ void tst_QGraphicsView::update_ancestorClipsChildrenToShape2() QCOMPARE(view.lastUpdateRegions.at(0), QRegion(expected.toAlignedRect())); #endif - QTest::qWait(50); - view.lastUpdateRegions.clear(); view.painted = false; @@ -4478,7 +4461,7 @@ void tst_QGraphicsView::indirectPainting() view.setOptimizationFlag(QGraphicsView::IndirectPainting); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(100); + QTRY_VERIFY(scene.drawCount > 0); scene.drawCount = 0; item->setPos(20, 20); -- cgit v1.2.3