summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Raise cmake_minimum_required to VERSION 3.16 in examplesJoerg Bornemann2021-08-17239-241/+241
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95636 Change-Id: I1270b4846d8a23bc3563b6942c0910e095d2be4a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Suggest "ninja install" for multi-config buildsJoerg Bornemann2021-08-171-0/+7
| | | | | | | | | | | The configure summary now suggests "ninja install" for Ninja Multi-Config builds, because "cmake --install ." does not install all configurations. See CMake upstream issue #21475. Pick-to: 6.2 Change-Id: Ie3129a906945db9d09c6772ce66ec7239797b8fc Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use a scope-guard to take care of process deletion in a testEdward Welbourne2021-08-171-6/+5
| | | | | | | | | | Doing the deletion at the end of the block only works if the test passes. Drive-by: remove spurious braces from single-line bodies of single-line controls. The QTest macros are done properly. Pick-to: 6.2 6.1 5.15 Change-Id: I83002547dba49ab9792f4db44d73151b1c036900 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Attempt to unwedge tst_QThread::wait3_slowDestructor()Edward Welbourne2021-08-171-13/+15
| | | | | | | | | | | | | | | | When the test failed, it never released the blocking slot, so the tested thread remained blocked indefinitely. Blacklisting doesn't rescue that: the test run gets killed by Coin's watchdog. Use a QScopeGuard() to release the clocked slot on failure. replacing the release that was happening only on success. As drive-by clean-up, smarten up the code a little and remove an unused enum. Pick-to: 6.2 6.1 5.15 Change-Id: Ie035dafe6e4b1d82aea5de38ceb31c0f7fcf81d7 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Expand testing of QEXPECT_FAIL()Edward Welbourne2021-08-177-255/+981
| | | | | | | | | Test both Abort and Continue cases. Test more with successive marked as expected failure. Test cases with a QSKIP after the marked check. Unify data functions where practical. Change-Id: I2eade5e4dd0907d23e37137ce3d93cd5ca79f802 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tests: Remove unused SRCDIR definesIevgenii Meshcheriakov2021-08-1719-35/+0
| | | | | | | | | | | Remove SRCDIR defines from tests that don't use them. There is a standard define called QT_TESTCASE_SOURCEDIR that is available to all tests and serves the same purpose. Pick-to: 6.2 Change-Id: I2aa237739c011495e31641cca525dc0eeef3c870 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* macOS: Don't wipe NSWindowStyleMaskFullSizeContentView if set manuallyTor Arne Vestbø2021-08-171-1/+3
| | | | | | | | | | The NSWindow may have style masks set by the user via winId(). We don't want to wipe those just because we're recomputing the style mask. Fixes: QTBUG-69975 Pick-to: 6.2 6.1 5.15 Change-Id: Ibca8388d45b623f4cdfaff4b256c4eb012e2ffac Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Fix some old copy-and-paste errors in QByteArrayView docsEdward Welbourne2021-08-171-8/+8
| | | | | | | | | | | Various texts copied from QByteArray were still talking about the byte array, not the byte array view. Change-Id: Ief46f6053641b7a19f8be7b20562f4b9ed66f6b3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* CMake: Fix feature evaluation for feature definesJoerg Bornemann2021-08-171-1/+6
| | | | | | | | | | | | | | | | | Passing -DFEATURE_developer_build=TRUE did not add the define QT_BUILD_INTERNAL to src/corelib/global/qconfig.h like -DFEATURE_developer_build=ON would. This happened, because the feature evaluation in qt_evaluate_feature_definition did a string comparison against "ON". Normalize both sides of the string comparison, and thus support all booly values for features. Pick-to: 6.2 Fixes: QTBUG-95732 Change-Id: Ibf03579c05919b35219438361fc93676b7cca7cc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QStyle: allow styles to control the margin around icons in QLineEditWang Peng2021-08-174-2/+8
| | | | | | | | | The styles can't control the margin of the icon container, and its value is hardcoded to a quarter of the iconSize, which is very unfriendly. Add a PixelMetric enum value to allow styles to control the margin. Change-Id: I21274b68d24150db7be78513fe9125f775aa2b00 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Change since for QNativeInterface::QX11Application to 6.2Jonas Kvinge2021-08-171-1/+1
| | | | | | | | | The documention currently incorrectly lists QNativeInterface::QX11Application as available since 6.0. Pick-to: 6.2 Change-Id: I13256a1504b2bd93296434438835791f12353089 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QString/QByteArray::number(double): Test big numbersMårten Nordheim2021-08-173-3/+42
| | | | | | | | | | | Exhausts the entire buffer which double-conversion is left to work with. Also has a large amount of precision, which apparently we need to store temporarily. Task-number: QTBUG-88484 Change-Id: I87e8c323676465f1b8695e086020df1240d0d0d7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Make precompiled headers work for Android on WindowsJoerg Bornemann2021-08-171-0/+9
| | | | | | | | | | | | | | When building Qt for Android on Windows, the precompile_headers test failed if the source directory was passed as absolute path without drive letter. See CMake upstream issue #22534. Work around the CMake issue by ensuring that the path is properly prefixed with a drive letter. Pick-to: 6.2 Fixes: QTBUG-95652 Change-Id: I3154b6c0bb2f53533306227074b24fbbf5973b05 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Replace usage of WIN32 with CMAKE_HOST_WIN32 in qconfig.cppAlexandru Croitor2021-08-171-1/+1
| | | | | | | | | | | | | The workaround of adding a drive letter to QT_CONFIGURE_PREFIX_PATH_STR should be done when running on any Windows host, not only when targeting Windows. Amends 59c3be711728ab0aa644bfdf50e91a1b020f95bb Pick-to: 6.1 6.2 Task-number: QTBUG-87580 Change-Id: Ic6ca50aa58a4a54fb483e90fe61a907fe86cb002 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Exclude dSYM INSTALL commands for already excluded tools in debugMartin Vejdarski2021-08-173-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | Debug tools are excluded from the ALL target for debug_and_release builds. However, when using the -separate-debug-info option, the same exclusion wasn't being applied for their dSYM INSTALL commands, resulting in a CMake install error. Pass any additional install args like EXCLUDE_FROM_ALL COMPONENT "ExcludedExecutables" to the installation rules of qt_enable_separate_debug_info and install dSYMs for executables per-config in a multi-config build. All the non-main config executable install rules are optional because the non-main config executables are excluded from ALL. Amends 5b136abd21803988f96b9b66c992822efbef97ec Pick-to: 6.2 Fixes: QTBUG-93999 Change-Id: I95c3ce28215c3ee535551e4b7a5fa9731f8f1c28 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Save QT_BUILD_BENCHMARKS and other info in BuildInternalsExtraAlexandru Croitor2021-08-171-0/+7
| | | | | | | | | | So that those values are used when configuring other repos in a per-repo build arrangement. Pick-to: 6.2 Change-Id: I5ff86260116c52afc87d7fcd5cbd047fcb9dde22 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Forward declare Objective-C classes as class, not typedef objc_objectTor Arne Vestbø2021-08-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Forward declaring an Objective-C class in Objective-C/C++ mode is done by using the `@class` syntax, e.g.: @class NSString; In C/C++ mode however there's no documented approach, so we chose to flatten the type down to the opaque objc_object "base class": typedef struct objc_object NSString; As it turns out, when Objective-C classes are used as arguments or return types in C++, the signature they produce is equal to what it would have been if the type was a normal class. For example: void foo(NSString *) -> __Z3fooP8NSString The is due to @class in Objective-C++ just being just sugar, so an NSString pointer is not treated as `struct objc_object *` but rather a pointer to a distinct type, which then gets mangled as such by LLVM's Itanium mangler in CXXNameMangler::mangleType(const ObjCObjectType *T). With our current forward declaration however, we are expecting: void foo(NSString *) -> __Z3fooP11objc_object As a consequence exported helper functions such as QString::fromNSString() are not possible to use from plain C++ right now, as it will give a linker error for the missing QString::fromNSString(objc_object*) function. And even if we did define the extra signature, it would not be possible to declare overloaded functions taking Objective-C classes, as they would all produce ambiguous overloads in C++ mode. To fix this we change the forward declaration to a plain old class, which matches the signature in both Objective-C++ and plain C++ mode, and allows overloads. This is a binary compatible change, as no client were using any of these functions from C++ anyways as they would have produced linker errors. It does have a slight source compatible break, for clients that manually forward declared classes using the old style, but that use-case is deemed fringe enough to accept, and clients can work around this by defining Q_FORWARD_DECLARE_OBJC_CLASS to their preferred format, which Qt will respect. Pick-to: 6.2 Change-Id: I04813c60a7da22379dd9de1be56cc12c53a38232 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QByteArray: Disentangle number(double) from QLocaleMårten Nordheim2021-08-173-7/+9
| | | | | | | | | | | | | | Previously number(double) would go through QLocale which takes a lot of factors into consideration (which we don't need in this case) and outputs a QString in the end, which we then have to convert back to QByteArray. Avoid all that extra work and format it directly into a QByteArray. The other number() functions do not use QLocale, so are left alone for now. Task-number: QTBUG-88484 Change-Id: I4c2eaf101a55ba16e858f95017fb171589a0184e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make double-formatting code ready for QByteArrayMårten Nordheim2021-08-171-30/+45
| | | | | | | | | | | Split off the actual logic in qdtoBasicLatin into a templated function, qdtoString, which supports both QByteArray and QString. Since it uses qullToBasicLatin_helper as part of its fallback path make the same change to it. Task-number: QTBUG-88484 Change-Id: Icac75ee74ba6a9ddc3aa8d4782a981ef50a88db4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QString::number(double): Disentangle from the QLocale pathMårten Nordheim2021-08-173-5/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By writing code to do formatting without considering locale The code tries to not do any unnecessary (re)allocations, and as such it reserves at the beginning and only appends. Cuts execution times of benchmarks by between 30% and 80%: PASS : tst_QString::initTestCase() PASS : tst_QString::number_double(0, format 'f', precision 0) RESULT : tst_QString::number_double():"0, format 'f', precision 0": - 0.0001774 msecs per iteration (total: 2,661, iterations: 15000000) + 0.0001238 msecs per iteration (total: 1,858, iterations: 15000000) PASS : tst_QString::number_double(0, format 'f', precision 0) RESULT : tst_QString::number_double():"0, format 'f', precision 0": - 0.0002472 msecs per iteration (total: 3,709, iterations: 15000000) + 0.0001407 msecs per iteration (total: 2,111, iterations: 15000000) PASS : tst_QString::number_double(0.12340, format 'f', precision 5) RESULT : tst_QString::number_double():"0.12340, format 'f', precision 5": - 0.0004769 msecs per iteration (total: 7,155, iterations: 15000000) + 0.0001638 msecs per iteration (total: 2,458, iterations: 15000000) PASS : tst_QString::number_double(-0.12340, format 'f', precision 5) RESULT : tst_QString::number_double():"-0.12340, format 'f', precision 5": - 0.0005759 msecs per iteration (total: 8,639, iterations: 15000000) + 0.0001664 msecs per iteration (total: 2,497, iterations: 15000000) PASS : tst_QString::number_double(1.618033988749895, format 'f', precision 15) RESULT : tst_QString::number_double():"1.618033988749895, format 'f', precision 15": - 0.0003644 msecs per iteration (total: 5,467, iterations: 15000000) + 0.0001869 msecs per iteration (total: 2,804, iterations: 15000000) PASS : tst_QString::number_double(2.220446049e-16, format 'g', precision 10) RESULT : tst_QString::number_double():"2.220446049e-16, format 'g', precision 10": - 0.00070580 msecs per iteration (total: 10,587, iterations: 15000000) + 0.0002277 msecs per iteration (total: 3,416, iterations: 15000000) PASS : tst_QString::number_double(1.0E-04, format 'E', precision 1) RESULT : tst_QString::number_double():"1.0E-04, format 'E', precision 1": - 0.00082213 msecs per iteration (total: 12,332, iterations: 15000000) + 0.0002018 msecs per iteration (total: 3,028, iterations: 15000000) PASS : tst_QString::number_double(1.0E+08, format 'E', precision 1) RESULT : tst_QString::number_double():"1.0E+08, format 'E', precision 1": - 0.00082459 msecs per iteration (total: 12,369, iterations: 15000000) + 0.0002016 msecs per iteration (total: 3,025, iterations: 15000000) PASS : tst_QString::number_double(-1.0E+08, format 'E', precision 1) RESULT : tst_QString::number_double():"-1.0E+08, format 'E', precision 1": - 0.00093840 msecs per iteration (total: 14,076, iterations: 15000000) + 0.0002074 msecs per iteration (total: 3,111, iterations: 15000000) PASS : tst_QString::cleanupTestCase() -Totals: 11 passed, 0 failed, 0 skipped, 0 blacklisted, 153777ms +Totals: 11 passed, 0 failed, 0 skipped, 0 blacklisted, 48753ms Task-number: QTBUG-88484 Change-Id: I23234467801243b163dff5cccf8a9fe9d90c3e2a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QUrl: Improve Punycode overflow handlingIevgenii Meshcheriakov2021-08-162-24/+54
| | | | | | | | | | | | | | | | | | | | Add more overflow checks from the sample code in RFC 3492. Also check if a code point to be inserted into output is in the allowable range for Unicode. Rewrite all overflow checks to use {add,mul}_overflow() functions. Do not try to process any inputs that are too long to be part of a valid domain name label. This fixes a test in tst_qurlinternal. Fixes: QTBUG-95689 Pick-to: 6.2 Change-Id: Ice0b3cd640d8a688b63a791192ef2fa2f13444be Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix printing with unhinted fontsEskil Abrahamsen Blomfeldt2021-08-163-3/+55
| | | | | | | | | | | | | | | | | | On high-dpi displays or when you explicitly select an unhinted font, we pick a DirectWrite font engine. This hit an uncovered code path on Windows, because we relied on being able to get the HFONT from the font engine. To fix this, we introduce an alternative code path which gets the HFONT based on the DirectWrite font when this font engine is active. [ChangeLog][Windows] Fixed an issue where the characters in printed text would look too small. Pick-to: 6.1 6.2 Fixes: QTBUG-95720 Change-Id: Ifd609e92512e1f25f0ee2aace35cb5ccedf09030 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QVarLengthArray: add missing default-ctor documentationMarc Mutz2021-08-161-0/+5
| | | | | | | | | Was lost when we un-explicit'ed the default ctor in c34242c679aaea6ee1badf6c1e5f274f925f5f50. Pick-to: 6.2 6.1 5.15 Change-Id: Ifb4943b9e9647ae59c1cc6d5fc5076e8620b73ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTime: port away from takeFirst() useMarc Mutz2021-08-161-6/+11
| | | | | | | | | | | | | | | | | | Use the std-compatible API subset instead. This is in preparation of using QVarLengthArray instead of QList here, which (thankfully, because it's inefficient for arbitray T) doesn't have pop_front(). As a drive-by, port at(0) to front() and introduce a temporary variable. The front() call will briefly emit a detach attempt (but the container isn't shared, so it won't actually detach), but only until the next patch ports to QVLA. Change-Id: I38ee123aa6730aee5ba1e14ec46fc71c5d74986e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add benchmark for QMetaEnumMarc Mutz2021-08-163-0/+88
| | | | | Change-Id: If57f00b14713f2083260a00fd833da62d6f1cd57 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMetaEnum: stop parsing when an invalid key is foundMarc Mutz2021-08-161-1/+1
| | | | | | | | | | | | | | | | The old code obfuscated the algorithm by or'ing -1 into the return value, which is equivalent to setting it to -1 on two's complement architectures (which C++ these days requires), and happily continuing to accumulate potential keys. But nothing that can be or'ed into -1 will ever change the value, so this is rather pointless, as we're not emitting diagnostics apart from setting a bool to false. Fix by simply returning -1. That makes it obvious what we're returning, and we return early on error. Pick-to: 6.2 Change-Id: I8957f44e03609ad58d6c25d5fa78c57190b14bdd Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: add support for emplacementMarc Mutz2021-08-163-5/+52
| | | | | | | | | | | | | Take the rvalue insert() function and turn it into the emplace() function. Reformulate rvalue-insert using emplace(). Lvalue insert() is using a different code path, so leave that alone. This way, we don't need to go overboard with testing. [ChangeLog][QtCore][QVarLengthArray] Added emplace(), emplace_back(). Change-Id: I3e1400820ae0dd1fe87fd4b4c518f7f40be39f8b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Short live namespace q20!Marc Mutz2021-08-163-0/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | As proposed already for Qt 5 (then with q14 and q17), add reimplementations of C++20 library features into a q20 namespace. The advantage is that we can later just s/q20::/std::/ and be sure that a) the q20 functionality works (within reason) like the std counterparts and b) we don't have to re-indent the code after the replacement. Start with std::identity in q20functional.h, required by std::ranges::{any,all,none}_of() (ex ranges[1]) in q20algorithm.h, which I happen to require in QLibrary next. [1] We can't provide the nice range-based overloads (any_of(vector, pred)), yet, because that would require to reimplement all the range-related concepts, as the overloads are ambiguous if unconstrained. First, we should check whether we can't just depend on Nieber's ranges-v3 library instead. The q20 namespace is independent of this decision, as it's more universally useful (q20::remove_cvref comes to mind). Unlike in q14/q17 times, a single header, q20.h, would become unwieldy very soon, so use separate headers. Change-Id: I14b98c865e242d2dc9674bc1bff5f7a9e4db9940 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStandardPaths/Unix: use QStringTokenizerMarc Mutz2021-08-161-3/+1
| | | | | | | | | | Avoids having to allocate storage to hold the parts. Since the startsWith('/') will fail for empty parts, remove the SkipEmptyParts so we don't check for emptiness twice. Change-Id: Id33a52d5fbd29f7a9d4ead758729195bb201a369 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDir: use QStringTokenizerMarc Mutz2021-08-161-3/+1
| | | | | | | | Avoids having to allocate storage to hold the parts. Change-Id: Ie4d877af959751139f4c098b644e4a57f63d03b9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLibrary: succeed early for .dylib on DarwinMarc Mutz2021-08-161-4/+5
| | | | | | | | | | Drag the cheap check for 'fileName.endsWith(".dylib")' to before the expensive operations (QFileInfo creation, extraction and splitting of completeSuffix(), building of suffix candidate list, ...), at the cost of a duplicated Q_OS_DARWIN check. Change-Id: I8ed764f18f0beb8ad24c30ab806ecc5452159601 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update bundled Freetype to 2.10.4Liang Qi2021-08-16577-20564/+7370
| | | | | | | | | | | | | | | | | Removed everything, imported with help of import_from_tarball.sh script, and then added a pre-generated builds/unix/ftconfig.h This also amends 58f56950848bae9c90da3873090c7698e0128b12 because it is not a clean update, some old files are still there. Also redo the fix for wasm like 30f4ca4e4fbc1d8cf86808dbeb00ec3c046f6c1c. Fixes: QTBUG-82480 Pick-to: 6.2 Change-Id: I45ee3230299908ca0372e035636dd64b6c549a27 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* macOS: Add logging for keyboard and complex text inputTor Arne Vestbø2021-08-164-9/+63
| | | | | | Pick-to: 6.2 Change-Id: I098829e051d4f63950b2e35ee6dd4def8d70cf01 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Map dead keys directly to their terminator when building key mapTor Arne Vestbø2021-08-162-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a key press comes in we may end up in QAppleKeyMapper::possibleKeys() as part of checking whether the key press should trigger a QShortcut. The function builds on QAppleKeyMapper::keyMapForKey(), which provides a map from the given virtual key to all the possible Qt::Keys that can be produced by applying different modifier key combinations. The map is built using the Carbon function UCKeyTranslate, that takes the current keyboard layout, virtual key, and modifiers, and produces the resulting characters. The function also maintains a running dead key state via one of the arguments. When mapping a dead key, the state variable will be updated to the current dead key state, which then affects the next call to the function (for the next key press). The problem is that we're not calling UCKeyTranslate for each key press. We are calling it in a loop, for a single key press, to build up a map of all the possible characters produced by varying the modifier keys. And in doing so, we are passing on the dead key state from one call to the next, even if these are for different modifiers. The result is that the first call, for the dead key, results in mapping to \0, as UCKeyTranslate produces no output, it only modifies the dead key state. And then the next call, for the next modifier key combination, results in mapping to a character that incorrectly incorporates the dead key state (resetting it in the process). What we really want is to directly map the initial modifier combination to the dead key terminator character, if one is defined. This is the character produced if the dead key state is cancelled, for example by pressing a key that's not defined in the dead key state. To achieve this we pass kUCKeyTranslateNoDeadKeysMask as the translate options to UCKeyTranslate, and always reset the dead key state before every call. Another common way to achieve the same result would be to call UCKeyTranslate a second time when detecting that the first call produced a dead key state, for example with a synthetic space key, to trigger the terminator output. But this can potentially fail if the space key actually has a defined output in the dead key state. Fixes: QTBUG-95471 Pick-to: 6.2 6.1 Change-Id: Icdae7639fd9a641a86c9d6615679bd93d380ff5c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* macOS: Don't treat null-key as potential shortcut keyTor Arne Vestbø2021-08-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When mapping virtual keys and modifiers to their corresponding characters via a keyboard layout we may hit combinations that do not produce any characters. This can happen if there's no <key> element defined for the virtual key, or if the output attribute of the element is empty (despite the spec saying there should always be one UTF-16 code point in the output). https://developer.apple.com/library/archive/technotes/tn2056/_index.html When that happens QAppleKeyMapper::keyMapForKey() will map the combination to a null-QChar, resulting in the "key" being 0. We do not want to propagate this back to the QShortcutMap machinery, as QShortcutMap does not validate the keys coming out of QKeyMapper::possibleKeys(). In particular, it doesn't check the isEmpty() or count() of the QKeySequences it creates. And even if it did, QKeySequence itself seems to treat Qt::Key(0) + Qt::SomeModifier as a non-empty sequence, so passing on 0-keys would still give weird bugs. The user-visible result of passing back 0-keys is that QShortcutMap will treat it as a partial match for any incoming key combination (as long as some modifier is pressed that triggers the QShortcutMap machinery), which resulting in eating the key press. This compounded the issue in QTBUG-95471. Regression after fab3dfff7d53d496a31c5d2df972ddacfe861a4d. Task-number: QTBUG-95471 Pick-to: 6.1 6.2 Change-Id: I2e51ec86f4df2a708e1757be827ab74859be3c8b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Fix some errors in docs of string-related classesSona Kurazyan2021-08-164-99/+100
| | | | | | | | | | | | | | | | | | - Fixed various texts in docs for QStringView, QUtf8StringView and QAnyStringView copied from QString, that are still talking about string or string reference instead of string view. - Replaced 'string-view' with 'string view', which is the more commonly used form. - Fixed the wrong usage of uppercase 'If' in some places. - Did minor adjusments, to make the docs consistent with docs of QByteArray/QByteArrayView. Change-Id: Ifb905e00957e869a8befad5a36d6b00b6e621a04 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QGraphicsProxyWidget: fix propagation of high-precision eventsVolker Hilsheimer2021-08-166-17/+107
| | | | | | | | | | | | | | | | | | | | | | | | | In order to fix QTBUG-95552 properly we have to add APIs to QGraphicsSceneWheelEvent that informs QGraphicsProxyWidget about whether the event is a high-precision event where Qt grabs the wheel. If it is, then the wheel grabber will be the QGraphicsView's viewport, and any wheel event sent to any widget will be grabbed by it. This results in infinite recoursion, partly fixed in change I78400ceae8da7a4e22a988c06ed58f99f1a979f4. The proper fix is to re-grab the wheel by the embedded widget if it (or any of its children) accepts the ScrollBegin event (and if not, return the grab to the QGraphicsView). This fixes the scenarios that failed in the test case, so now scrolling through nested widgets and scrolling in nested widgets works as the user would expect. Fixes: QTBUG-95552 Pick-to: 6.2 Change-Id: I3e1f31cbff999c70f8c63c034f77cd2ae567d7e3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Don't crash in high-precision wheel scrolls on a QGraphicsProxyWidgetVolker Hilsheimer2021-08-163-4/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For high-precision wheel scrolling sequences, the widget that gets the first (typically ScrollBegin) event grabs the wheel. Qt directs all future wheel events within the same sequence (i.e. until ScrollEnd) to that widget. QGraphicsView passes wheel events through to the item under the mouse, and QGraphicsProxyWidget implements wheelEvent to forward a synthesized QWheelEvent to the embedded widget. Since QGraphicsView's viewport has already grabbed the wheel, any forwarded event would end up back in QGraphicsView, resulting in infinite recursion (if the assert doesn't fail first in debug builds). The correct fix requires that QGraphicsProxyWidget knows that this is a high-precision wheel event, allowing it to adjust the wheel grabber temporarily to the embedded widget. However, QGraphicsSceneWheelEvent doesn't provide this information. To fix the infinite recursion, mark the generated event as synthesized by Qt (but still send it spontaneously to enable propagarion within the proxy widget hierarchy). In QApplication's notification routine, interpret such events then to override the wheel grabber. Add a test case for the various scenarios. This 6.1 compatible fix does not pass all situations. A follow up commit that introduces the missing APIs to QGraphicsSceneWheelEvent then fixes those as well. Task-number: QTBUG-95552 Pick-to: 6.1 6.2 Change-Id: I78400ceae8da7a4e22a988c06ed58f99f1a979f4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Accept the QWheelEvent before each propagation stepVolker Hilsheimer2021-08-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | Input events in Qt are accepted when constructed, and ignored by the default event handler (so overriding the event handler is enough to accept an event). Since we use the same QWheelEvent instance for each propagation step, we need to reset the event to be accepted before each delivery so that an earlier child ignoring the event doesn't result in the event being ignored without explicit acceptance. Amends the refactoring of wheel event delivery in 92df790f46b3a8b17aec2f385d6472fd3f8647f6. Task-number: QTBUG-95552 Task-number: QTBUG-79102 Task-number: QTBUG-67032 Pick-to: 6.1 6.2 Change-Id: Ib3f99792518364cf6e635cf4c6fda088051a7848 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QUrl: Make Punycode encoding code less surprisingIevgenii Meshcheriakov2021-08-161-7/+7
| | | | | | | | | | | | | | | Move the code that modifies the encoding loop variables from appendEncode() back to qt_punycodeEncoder() instead of passing the variables by reference. This gives better overview of how those variables change. Remove comment claiming overflow detection inside appendEncode() where no overflow detection is done. Task-number: QTBUG-95689 Pick-to: 6.2 Change-Id: I8830e75370646f0c9b78cae883f778a12e32919d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix Style java code format and warningsAssam Boudjelthia2021-08-153-533/+346
| | | | | | | | | | | The code had many bad formating and syntax or API usage warnings, as well as some unused methods or classes which are fixed with this patch. Pick-to: 6.2 5.15 6.1 Task-number: QTBUG-71590 Change-Id: Ib113a0dc05703afb5190ec880b27daf75274cb1e Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Remove unused internal flag in QImageEirik Aavitsland2021-08-132-9/+3
| | | | | | | | | | The "locked" flag was only added for a particular use in the Freetype font engine in 070d9c00c488a5ee6811f04170cf488ead79bf80,but that usage was refactored away long ago in afb326f07109da0035112e6f56e683e37b8a5d72. Pick-to: 6.2 Change-Id: I7347c91f49ba59041f6ff35bd5a6b537d6c704d4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Properly scale gesture positions in hi-DPI casePovilas Kanapickas2021-08-121-3/+15
| | | | | | | | The local/global positions for gestures should be handled the same as for other events as they mean effectively the same thing. Change-Id: Ic5ad995607ecd3daf385a7c7be3b67cbae312e7b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* CMake: Fix testlib compile definitions not to be overriddenAlexandru Croitor2021-08-121-1/+1
| | | | | | | | | Amends 70464b355ec1c7007e0b1291f733e2540ba1825f Pick-to: 6.2 Change-Id: I92424d830afc0aaad9001817be82a06adabd014b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* CMake: Fix plugin target names to end in Plugin suffixAlexandru Croitor2021-08-121-2/+3
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95731 Change-Id: I56a34dd26656613c95fbc8f081d39561cb691852 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* StyleSheet: Use rule for ComboBox in embedded QLineEditVolker Hilsheimer2021-08-121-6/+5
| | | | | | | | | | | | | | | | | An editable combobox uses an embedded QLineEdit as an implementation detail. That lineedit should use the rules that are set for the combobox to render itself, similar to what was already implemented for the lineedit used in a QAbstractSpinBox. The containerWidget helper function provides the logic for identifying the container of the rendered widget, returning the QAbstractSpinBox or the QComboBox for an embedded QLineEdit. Use that method rather than duplicating the logic. Pick-to: 6.2 6.1 5.15 Fixes: QTBUG-95631 Change-Id: I50bc92a62715608b11c2c923f8f9215f56bfd15e Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Close all popup windows when the screen is rotatedTang Haixiang2021-08-122-0/+18
| | | | | | | | | | | | | Changing the screen orientation will cause the menu position to be displayed incorrectly. When the screen is rotated, the geometry of the application changes. We can refer to the handling of the menu on Android or IOS. Close the popup window when the screen orientation changes. Fixes: QTBUG-95607 Pick-to: 6.2 Change-Id: I55e1cd6a8b89e375c6714a9163dfb1902d52f101 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* CMake: Warn if qt_internal_plugin(target) does not end with 'Plugin'Kai Köhne2021-08-121-2/+7
| | | | | | | | | | | | | | The logic for linking plugins in a static build in Qt6*Plugins.cmake looks up plugins that are named Qt6*PluginConfig.cmake, and the file name is computed by the target name. Not naming the target 'Plugin' therefore means it won't be picked up in static builds. Pick-to: 6.2 Task-number: QTBUG-95731 Change-Id: Ic83a29d7c91492c302eb413a69577a0c550e1a1b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix hidden API access for Android styleAssam Boudjelthia2021-08-122-833/+787
| | | | | | | | | | | | | | | | | | | | Use public API and attributes to retrieve part of the Android style values instead of using reflection to access hidden or private fields. This latter method, was throwing lots of warnings or exceptions at the start of apps making it big annoyance to deal with. This patch doesn't handle drawables though, so the "full" and "default" Android style will be somehow broken still for now. For that reason, the default style extraction method is set to minimal to avoid getting warnings about it, and Fusion style could be used for Widgets apps, and for QML apps, it's recommended to use the Material style from Quick Controls 2. Pick-to: 6.2 5.15 6.1 Task-number: QTBUG-71590 Change-Id: If87895dc66751e23c9f4ea840e9f3e611aaa8833 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* qlocale_win: return null QVariant on failed look-upsEdward Welbourne2021-08-111-4/+4
| | | | | | | | | | | Various functions were still returning a null QString wrapped as a QVariant; the caller distinguishes these cases, so should get a null QVariant so it knows the backend failed to answer the query and can attempt whatever fall-back it may have at its disposal. Pick-to: 6.2 Change-Id: I0983b9f3b1026f17c3f13ab92b713bee90be466c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>