summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* macOS: Try to get SIP configuration via private syscall if possibleTor Arne Vestbø2022-05-201-4/+15
| | | | | | | | | | The SIP configuration is not available through the NVRAM in all cases, so we try to get it via the private syscall first, if we can, and then skip the warning if we don't find it in NVRAM. Pick-to: 6.2 6.3 Change-Id: I0866d06c329a3ac70bb1f23732d10aab13a4f9c1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix crash in tst_qquicktext::implicitSizeEskil Abrahamsen Blomfeldt2022-05-207-91/+8
| | | | | | | | | | | | | This reverts commit 1e938c348b936328fafbcaae4c0c7d91003143e5 and bb2f4d08d9d138e4f70d6d6db46e24e34500becc. bb2f4d08d9d causes the crash, but 1e938c348b93 amends it, so this reverts both. When the cause of the crash has been determined and mitigated, the patches can be recreated. Fixes: QTBUG-103719 Change-Id: Ifc36b3771a96f6c85387a5306a0402d4c508d006 Reviewed-by: David Faure <david.faure@kdab.com>
* Move remaining time_t code from qdatetime.cpp to QLocalTimeEdward Welbourne2022-05-204-338/+338
| | | | | | | | | | What remains is all tangled together, but is now at least decoupled from the rest of qdatetime.cpp, so moving it out makes that file easier to read. Task-number: QTBUG-95993 Change-Id: I3fba15aea59b3c8b4cbc6bf1cb03de96d68db0ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Split qtLocalTime out into a new QLocalTime namespaceEdward Welbourne2022-05-206-77/+161
| | | | | | | | | | | | | | | ... in new qlocaltime* files, now that it's decoupled enough from the internals of QDateTime for this to be possible. Part of the consolidation of time_t code in one place. Move assorted constants from qdatetime.cpp to a private namespace in qdatetimeprivate_p.h to be shared between q*time.cpp hereafter (fixing an out of date comment in the process - julianDayFromDate() is long gone). Task-number: QTBUG-95993 Change-Id: I03d97e959118041f9d86b8bb2e738599bc0b17e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace qt_mktime(), avoiding out-parameters and conversionsEdward Welbourne2022-05-201-115/+131
| | | | | | | | | | | | | | | | | | | Since qt_mktime() took QDate and QTime in/out parameters, its callers had to convert the milliseconds they had to that form and back again after. Since it combined optional look-up of zone abbreviation with determination of offset and DST-ness (both ignore when the abbreviation was asked for) it made sense to split it in two. Each takes the millis and whatever knowledge we have of DST. One returns tha abbreviation; the other returns a QDTP::ZoneState for the caller that'll be returning that. Outside the system zone, when we have to fall back to a kludge, their callers can now use the Julian Day number change for its fake date to directly adjust the millis there and back (effectively inlining former conversions to-and-from date and time representation, but optimising out some of the work). Change-Id: I7aa4583171f77fc0f4aa80c8f564e76995ca69d2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Eliminate the msecsToTime() overload with out-parametersEdward Welbourne2022-05-201-26/+12
| | | | | | | | | | Now that I've disposed of the callers that were or might be passing null pointers for the out-parameters, getDateTime() can inline its computation and the two other callers can use msecsTo{Date,Time} until I eliminate the need for that. Change-Id: Ia9169779cf03189fc7fd5271044d1ec90089fa03 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Refactor QDateTimePrivate::*MSecsToEpochMSecs()Edward Welbourne2022-05-202-154/+148
| | | | | | | | | | | | | | | | | | | | Aside from one client that wanted the zone abbreviation for a given local time (and could supply a DST-ness hint), the callers actually want to know the offset from UTC, DST-ness and any correction needed to the local time to dig it out of a spring-forward. Mediating all of that via a QDate, a QTime and a returned UTC seconds since the epoch was not making our lives any easier. Split the local-time function into one to get the abbreviation and another to determine the data we actually need. The zone version only needs the latter. Two functions with hairy signatures replete with in/out parameters are replaced with three, with no in/out parameters. Adapt all callers of the old functions to use the new, simplifying them in the process. Inline some conversions between date+time and msecs in the process. Change-Id: Ice60b615121a99111ed882734785fa3c777e191c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Refactor qt_localtime()Edward Welbourne2022-05-201-85/+87
| | | | | | | | | | | Break out the part that calls the appropriate platform variant, so that the logic of what we do with the result of that isn't tangled up with the #if-ery. Rework the remainder to return a struct type that packages the data we need, to get rid of the three out-parameter pointers. Change-Id: Ibba6f8de0954fab3fddf9e95adc18ef85e45ff72 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTime::setMSecsSinceEpoch(): push more work into a helper functionEdward Welbourne2022-05-202-67/+84
| | | | | | | | | | | | | | | | | | | Formerly, setMSecsSinceEpoch() passed a QDate and a QTime to epochMSecsToLocalTime() as in/out parameters, then obtained what it actually wants, a count of milliseconds, from their modified values and computed an offset from that. Pass the epoch milliseconds from which the QDate and QTime were derived in place of them and return the local milliseconds, offset and DST status back in a structure, rather than via pointer parameters. This prepares the way for pushing one step further, back into qt_localtime(), so that we can simply get the count of milliseconds, along with DST flag and offset from UTC, without going via QDate and QTime (except in the kludge that copes with times outside the time_t range; and even that can be short-cut somewhat). Change-Id: I37ebb1efb355e81e1a116d03cbd52f9bb4a1f114 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix wrong QDateTime::isValid() to use the right QFlags methodEdward Welbourne2022-05-201-1/+1
| | | | | | | | | | It's documented to return true "if both the date and the time are valid and they are valid in the current Qt::TimeSpec" but it was using testAnyFlag() so would have returned true if any one of the three conditions was met, rather than only if all three are met. Change-Id: I91746224009d820abaffb541d8f6d6b13142849b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify msecsToTime() and two callers by using QRoundingDownEdward Welbourne2022-05-201-24/+19
| | | | | | | | | | | | | The formerly cumbersome arithmetic, to adjust for division rounding towards zero rather than down, is so much simpler this way. Break out the conversion for only date and for only time, for the sake of (for now) two callers that only need one; and inline QRoundingDown::qMod() to save repeating the qDiv() call. Include the mapping from millis to raw Julian Day as a separate function, as I'll be using it shortly. Change-Id: I0ee74ea68421a347ed618fa34142bd034844351e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Ensure creation of a unique iOS bundle identifierAlexandru Croitor2022-05-201-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apple ties iOS application bundle identifiers to Apple accounts. When building against the device SDK, the bundle identifier must be unique, so that Xcode can register the id with the used developer account and create an appropriate provisioning profile for the used device. If it's not unique (was previously used on a machine with a different developer account), in the best case you get an error explaining that. In the worst case you get an error about automatic signing not being enabled (at least on the command line). When building an Xcode project for the first time on a fresh machine, the organization bundle identifier prefix might not be set. Opening a Qt example project on such a machine might result in generating the same bundle identifier, leading to the error described above. Warn project builders that they should either specify a prefix or an entire unique identifier. To ensure building still works in such a case, try to hash the team id if it is present and add it as an infix to the auto-generated bundle identifier. Note that simulator builds are not affected by id uniqueness because apps deployed to the simulator do not require a provisioning profile from Apple. Amends 4d838dae5a821e9e5f013ba1d5a494ece1b5180e [ChangeLog][iOS][CMake] The build system tries to create a unique bundle identifier based on the team id if no organization prefix can be retrieved from Xcode preferences. Pick-to: 6.2 6.3 Task-number: QTBUG-95838 Change-Id: I6ad10076751acf43064330a6e53d6c4e973ec362 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: Improve iOS bundle identifier handlingAlexandru Croitor2022-05-201-24/+66
| | | | | | | | | | | | | | | | | | | | | | | | Developers could use two different CMake properties / variables to specify the bundle identifier of an application. One would be written into the Info.plist file and the other into the Xcode project as a project property. The previous implementation forced developers to set both of them to the same value to have consistency in the project. This is not nice behavior. The new logic allows setting only one of the two, which will then be reused for the one left unspecified. This is more user friendly. Finally the bundle identifier prefix was never escaped, which could cause issues during code signing if it had invalid characters. Now we escape the prefix to ensure the whole identifier is valid. Amends 4d838dae5a821e9e5f013ba1d5a494ece1b5180e Pick-to: 6.2 6.3 Task-number: QTBUG-95838 Change-Id: I1448bd643893751c281cc0ea41c763d1bd03360e Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Use the PRODUCT_NAME for the iOS display name like qmakeAlexandru Croitor2022-05-202-0/+18
| | | | | | | | | | | | | | | | | | | This ensures that the Xcode 'Display name' input under ${target} -> General -> Identity -> Display name is not empty. Because adding ${PRODUCT_NAME} directly in the Info.plist.in template will cause CMake to evaluate it as variable expansion, work around the issue by putting the dollar sign into a separate cache variable that after evaluation will result in ${PRODUCT_NAME} being in the file verbatim, so that Xcode evaluate it at build time. Amends 4d838dae5a821e9e5f013ba1d5a494ece1b5180e Pick-to: 6.2 6.3 Task-number: QTBUG-95838 Change-Id: I2d1090cc8e84b32442f7daca2d4ce5e3ad413c68 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Fix issue with linking against static library on iOSAlexandru Croitor2022-05-201-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently our iOS CMake toolchain file sets the global XCODE_EMIT_EFFECTIVE_PLATFORM_NAME property to OFF, to work around a CMake issue regarding usage of object libraries in conjunction with Xcode. The error was The OBJECT library type may not be used for IMPORTED libraries under Xcode with multiple architectures $(CURRENT_ARCH) While this got rid of the error, it introduced a regression where linking an executable against a static library in the same project failed due to the library not being placed in a directory where Xcode expects it to be. clang: error: no such file or directory: '~/build-untitled4-Qt_6_0_2_for_iOS/Debug/libuntitled4.a' The actual library is created in Debug-iphoneos/libuntitled4.a Note the -iphoneos suffix, which is related to the EFFECTIVE_PLATFORM_NAME. This could be further worked around by either explicitly setting the library ARCHIVE_OUTPUT_DIRECTORY property in the project, or flipping the value of the XCODE_EMIT_EFFECTIVE_PLATFORM_NAME to ON at the end of the project. Both workarounds are not project-friendly. In the mean time CMake got a fix for the original error at https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5771 which got released with CMake 3.20.0. That was unfortunately not sufficient to remove our initial workaround, because removing it would trigger a different error at generation time CMake Error: Error evaluating generator expression: $<TARGET_OBJECTS:Qt6::Quick_resources_1> The evaluation of the TARGET_OBJECTS generator expression is only suitable for consumption by CMake (limited under Xcode with multiple architectures). It is not suitable for writing out elsewhere. Fortunately, another fix landed in CMake 3.21.0 to address that https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6161 Because static builds (iOS) require CMake 3.21, with both of these fixes we can now remove our workaround. Even projects that set ARCHIVE_OUTPUT_DIRECTORY or flip XCODE_EMIT_EFFECTIVE_PLATFORM_NAME to ON still continue to work fine. This also fixes installation of libraries, which also took into account the effective platform name and thus caused a mismatch between the expected output dir and the real one. This reverts 1e1805ed36a932dcb085a1ad3308782a136d477c Pick-to: 6.2 6.3 Fixes: QTBUG-93268 Fixes: QTBUG-95381 Task-number: QTBUG-87198 Change-Id: Ifcaf0f89e4328ae9859c596882ce32401fa491c3 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Automatically use Xcode generator in qt-cmake + iOSAlexandru Croitor2022-05-202-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When calling qt-cmake on the command line, we don't usually force usage of a particular CMake generator and defer to the user's choice or CMake's default for the host OS. In the case of iOS, the generator that makes the most sense to use is Xcode. One could also use Ninja / Unix Makefiles if the project is only building static libraries, but for shared libraries and executables the project likely needs the code signing provided by xcodebuild. When targeting iOS, use a different qt-cmake file template. The iOS-specific shell script will set the CMAKE_GENERATOR environment variable to 'Xcode'. If no -G or -D CMAKE_GENERATOR is provided on the command line then the project will use the Xcode generator. Otherwise the generator given on the command line takes precedence. The CMAKE_GENERATOR environment variable from the parent process is completely ignored. The logic is only done for iOS, to reduce the likeliness of breaking the qt-cmake script for other platforms. Note that Qt Creator does not use qt-cmake, but rather calls cmake directly with additional options like the toolchain file, architecture, sysroot, etc. [ChangeLog][iOS][CMake] qt-cmake now defaults to using the Xcode generator when targeting iOS projects. Pick-to: 6.2 6.3 Fixes: QTBUG-100834 Change-Id: I39b3dce47cc9ee2f98678631e4bd035c59c65294 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Pick first non-free team id for iOS Xcode projectsAlexandru Croitor2022-05-201-20/+83
| | | | | | | | | | | | | | | | | | | Previously we picked the first reported team id as found in the Xcode settings file. Now we pick the first non-free team id if there is one, otherwise we pick the first free one. This aligns with qmake behavior. Using a non-free team id usually leads to fewer issues with automatic code-signing. [ChangeLog][iOS][CMake] A non-free Xcode team id is now preferred for project signing. Pick-to: 6.2 6.3 Fixes: QTBUG-96341 Change-Id: I58618fe5c6ca04184812e9bf955a9cb0b3842447 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Set iOS default code style signing to AutomaticAlexandru Croitor2022-05-201-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As far as I can see, the default is already 'Automatic' when it is not specified, but it does improve some xcodebuild error messages in certain edge cases if the option is specified explicitly. Note that setting the style to Automatic will not suffice in order to build the project from the command line with xcodebuild, if there is no existing provisioning profile for the project in ~/Library/MobileDevice/Provisioning Profiles You either need to build it once via the Xcode GUI, or you need to call xcodebuild -allowProvisioningUpdates which will try to create / download a provisioning profile from Apple's server. This implies that Xcode must have been launched at least once, and configured with a valid Apple developer account, including a free account. qmake already generates a Makefile that calls xcodebuild -allowProvisioningUpdates. CMake doesn't have a Makefile wrapper, so calling cmake --build . will call xcodebuild directly, which again means users need to pass -allowProvisioningUpdates explicitly. It does not look like CMake intends to call it automatically any time soon, see https://gitlab.kitware.com/cmake/cmake/-/issues/22615 We intend to teach Qt Creator to add the -allowProvisioningUpdate option when building a project using CMake. The code sign style will not be set if the target XCODE_ATTRIBUTE_CODE_SIGN_STYLE property or the CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE variable has a value. There's also an opt-out variable called QT_NO_SET_XCODE_CODE_SIGN_STYLE Pick-to: 6.2 6.3 Fixes: QTBUG-96347 Change-Id: If65ccb8a0393ff6d80e6caea3b8003fc59a8a62a Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Set default xcode device family to iPhone and iPadAlexandru Croitor2022-05-201-0/+16
| | | | | | | | | | | | | | | | | | | This matches what we do with qmake, which means a build application can be deployed to either an iPhone or an iPad by default, without having to fiddle with Xcode settings. The device family will not be set if the target XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY property or the CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY variable has a value. There's also an opt-out variable called QT_NO_SET_XCODE_TARGETED_DEVICE_FAMILY Pick-to: 6.2 6.3 Fixes: QTBUG-100833 Change-Id: I8cde10975b44af81cfa18f985523c8ec1529386d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: Split some iOS handling code into separate functionsAlexandru Croitor2022-05-201-1/+12
| | | | | | | Pick-to: 6.2 6.3 Change-Id: I722194c11ce2588ada78597129b5a185f1e9fc69 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* CMake: set correct COMPILE_PDB_NAME for static librariesLi Xinwei2022-05-204-12/+19
| | | | | | | | | | | | | | | Output names of static libraries might be different from target names. For example, the library name of Qt6::DeviceDiscoverySupportPrivate is "Qt6DeviceDiscoverySupport.lib", and the library name of Qt6::QTlsBackendCertOnlyPlugin is "qcertonlybackend.lib". This commit make pdb files names consistent with the library names. And make sure we have set correct OUTPUT_NAME property before calling qt_set_common_target_properties()/qt_internal_set_compile_pdb_names(). Change-Id: Idb3cacd7a46a4f298fd584b927b5d726956faea8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* xcb: Delete touch points without target windowsTang Haixiang2022-05-204-4/+46
| | | | | | | | | | | | | | | | | | | | | | | | When XCB_INPUT_TOUCH_BEGIN closes a popup, we then receive XCB_INPUT_TOUCH_END, and cannot find a target window (because it's destroyed). If we don't deliver it, we need to at least clear the stored point from QPointingDevicePrivate::activePoints. Then when we deliver the next touch press, m_fakeMouseSourcePointId also needs to be reset. It's now even more paramount that autotests (and real-world touchscreens) must never omit any active touchpoint from a touch event. If a point doesn't move, it must be included in the QTouchEvent, with Stationary state. If not, QGuiApp::processTouchEvent() could generate multiple TouchBegin events in a row, which gets other bits of logic confused, here and there. Fixes: QTBUG-94557 Fixes: QTBUG-98519 Fixes: QTBUG-102751 Fixes: QTBUG-103706 Pick-to: 6.2 6.3 5.15 Change-Id: Ia95e410a2bb8bc7784aa5d296fac2b89e53a9f55 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add option to not include native libraries in APKTinja Paavoseppä2022-05-209-60/+224
| | | | | | | | | | | | | | | | | Sometimes it is not desirable to include the libraries in the APK, e.g. system and vendor apps could prefer having one set of libraries installed on the device. If unbundled deployment is specified, native libraries will not be included in the APK. With unbundled deployment, optional arguments can be passed to set the path to load the libraries on the device. [ChangeLog][Android][Deployment Changes] Adds option for Unbundled deployment, where native libraries are not packaged in the APK. Task-number: QAA-771 Change-Id: Ica51ef83a24dad58c7586bf610a58abe21fc1100 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Avoid ending Markdown fenced code blocks with gratuitous blank linesShawn Rutledge2022-05-205-10/+18
| | | | | | | | | | | | This caused unnecessary empty <pre> blocks when converting markdown to HTML, made code blocks too large using QSyntaxHighlighter to highlight the whole block, and caused assymmetry when rewriting markdown. Pick-to: 6.3 Fixes: QTBUG-101031 Change-Id: I08016577ccb92edb4afae31d7df3259cb011d5c8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* qtestcase.cpp: fix warning about ignoring the result of writev()Thiago Macieira2022-05-191-2/+2
| | | | | | | | I don't get it on openSUSE Tumbleweed, but this is not the only place I don't get a warn_unused_result warning and it happens elsewhere. Change-Id: I7e305799c8594ebab255fffd16ee12ff30df6d4d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Avoid using add_custom_command with PRE_LINK for version scriptAlexey Edelev2022-05-191-6/+19
| | | | | | | | | | | add_custom_command with PRE_LINK doesn't work correctly with Multi-Config builds. The better solution is to introduce a custom target that generates the final version script and link the target to the library target as the dependency. Change-Id: Ib7420af752a6a46f29f411f9f0dc8557410b4f22 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Convert <pre> to Markdown ``` and vice-versa with nonBreakableLinesShawn Rutledge2022-05-194-4/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The HTML parser calls QTextBlockFormat::setNonBreakableLines(true) when it sees a <pre> tag; so for symmetry, the markdown reader now does the same when it sees a fenced code block, and the markdown writer honors the nonBreakableLines property by writing a fenced code block. This preserves the meaning better when reading HTML and writing markdown or vice-versa, without modifying HTML reading or writing code. Added a test tst_QTextMarkdownImporter::fencedCodeBlocks() which unfortunately also highlights a known bug in the markdown reader: each fenced code block ends with an extra empty block. That can be fixed separately. tst_QTextMarkdownWriter::fromHtml(preformats with embedded backticks) that we re-enabled in 1abaf9d5d6ea9c6554362e851903ddd214a6f659 was not a very useful test: ``` with a space and some words but no newline is not a fence: it's just like a `monospace` span. We have had trouble with those in CI because of missing monospace fonts, or inconsistency when a supposedly mono font's QFontInfo::fixedPitch() returns false. So just test proper <pre>/fence conversion for now. Pick-to: 6.3 Fixes: QTBUG-100515 Fixes: QTBUG-100981 Task-number: QTBUG-101031 Change-Id: I88f0ede0810d8a9480b30eb0cd780e1af67cc5f2 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Android: fix default name of the CI emulatorAssam Boudjelthia2022-05-191-1/+1
| | | | | | | | | | This name was changed in qt5/coin but wasn't reflected here. Currently, things works correctly because the test target provide the correct name as an env var. Pick-to: 6.2 6.3 Change-Id: I8968285de2c7759d16f303c48d6295295dffbef6 Reviewed-by: Simo Fält <simo.falt@qt.io>
* QTextDocument: add setLayoutEnabled()David Faure2022-05-194-1/+59
| | | | | | | | | | | This allows to set up everything first - without paying for layouting at every step - and only then trigger layouting. Same performance behavior as setTextWidth(0), but this is a more explicit/readable API. Change-Id: I044dbd8b1301b1c97a92f9a29ccde2baf27a7665 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add an exception in testrunner for QDocLuca Di Sera2022-05-191-1/+3
| | | | | | | | | | | | | | | QDoc recently added some tests that use Catch2 instead of testlib. Similarly to selftests, the normal behavior of `qt-testrunner.py` will fail, trying to pass an argument that is not supported by Catch2 when running the tests in CI. To avoid the issue, an exception for the test executables that QDoc uses was added to `qt-testrunner.py`, using the already available mechanism that is used for selftests. Change-Id: I5eb4b75f239eda0c493fb06ece164545d159372b Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
* De-pessimize QTlsBackendOpenSSL::clearErrorQueue()Marc Mutz2022-05-191-2/+2
| | | | | | | | | | | We don't need to format the error messages into a QString just to clear the error queue. Just looping over q_ERR_get_error() does the trick, too, and isn't less readable. Pick-to: 6.3 Change-Id: Idc42f8c4ae4374d952cb357fca6c0fca0e04d086 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QCoreApplication/QPostEventList: fix int/qsizetype mismatchesMarc Mutz2022-05-192-15/+15
| | | | | | | | | | | | Includes fixes in indexed for loops that are either known to modify the container under iteration, or else aren't known not to do it, so were kept as indexed loops, instead of being ported to ranged ones. Pick-to: 6.3 6.2 Task-number: QTBUG-103532 Change-Id: I7047b6127fbc4ac16ee113cfd6d1c71f2caba1e7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QCoreApplication: port some indexed to ranged for loopsMarc Mutz2022-05-191-10/+6
| | | | | | | | | | | | ... fixing the int/qsizetype mismatches in the old code. These loops trivially don't modify the container under iteration, so using a ranged for loop is safe. Pick-to: 6.3 6.2 Task-number: QTBUG-103532 Change-Id: I1c9e1bffceea0ada54007d313aebe2e688fa9122 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Conan: Improve 'QT_HOST_PATH' handling in build recipeIikka Eklund2022-05-191-9/+19
| | | | | | | | | | | | | | If cross-building pass the '-o qt_host_path=/foo' option into '-DQT_HOST_PATH=/foo' for CMake so the user should not need to export that in the environment explicitly. The signature of 'append_cmake_prefix_path()' was changed to 'append_cmake_arg()' as the same functionality can be utilized for any CMake argument in the recipes. Pick-to: 6.3 Change-Id: I700d0acc86debbb8ee670330c22c167f3a585a3d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* windows: make native styles support QT_SCALE_FACTORMorten Sørvig2022-05-191-1/+4
| | | | | | | | | | | | | | Calculate the native metrics scale factor using DPI from the screen instead of using devicePixelRatio from the widget. This way the native metrics scale factor becomes independent of whatever modifications QtGui applies to the DPR. This matches its use case of scaling native metrics returned by win32 API. Task-number: QTBUG-86344 Change-Id: I0d3c73956520e2bc4a56b23ea3cb8e1f0c36fcf1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* unblacklist passing tests 2022Anna Wojciechowska2022-05-186-23/+0
| | | | | | Pick-to: 6.2 6.3 Change-Id: I7d37dd58eaede1bd0d1b53fe264b45be83cbca57 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qglobal.h: #include <stdbool.h> in C modeThiago Macieira2022-05-183-10/+1
| | | | | | | It's C99 and we require C11. Change-Id: Ieb9a2aa1ea914b1b956bfffd16eff4556b99f976 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix return value of qGlobalPostedEventsCount()Marc Mutz2022-05-183-15/+10
| | | | | | | | | | | | The unsigned return value was very un-Qt-ish, and, indeed, tst_QCoreApplication just stored the result in ints. Port to qsizetype, being the type of the expression that the function calculates. Task-number: QTBUG-103532 Change-Id: I95a81a686439b0686faad7a430adeaab66dc9e8d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make qGlobalPostedEventsCount() auto-test-exported-onlyMarc Mutz2022-05-184-2/+6
| | | | | | | | The only in-tree user outside QtCore is tst_QCoreApplication, guard the (single) test function there with QT_BUILD_INTERNAL. Change-Id: Ibc87ba76f2135cd8283acd75318f80a95e4b5c45 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove manual declarations of qGlobalPostedEventsCount()Marc Mutz2022-05-184-11/+2
| | | | | | | | | ... in favor of including qabstracteventdispatcher_p.h, where needed. Keeps the code DRY. Change-Id: I5bee2e653cb29ffac2601ff03c952a4b3adbdb9c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* [qtx11extras] Replace references to QDesktopWidget with QScreenNicolas Fella2022-05-181-5/+5
| | | | | | | | | QDesktopWidget doesn't exist any more Pick-to: 6.3 6.2 Change-Id: Ie4e2f9ce14ebe89b52224a0be798cd3cc9ff6134 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QKeySequenceEdit: Extract Method Private::rebuildKeySequence()Marc Mutz2022-05-182-3/+4
| | | | | | | | | | Factor the construction of Private::keySequence from Private::key into a helper function, as we'll need this functionality in more places when we add a maxKeyCount property to the class. Change-Id: I6b08a619c3b6b2a9ff660e9f51b02632c2359a47 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Un-blacklist markdown tests: QSKIP when fonts are scrambledShawn Rutledge2022-05-184-31/+92
| | | | | | | | | | | | | | | | | | | | | On QNX in CI we see system fonts: fixed: monospace 9; general: Sans Serif 9 and "monospace" isn't really a fixed pitch font. On B2Qt arm7 in CI we see system fonts: fixed: monospace 9; general Sans Serif 9 and Sans Serif is actually fixed pitch. So these tests can go wrong both ways; we need to skip them whenever the fonts would lead QTextMarkdownWriter astray. Pick-to: 6.3 6.2 Task-number: QTBUG-89819 Task-number: QTBUG-99676 Task-number: QTBUG-100515 Task-number: QTBUG-103484 Change-Id: I7b9adca967eaf9b8d33d1e03ef2627f70f375196 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QKeySequence: Add support for Eject and Clear glyphs on macOSLaszlo Papp2022-05-181-0/+2
| | | | | | | | | Presumably, these glyphs have not been needed thus far, hence missing from the corresponding list. Pick-to: 6.2 6.3 Change-Id: I72cb8811f087c40229105f65d52a9c1048d9f9eb Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Stylesheet: Another positioning fix for the menu indicatorVolker Hilsheimer2022-05-182-5/+16
| | | | | | | | | | | | | | | | | Draw tool button menu indicator relative to frame, not content, so that padding added in the stylesheet creates room between text and indicator. Also, prevent another double-arrow by ignoring menu indicator rendering when a menu button subcontrol is used, as the two are mutually exclusive. This amends 1c338e6d07a42631a6603c5bb0bc86f6806addd6. Add problematic case to stylesheet baseline test. Fixes: QTBUG-102866 Pick-to: 6.3 6.2 Change-Id: I5d79e65b33a2e41ac07c8efe0c15697c5be65201 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Use QAbstractItemModelTester or QFileSystemModelAndreas Buhr2022-05-183-4/+56
| | | | | | | | | | | | This patch enables usage of QAbstractItemModelTester on QFileSystemModel. QAbstractItemModelTester called fetchMore() on all items. QFileSystemModel represents the whole file system. This led to very long test runs. To avoid this, this patch introduces a new feature in QAbstractItemModelTester, namely to disable calling of fetchMore(). Change-Id: Ie5d2e22fa4c143be7c080d9f79632cd2cbe07aac Reviewed-by: David Faure <david.faure@kdab.com>
* Fix memory leak in tst_qtreewidgetAndreas Buhr2022-05-181-0/+2
| | | | | | | | | | | Invalid inserts of items are tested. However, on an invalid insert of QTreeWidgetItem into QTreeWidget, the QTreeWidget does not take ownership of the to-be-inserted items. These items were leaked in the past. This patch introduces a scope-guard, so the items are not leaked. Change-Id: Ib53ac02605c3a3c0bd1ae69bbd0876f860d08093 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Make uic generate correct C++ commentsVolker Hilsheimer2022-05-1853-105/+180
| | | | | | | | | Revert the change to uic of 05fc3aef53348fb58be6308076e000825b704e58. Task-number: QTBUG-67283 Change-Id: Icfd83bb6d80b91d4e58f1be460f6772ba49a6921 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Optimize atomics in QObject::moveToThread() [2/2]: de-duplicate loadsMarc Mutz2022-05-181-1/+1
| | | | | | | | | | | | | | We don't need to reload d->threadData, as we've already loaded it into a register three lines above, so use the already-loaded value. We don't care whether we might have read a different value the second time around, because that would mean we had a race condition elsewhere in the program (e.g. concurrent moveToThread() calls). Pick-to: 6.3 Change-Id: I29a27ca23302288b5900ac6b45b8690a80e85680 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Optimize atomics in QObject::moveToThread() [1/2]: relax a pointer loadMarc Mutz2022-05-181-1/+1
| | | | | | | | | | We don't need an acquire fence for checking a pointer for nullness, and we're not dereferencing the pointer later, so use a relaxed load there. Pick-to: 6.3 Change-Id: Id84e6fc50100f1bf6a4e33f89424f8b1cbb250cd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>