summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* OpenSSL: handle renegotiate errors by comparing certsMårten Nordheim2021-12-022-2/+52
| | | | | | | | | | | | If the certificate didn't change then our trust in it didn't either. Sadly, cannot have an autotest because we don't have any way to facilitate a renegotiation at the moment and with TLS 1.3 not having them at all it's unlikely we ever will. Pick-to: 6.2 5.15 Task-number: QTBUG-92231 Change-Id: Ibaa9b2f627daca05021c574e69526710aacdadae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use Android's View.generateViewId() for generating ids for views/surfacesMichał Cieślak2021-12-021-3/+7
| | | | | | | | | | | Qt Android was using consecutive numbers starting from 1 as ids for View.setId(int). The ids are used internally with an assumption that they are unique. It was potentially leading to collisions and unexpected behavior when adding custom views with id generated by View.generateViewId(). Task-number: QTBUG-98649 Pick-to: 5.15 6.2 Change-Id: I5bf2fe1d196c7adafeec544d8d945ebd82ba5cb6 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Close leak of QOCIDateTime objectEdward Welbourne2021-12-021-0/+1
| | | | | | | | | | | Noticed while reviewing usage of this type. The code has a whole TempStorage class to take care of keeping allocated memory live until we're done with it, explicitly including date-time objects as a special case, but neglected to use it in one place. Pick-to: 6.2 5.15 Change-Id: Ic94c56d67dda6dc3ee36a025a2e0149f6b2a1837 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Reduce scope of a hack using volatile in favor of viewAt()Edward Welbourne2021-12-021-11/+7
| | | | | | | | | | | We can now get qt_configure_strs to tell us the size of the string, as well as its start, bypassing the strlen()-calling branch of fromLocal8Bit() that caused the need for a hack using a volatile variable. However, QT_CONFIGURE_SETTINGS_PATH still needs the volatile hack. Change-Id: I0181abf512123e6355acdd506d6845c3fb75c0e3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Restrict clang warning disabler to affected versionsEdward Welbourne2021-12-021-0/+2
| | | | | | | | | | | Apparently -Wdeprecated-copy got added between clang 9 and 11. Versions without it warn about the attempt to suppress this option's warnings. This follows-up on commit 8662fbdd7e0c8c5b089a3c9871ae0cd71790858e Change-Id: I7fe9258cfe8a79d24c1f8b331a56468415b25cdb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qnx: Fix typos in source code commentsJonas Kvinge2021-12-023-3/+3
| | | | | Change-Id: I6420e14e3de9c7efc7d5073f44ccfd7ee9b88ea6 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* android: Fix typo in source code commentJonas Kvinge2021-12-021-1/+1
| | | | | Change-Id: Ieeab35d51588cf247c3d9626d0291e2983720873 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QString et al: fix lastIndexOf() API asymmetryMarc Mutz2021-12-024-4/+25
| | | | | | | | | | | | | | | | | Commit 6cee204d56205e250b0675c9c6d4dd8a2367f3c4 introduced overloads of lastIndexOf() which drop the 'from' argument, inadvertently fixing QTBUG-80694, but failed to provide the new overloads for all existing lastIndexOf() overloads, making the fix for QTBUG-80694 incomplete. This patch completes the fix, by adding the missing overloads (for char-likes) and also adds the missing (non-regex) tests to tst_qstringapisymmetry. Also amends 1c164ec7f21a78025475c561a70b94d1e3dd6bb6. Fixes: QTBUG-80694 Change-Id: Ib4b3d597d658ce2edf01a2bce0d711ecea593d6e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Support to get timing from pagefilpElvis Lee2021-12-033-3/+14
| | | | | | | | | Handle the timing from drmEvent when page flip finished. The information can be used to optimize rendering timing. Change-Id: I14612ca48a8fea5208aa74949d7543787e860c5f Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix dependency chain that collects the metatype json filesAlexey Edelev2021-12-022-37/+57
| | | | | | | | | | | | | | | | | | | | | cmake_automoc_parser has the logic preventing the run of moc with the --collect-json parameter if metatype json files are not changed. This logic only verify if the file list is changed but not their content. This change adds a timestamp file that contains the last metatype json file timestamp that was modified during the last cmake_automoc_parser run. The logic still prevents of running 'moc --collect-json' when the list of metatype json files is not changed, but also checks if their content is no changed. Another approach it to generate the depfile that can be utilized by CMake in add_custom_command as DEPFILE argument. But this concept only works from the second build attempt because of an issue related to dyndep. Pick-to: 6.2 Fixes: QTBUG-98532 Change-Id: I713f8bfa9ae769cefe0beac0b7fa19750b00a765 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Replace BUILD_OPTIONS_LIST variable by the getter functionAlexey Edelev2021-12-021-54/+70
| | | | | | | | | Encapsulate configuration options in a function and use it instead of a globally defined variable. Pick-to: 6.2 Change-Id: I5c69c207788fe069fdd046b68a6bc58aa16e71b4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QTableView: correctly toggle column selection when scrolledVolker Hilsheimer2021-12-021-1/+1
| | | | | | | | | | | | | | | | We need to check whether the horizontal header's selection includes the index for the row at the top, rather than for row 0, as the index we check is based on the scrolled position of the header, so would never be included in the top row when the view is scrolled. This is correctly done in selectRow already. Add a test case that simulates selection of rows and columns by clicking on the header. Fixes: QTBUG-98444 Pick-to: 6.2 Change-Id: I2fa1b32bf75dc96225b40145b713bf7e2ffc29dd Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Don't let text table cells shrink below their minimum widthVolker Hilsheimer2021-12-021-0/+1
| | | | | | | | | | | | | | We calculate the minimum width, but then use it only to make sure that the maximum width is at least as large as it. Without setting the layout struct's minimumWidth as well, table cells can be smaller. Add a test case. Fixes: QTBUG-86671 Fixes: QTBUG-97463 Pick-to: 6.2 5.15 Change-Id: Idf4ad015938abb8d3e599e9a58e002f29c0067be Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Use depfile to control ABI-specific builds of executable targetsAlexey Edelev2021-12-022-18/+57
| | | | | | | | | | | | | qt_internal_${target}_copy_apk_dependencies should use CMake DEPFILE approach when it's possible. Since we don't have any specific artifact that androiddeployqt can produce when collecting dependencies this change adds simple timestamp file that is touched each time when androiddeployqt is running. The timestamp is used then as a file-level dependency for the qt_internal_${target}_copy_apk_dependencies target. Task-number: QTBUG-88841 Change-Id: I985535c7b6e471cb4cfbf90128628087dadc72d0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Change the external projects approach for multi-abi buildsAlexey Edelev2021-12-023-35/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of generating external projects that build the project tree for each target, this creates a single project for each ABI that have the common for all targets configure steps. Each executable target then adds additional build step to each ABI-specific external project, that builds and copies dependencies to the "main" project build tree. To resolve dependencies from the build tree, when building multi-abi apk instead of scanning the build directories of external projects for dependencies, it makes sense to run androiddeployqt for each ABI-specific external project to copy all necessary libraries. This is done by adding --copy-dependencies-only flag to androiddeployqt that only copies the apk dependencies, but avoids creating apk and all the essential steps. The ABI-specific external project now handles the deploying of the build artifacts to the end-point apk deployment directory and the "main" project assembles the apk using collected artifacts. The ABI-specific external project uses the qt_internal_${target}_copy_apk_dependencies target to run androiddeployqt with the introduced --copy-dependencies-only flag. TODO: Build steps that build and copy the ABI-specific apk dependencies are non-skipable and will run each time top-level build is triggered. This behavior should be fixed by adding dependencies to the generated by androiddeployqt DEPFILES for each ABI in the top-level build. Task-number: QTBUG-88841 Tash-number: QTBUG-94714 Change-Id: Id442a9fbd589f58b70f4204c5215645056b379a2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Freetype: adjust underlinePosition to match our expectationsMårten Nordheim2021-12-021-1/+2
| | | | | | | | | | | | | | | | | We expect underlinePosition() to be the topleft corner of where we start drawing the underline but freetype reports the _center_ of the underline: "underline_position: [...]. It is the center of the underlining stem." - https://freetype.org/freetype2/docs/reference/ft2-base_interface.html Pick-to: 6.2 5.15 Fixes: QTBUG-62602 Change-Id: I96808816f50f3f37b18f579adf285502c88e6ea5 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Document the example showing the benefits of using bindable propertiesSona Kurazyan2021-12-021-0/+14
| | | | | | | | | | | And mention the example in the bindable properties docs. Pick-to: 6.2 Task-number: QTBUG-97655 Change-Id: I676e90dbda66c2e718c7f6c2240fac608a8653df Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix overlapping text for Osaka font on macOSEskil Abrahamsen Blomfeldt2021-12-021-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | The Osaka font on macOS has all zeroes in the OS/2 table, probably because it is not intended to be cross-platform. In Qt 6 (since f761ad3cd9ad1252f24b76ae413298dc7bed8af3) we are trying using the same vertical metrics on all platforms, but this only works if they are valid. To work around this issue, we detect the case when ascent/descent values are both 0, since this is very unlikely to be intentional, so we fall back to the system-provided ascent and descent in these cases. Adding the test also revealed that we had missed the check for a macOS-specific bitmap font format when skipping the check for bitmap fonts in 7a18b7e2c2394b2b2cc95833c755f91193d9ba2e. [ChangeLog][macOS][Text] Fixed a problem where using the Osaka font would lead to overlapping text. Pick-to: 6.2 Fixes: QTBUG-96880 Change-Id: Ifea7918641a68829e8f5ef20a4fb61c0a7e5b757 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix fail to activate first sub window with QMdiArea::TabbedViewZhang Yu2021-12-021-0/+4
| | | | | | | | | | | | | | | | | | | The first sub window added will activate itself automatically, and isActive is set to true. Therefore the call to setActiveSubWindow to activate the first sub window will be ignored. When showing the mdiarea, all sub windows will be activated in the order in which they were added, so the active window will always be the last sub window added. Fix this by setting isActive to false so that setActiveSubWindow activates the first sub window when the mdiarea becomes active. Fixes: QTBUG-92037 Pick-to: 6.2 Change-Id: Id4a793e2059803c1a4ada916fdae2d3cc02cdf06 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QVarLengthArray: make static if's constexprMarc Mutz2021-12-021-5/+5
| | | | | | | | | | | Cleaner. Probably also more efficient at compile time, who knows? Also more consistent, since _some_ static if's were already constexpr'ed. Change-Id: I9657f7cf2166975f562db52e9f90630aaf412986 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix missing characters or assert with certain font sizesEskil Abrahamsen Blomfeldt2021-12-011-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | The alphaMapBoundingBox() only exists to prefetch the size of rendered alpha maps, to reserve space in the glyph cache. Since 104e6d0f5427f5ebaab106b1651eb76c4c56df98 we have not used the QPainterPath fallback code path when actually rendering the glyphs, but that patch neglected to update the code that retrieved the bounding box. This could in some cases cause a mismatch, and if the alpha map we ended up with in the end was larger than the reserved space, this could trigger an assert or an empty spot in the cache. [ChangeLog][Text][Freetype] Fixed an issue where characters would in some rare cases be missing from text, depending on font metrics, font size and system scale factor. Pick-to: 5.15 6.2 Fixes: QTBUG-86633 Change-Id: Ic8ade168115e4f51bac71539325936bbae993120 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Don't shrink a column when it spans multiple columnsVolker Hilsheimer2021-12-011-0/+2
| | | | | | | | | | | | | | | | | | If a cell spans multiple columns, then the merged cells' starting column's maximum width should never become smaller than what was calculated from previous rows. Otherwise, we'd distribute the space of the column that has a span across all merged columns, resulting in unnecessary line breaks esp if WrapAnywhere is enabled. Add a test case. Fixes: QTBUG-91691 Fixes: QTBUG-95240 Pick-to: 6.2 5.15 Change-Id: Ic27dbdb128071e50fba049de85c9f23ba2f059b3 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QVarLengthArray: More Self-Encapsulate FieldMarc Mutz2021-12-011-3/+5
| | | | | | | | | | | Two more instances where we can use public API instead of accessing the data members directly. Amends 9d79e5f26ca58e7ddbb6367de044d05192107a4d. Task-number: QTBUG-84785 Change-Id: I2037339383836b0d292b3362fe1d6b056638e81a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QTabBar: clamp maxScrollOffset before using it in qBoundGiuseppe D'Angelo2021-12-011-3/+3
| | | | | | | | | | | | QTabBar's test reveals that maxScrollOffset can be negative, so using it in a call like qBound(0, x, maxScrollOffset) is wrong. Clamp it to 0. Change-Id: Idd635343bf14c904dbcc4d141f10bd0161d2cfb4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Don't overwrite flipped textureTransform with unflipped on next blitTor Arne Vestbø2021-12-011-4/+5
| | | | | | | | | | | | | | | The logic introduced in 60d9509cb00526e8530926b19b2366e584fdf30a didn't account for the fact that repeated blits with OriginTopLeft would only hit the code path that modified the source transform to flip it if the uniform state wasn't already IdentityFlipped. As a result, we would end up setting the unflipped texture transform on the next blit, even though the origin was still OriginTopLeft. Fixes: QTBUG-98803 Change-Id: Ib19e80e026acaa43981077b98ff942a7fa060378 Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use config from the main ABI when building ABI-specific external projectAlexey Edelev2021-12-011-0/+9
| | | | | | | | | | ABI-specific external projects should use the same config as the one is used by the "main" ABI. Task-number: QTBUG-88841 Change-Id: If7a1834d9a3f238f6dadd05323ccc0cf8552128c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* wasm: Fix assert/crash when tooltip window is closed and mouse movedLorn Potter2021-12-011-3/+3
| | | | | | | | Fixes: QTBUG-92521 Pick-to: 5.15 6.2 Change-Id: I627fdcf3064321a3c1cb1140473038571ec78b9e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Fix QFuture continuations/handlers to work with move-only callablesSona Kurazyan2021-12-011-8/+43
| | | | | | | | | | | | | | | | std::function, which is used to store the type-erased continuation lambdas, requires the passed callable to be copy-constructible. This makes impossible to use move-only callables with continuations/handlers. In particular, it makes impossible passing lambdas that are capturing move-only objects. The workaround is to store the continuation lambda inside a wrapper for the callable, which stores the move-only lambda in a QSharedPtr and can be stored in std::function, since it's copyable. Pick-to: 6.2 Fixes: QTBUG-98493 Change-Id: I8b7a22fcf68dc132b3c533216a7a1665e9f9fb0a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QVarLengthArray: simplify default ctorMarc Mutz2021-12-011-1/+4
| | | | | | | | | | | | Instead of calling the QVLA(qsizetype) ctor and letting the optimizer and inliner have a field day on them, simply set the trivial values for a, s, and ptr manually. Mark it as noexcept. Task-number: QTBUG-84785 Change-Id: I011826eacdaf63a4c37b21465e5fe4a6e70a1ab7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Openssl backend: reinsert a missing C in qCDebugMårten Nordheim2021-12-011-1/+1
| | | | | | Pick-to: 6.2 5.15 Change-Id: I2b13d2f88517abea7e015bfba4fe71dcbada86c0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix the path to the build dir when creating an androiddeployqt depfileAlexey Edelev2021-11-301-1/+14
| | | | | | | | | | According to the CMake documentation any relative paths in DEPFILE should be relative to the CMAKE_CURRENT_BINARY_DIR if the CMP0116 is set to NEW. This also forces CMP0116 to NEW if the policy exists. Pick-to: 6.2 Change-Id: I3d697b008ea06effb2247bc204da9bcc4e9046b4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add _make_aab targetAlexey Edelev2021-11-302-8/+34
| | | | | | | | | | | | | | | | Add target triggering AAB creation. Since the _make_aab target is not added to the ALL set, we may avoid dependency check for it and admit that the target is "always out of date". [ChangeLog][Android][Platform Specific Changes] Add the extra _make_aab targets for each executable target, that can be used to generate android app bundles. Also add aab metatarget to build all _make_aab targets that are created in the project. Pick-to: 6.2 Fixes: QTBUG-96710 Change-Id: I3b0c7fbb5a7dd493ca7a124c4e4b91fd857386bd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QString::arg: deprecate use of arbitrary Unicode digits as replacementsGiuseppe D'Angelo2021-11-301-4/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only documented replacements for Q*String*::arg() are sequences like %1, %2, %3 -- where the n-th number is expressed using a sequence of ASCII digits [1]. The code parsing the replacements however used the QChar::digitValue() function. That function simply checks if a QChar has a *Unicode digit value* (no matter what its block/category is), and if so, returns the corresponding digit value as an int (otherwise returns -1). The result of this is that a sequence like "%¹" or "%१" actually triggered substitutions (both count as "1"). Similarly, QChars with a digit value would be parsed as part of longer sequences like "%1²" (counting as "12" (!)). This behavior is weird, undocumented, and extremely likely the usual backstabbing by Unicode by using "convenience" QChar methods -- that is, never *intended* by the implementation. This commit deprecates (via warnings) such usages, which for the time being are left working as before (in the name of backwards compatibility). At the same time: given it's extremely unlikely that someone would be deliberately relying on this behavior, it implements the desired change of behavior (only accept sequences of ASCII digits) starting from Qt 6.6, that is, after the next LTS. Throughout Qt 6's lifetime users will still be able to control arg()'s behavior by setting an env variable, but that variable (and the support for Unicode digits) will disappear in Qt 7. To summarize: * Qt 6.3->6.5: default is Unicode digits, env var to control * Qt 6.6->6.x: default is ASCII digits, env var to control * Qt 7: only ASCII digits, no env var [1] That's the name Unicode gives to them, cf. https://www.unicode.org/charts/PDF/U0000.pdf [ChangeLog][QtCore][Deprecation Notices] The arg() functions featured in Qt string classes have always been documented to require replacements tokens to be sequences of ASCII digits (like %1, %2, %34, and so on). A coding oversight made it accept sequences of arbitrary characters with a Unicode digit value instead. For instance, "%2੩" is interpreted as the 23rd substitution; and "%1²" is interpreted as the 12th substitution. This behavior is deprecated, and will result in runtime warnings. Starting from Qt 6.6, arg()'s behavior will be changed to accept only ASCII digits by default. That means that "%1²" is going to be interpreted as substitution number 1 followed by the "²" character (which does not get substituted, so it gets left as-is in the result). Users can restore the previous semantics (accept Unicode digits) by setting the QT_USE_UNICODE_DIGIT_VALUES_IN_STRING_ARG environment variable to a non-zero value. In Qt 7, arg() will only support sequences of ASCII digits. Note that from Qt 6.3 users can also set QT_USE_UNICODE_DIGIT_VALUES_IN_STRING_ARG to zero; this will make arg() use ASCII digits only, in preparation for the future change of defaults. Change-Id: I8a044b629bcca6996e76018c9faf7c6748ae04e8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Don't allocate an OCIDateTime object unless we're going to use itEdward Welbourne2021-11-301-7/+22
| | | | | | | | | | | | | | | | | | | The QOCIDateTime destructor carefully checks that dateTime is non-null before tidying it away, but the constructor allocated it independently of whether it was used, leaving it in a still-not-constructed state if the date-time it was to represent was invalid. Only allocate if the date-time is valid; and check against null when an OCIDateTime is being converted back to QDateTime. Add warnings if either allocation or construction fails. Incidentally use static_cast<> instead of C-casting (and split a long line) in the other place that allocates an OCIDateTime descriptor. Pick-to: 6.2 5.15 Task-number: QTBUG-98471 Change-Id: Idd5531d9f7101878802cb9a3a016d3fd80903543 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Use config-specific suffix of android deployment settings for multi-config onlyAlexey Edelev2021-11-301-1/+10
| | | | | | | | | | | | QtCreator doesn't expect any config-specific suffixes in the android deployment settings file, when running androiddeployqt. This avoids adding the config-specific suffix in the single-config builds and for the first config in the multi-config builds. Amends a41d9bcac90af5d8f528d6198ea91f25e5189082 Change-Id: I606509c9bfd2e75cac144aca37b4568639aae74f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QNX: check and use elf.h from alternative locationJanne Juntunen2021-11-304-7/+15
| | | | | | | | | | | In QNX, instead of #include <elf.h>, we have to use #include <sys/elf.h> since that file is placed in a subdirectory. Also removed the previous workaround. Fixes: QTBUG-97833 Change-Id: Id932a5eeb618a42c8778459cdfd8bb5bf903523c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Verify returns from QXmlTestLogger's xmlQuote() and xmlCdata()Edward Welbourne2021-11-304-95/+113
| | | | | | | | | | | | | | | | | | Using partially-converted text would lead to invalid XML, so don't use the buffer contents if the return is zero. As a result, QTestJUnitStreamer::formatEnd() needs to return some indication of whether *it* succeeded, so change it to forward their int returns; and, as it's in fact only used internally by the streamer, make it private. Make these functions [[nodiscard]] so that further uses of them will be discouraged from ignoring the possibility of failure. Make the public versions return bool so that they can correctly succeed on empty input. Assert various conditions we can infer to save work we don't need to do. Change-Id: I899bad23d1dfbd05fc725de269def4ce213dbc5a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QVarLengthArray: simplify copy ctor implementationMarc Mutz2021-11-301-2/+2
| | | | | | | | | | | | std::tie(a, s, ptr) = {Prealloc, 0, (T*)array} is exactly the effects of the default ctor, so just delegate to it, before calling copyAppend(). Also clean up the copy ctor declaration (superfluous inline keyword, and template arguments). Change-Id: Iefc758a47996382fee10b1e081e44f008b146287 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QList::count(T): remove the &* hack on iteratorsThiago Macieira2021-11-301-1/+1
| | | | | | | | | | | | Use data() and data() + size() instead. This solves an UB when the list is in its default-constructed state, for which constData() == nullptr. Pick-to: 6.2 Fixes: QTBUG-98770 Change-Id: I2cffe62afda945079b63fffd16bc165978c769f6 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Teach QOpenGLTextureBlitter about GL_TEXTURE_RECTANGLE texturesTor Arne Vestbø2021-11-302-16/+110
| | | | | Change-Id: Ie577bda046f60ce23dfb8cdd6164bb3de4b54358 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* wasm: add Blob and File typeLorn Potter2021-11-302-0/+12
| | | | | | | Convenience getters for mime type associated with the object. Change-Id: I7e3530459e50ac4740d533db59c46e838c94dbcd Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QRegularExpression: don't detach() a pattern QStringLiteralMarc Mutz2021-11-301-1/+1
| | | | | | | | | | | | | | | | | ... just to pass it to pcre2_compile_16(). The QString::utf16() function guarantees a NUL-terminated result, so it detach()es from QStringLiteral (Qt 6) and/or QString::fromRawData() (Qt 5 + 6). This user doesn't require the NUL-termination, though, since pcre2_compile_16() takes an explicit length, so the detach() is completely unneccesary, yet common, since regex pattern strings are often QStringLiteral()s. Task-number: QTBUG-98763 Change-Id: I1d08ae1a1ec4281ff44a68c5ba5c56584b71d24e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QNAM: Disable h2c by defaultMårten Nordheim2021-11-303-0/+19
| | | | | | | | | | | | | | | | | | And since it's relatively unlikely to be used, just leave it behind a environment variable for now. [ChangeLog][QtNetwork][Potentially Source-Incompatible] Support for clear-text http/2 was disabled due to incompatibility with certain servers. If you were relying on this feature you must re-enable it by setting the QT_NETWORK_ALLOW_H2C environment variable. For a later version of Qt it will get a dedicated attribute. Pick-to: 6.2 Task-number: QTBUG-98642 Change-Id: Id3e360726e285b3128e3e3f4bce9440404c9ad6e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QT_SPECIALIZE_STD_HASH_TO_CALL_QHASH: use unqualified qHash() lookupMarc Mutz2021-11-291-4/+7
| | | | | | | | | | | ... instead of QT_PREPEND_NAMESPACE(qHash), which is qualified (prepends at least '::'), and therefore disables ADL. This is not a problem as long as we wrote our qHash() overloads as free functions (incl. non-hidden friends), but it should™ fail for hidden friends, so use the old using-std::swap() trick to bring QT_PREPEND_NAMESPACE(qHash) into scope, proceeding with an unqualified lookup. Pick-to: 6.2 Change-Id: I00860b2313699849f86bfe3dd9f41db4ce993cd3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix gaps between lines of selectionEskil Abrahamsen Blomfeldt2021-11-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | When a font has fractional metrics, we could get visible gaps between lines in a multi-line selection, if the bottom of the rect was not aligned to the pixel grid. In Qt 5, this was primarily an issue on macOS, but since making vertical metrics consistent in f761ad3cd9ad1252f24b76ae413298dc7bed8af3, we could also get this on other platforms, causing a regression on these platforms. The fix is to align the rect to the pixel grid. [ChangeLog][Text] Fixed an issue where there would sometimes be visible gaps in selections spanning multiple lines. Pick-to: 6.2 Fixes: QTBUG-98372 Change-Id: I03cb1465602b6d78c60a0c764d920f7f092418a8 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Never handle scrollbars styled with box or border changes as transientVolker Hilsheimer2021-11-291-0/+10
| | | | | | | | | | | | | | | | If scrollbars are styled with a style sheet that includes a box or removes off the native border, then we never treat them as transient or overlapping. Otherwise, the layout logic in QAbstractScrollArea will show them on top of the viewport, overlapping the content. Add case to the style sheet test baseline test. It's a test for scrollbars in a scroll area, rather than a test for the styling of the scrollbars themselves. Fixes: QTBUG-98289 Pick-to: 6.2 Change-Id: Ic53ad248b3eedd54722ac7b2fe5256a27092dbc1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QTextDocument: fix an off-by-one in the changed signal for listsEirik Aavitsland2021-11-291-1/+4
| | | | | | | | | | | | | | | | | When blocks are added or removed in block groups, i.e. items added or removed from text lists, the whole group is marked as changed, but the calculation of the before/after group length would be one off. That was reflected in the contentsChange signal. Add unit test. Since the whole group changes when list items are added, text is removed and the change-begin is not where the cursor was when the change was made. Fixes: QTBUG-82455 Pick-to: 6.2 5.15 Change-Id: I99ee2cfef4944fcac8aca492741fd0f3b0de4920 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* gui: add QInputDevice::seatNames()Liang Qi2021-11-282-0/+20
| | | | | Change-Id: Ie6cedd62dcd684a8fd9adbc2409e5aa1f3490ede Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QObject: Q_ASSERT the object type before calling a PMFThiago Macieira2021-11-274-7/+39
| | | | | | | | | | | | | | | | | | | | | | | | The old-syle signal-slot syntax had the advantage of not delivering signals to slots in derived classes after that derived class's destructor had finished running (because we called via the virtual qt_metacall). The new syntax made no checks, so a conversion from the old to the new syntax may introduce crashes or other data corruptions at runtime if the destructor had completed. This commit introduces a Q_ASSERT to print the class name that the object is not any more. Since this is in inline code, this should get enabled for users' debug modes and does not therefore depend on Qt being built in debug mode. It required some Private classes to be adapted to the new form, by exposing the public q_func() in the public: part. Pick-to: 6.2 Fixes: QTBUG-33908 Change-Id: Iccb47e5527544b6fbd75fffd16b874cdc08c1f3e Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QLocale: suppress annoying GCC warning in the bootstrap libThiago Macieira2021-11-271-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Happens on line: return QList<QLocale>() << QLocale(QLocale::C); QLocale's constructor taking the C "language" calls findLocalePrivate() that returns indeed the non-heap object c_locale in the c_private() function. But it also sets the refcount to 1, meaning it can never drop to 0 under proper refcounting and will thus never be deleted. Therefore, the compiler is wrong. I don't have time to figure out how to teach it that the deletion can never happen. I just want the warning to go away. It wsa probably introduced by commit d4242b8af3e6eb5e9f68e5ff2efee97de11da892. In destructor ‘QSharedDataPointer<T>::~QSharedDataPointer() [with T = QLocalePrivate]’, inlined from ‘QLocale::~QLocale()’ at /home/tjmaciei/src/qt/qt6/qtbase/src/corelib/text/qlocale.cpp:1035:1, inlined from ‘void QtPrivate::QMovableArrayOps<T>::emplace(qsizetype, Args&& ...) [with Args = {QLocale}; T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qarraydataops.h:829:5, inlined from ‘T& QList<T>::emplaceBack(Args&& ...) [with Args = {QLocale}; T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qlist.h:891:15, inlined from ‘void QList<T>::append(QList<T>::rvalue_ref) [with T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qlist.h:479:24, inlined from ‘QList<T>& QList<T>::operator<<(QList<T>::rvalue_ref) [with T = QLocale]’ at /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qlist.h:726:13, inlined from ‘static QList<QLocale> QLocale::matchingLocales(QLocale::Language, QLocale::Script, QLocale::Territory)’ at /home/tjmaciei/src/qt/qt6/qtbase/src/corelib/text/qlocale.cpp:2684:54: /home/tjmaciei/obj/qt/qt6/qtbase/include/QtCore/../../../../../../src/qt/qt6/qtbase/src/corelib/tools/qshareddata.h:91:55: warning: ‘void operator delete(void*, std::size_t)’ called on unallocated object ‘c_locale’ [-Wfree-nonheap-object] 91 | ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; } | ^~~~~~~~ Pick-to: 6.2 Change-Id: Iccb47e5527544b6fbd75fffd16b8d078987b812b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>