summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Remove Windows 7, 8, and 8.1 codepathsOliver Wolff2021-07-301-14/+2
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-84432 Change-Id: I970d7d7e9ebdcf246a5be32d60066b4e5e948c27 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QByteArray: fix indexOf/lastIndexOfIvan Solovev2021-07-291-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixed two bugs in indexOf/lastIndexOf: 1. The lastIndexOf(char, qsizetype) overload was crashing with an empty QByteArray. It was unconditionally calling lastIndexOfCharHelper() which assumes that this QBA is not empty. An explicit check for the empty case is added. 2. The indexOf(QByteArray, qsizetype) overload was behaving incorrectly while searching for an empty QByteArray. In this case it unconditionally returned its second parameter (from). However, from can be negative, or even exceed the size of this QByteArray. This patch handles this cases properly. As a drive-by: this patch adjusts the QByteArray::indexOf(char, qsizetype) and QByteArray::lastIndexOf(char, qsizetype) overloads to match with the QByteArrayView implementation. This is done to have similar code paths in both cases and avoid tricky bugs in future. Ideally we had to adjust the QByteArrayView implementation, but it's fully inline, so can't be changed without breaking BC. Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: Iaef2fdc5b99cce6aa342cca2d17544a1ad7ca677 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QPrivateSlotBase: add empty base class optimizationMarc Mutz2021-07-291-5/+30
| | | | | | | | | | | | | | | There are few slots whose lambdas are empty; most will at least capture [this]. But there are a few in Qt examples that do, e.g. []{ qApp->quit(); }. Logging is also an example. So go the extra mile and optimize for empty functors by inheriting from them as opposed to storing them in a member variable. Change-Id: I3904f10db5ebe904ba889d29c08569edd804df3b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSlotObjectBase: document relation between m_impl and Operation betterMarc Mutz2021-07-291-1/+4
| | | | | | | Change-Id: I02bfe1857a9c2b781f7ad891e813fd6818fab671 Reviewed-by: Ivan Tkachenko <me@ratijas.tk> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUuid: port fromRfc4122() to QByteArrayViewMarc Mutz2021-07-284-17/+26
| | | | | | | | | Remove the QByteArray overload from the API, but not the ABI. Adapt callers. Change-Id: I88aa09cbca3b89d0b249ce336ebe49c4b352c9e1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* tests: fix some -WvolatileMarc Mutz2021-07-282-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | C++20 deprecated compound volatile statements such as pre- and post-increments, to stress that they're not atomic. So instead of volatile i; ~~~~; ++i; you're now supposed to write volatile i; ~~~~; int j = i; // volatile load ++j; i = j; // volatile store which matches more closely what hardware does. Instead of fixing every use of volatile pre- or post-increment in this fashion individually, and realising that probably a few more Qt modules will have the same kind of code patterns in them, write QtPrivate functions to do the job centrally. Change-Id: I838097bd484ef2118c071726963f103c080d2ba5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QDirIterator: add nextFileInfo()Marc Mutz2021-07-285-27/+40
| | | | | | | | | | | | | | | | | | | | | | | Before this change, next() was the only way to advance the iterator, whether the caller was ultimately interested in just the filePath() (good) or not (bad luck, had to call .fileInfo()). Add a new function, nextFileInfo(), with returns fileInfo() instead. Incidentally, the returned object has already been constructed as part of advance()ing the iterator, so the new function is faster than next() even if the result is ignored, because we're not calculating a QString result the caller may not be interested in. Use the new function around the code. Fix a couple of cases of next(); fileInfo().filePath() (just use next()'s return value) as a drive-by. [ChangeLog][QtCore][QDirIterator] Added nextFileInfo(), which is like next(), but returns fileInfo() instead of filePath(). Change-Id: I601220575961169b44139fc55b9eae6c3197afb4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSysInfo: Delete pre-windows 10 codeMårten Nordheim2021-07-281-28/+4
| | | | | | | It's not supported. Change-Id: Id8c6ca7e7ad152620c76b5479ca495e9f64cc354 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* io: Remove version checks for versions below Win 10Mårten Nordheim2021-07-283-77/+37
| | | | | | | It's not supported. Change-Id: Ia17fc7e1d5ae785eca0a6ba530f9b9bc960605d4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QEventDispatcher: Remove code dealing with Windows < 10Mårten Nordheim2021-07-281-13/+1
| | | | | | | It's not supported. Change-Id: I650a48f214bc4965b5e28f04e4f095273d7f9e5b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: clean up API removalsMarc Mutz2021-07-283-7/+7
| | | | | | | | | Use the same new pattern as in QtWidgets. Amends de18b3ff370543b5b99bd068b871a2cd677cf9f3. Change-Id: Ia1cbd40aa7a7efc9a954d22b599e13a19a6a9266 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Add missing commaPaul Wicking2021-07-281-1/+1
| | | | | | | Fixes: QTBUG-95379 Pick-to: 6.2 Change-Id: Ie66feccff27d055a4ebd4f7b26313910934ad234 Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* QMap: add operator+ and - for iteratorsGiuseppe D'Angelo2021-07-273-0/+148
| | | | | | | | | | | | | We missed the chance of deprecating them in 5.15, so they'll just add to the pain of porting to 6.0. We should not keep them around forever, though; QMap isn't random access and so its iterators should only have bidirectional APIs. Pick-to: 6.2 Fixes: QTBUG-95334 Change-Id: I3577f7d25e8ab793722d2f220fd27bc85c622b0d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Deduplicate offset calculation in QMetaObjectBuilderIvan Tkachenko2021-07-271-1/+1
| | | | | | | | | | | | Not even an optimization (unless your compiler sucks). Just improves readability, since offset is already calculated few lines above. Offset formula used to be somewhat more complicated, but since commit e58b44d557b859b7b55869f1e137aa1bc8968307 it became reusable here. Change-Id: I4128b2643daf2cb112c9b861342fd0e27c9a1a95 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QHash/QSet: fix squeeze() for default-constructed containerIvan Solovev2021-07-271-1/+5
| | | | | | | | | | | | | | | | | | | | | QHash::squeeze() was unconditionally calling reserve(0), which is always allocating memory (even for 0 size). This was leading to a confusing situation when calling squeeze() on a default-constructed container with 0 capacity() actually allocated memory. This is very misleading, as squeeze() is supposed to free unneeded memory, not to allocate more. This patch adds a check for non-zero capacity. As a result, nothing is done for default-constructed container. Note that this patch also affects the QSet::squeeze() behavior, because QSet uses QHash as its underlying data type. Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: Ib1c3c8b7b3de6ddeefea0e70b1ec71803e8fd3b3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
* QUrlQuery/Doc: update the information about encoded vs decodedThiago Macieira2021-07-271-1/+28
| | | | | | | | | | | This class was not subject to the QUrl API update that took place between 5.0 and 5.1 that changed the QUrl string defaults and added QUrl::ParsingMode. It always parses as TolerantMode. Fixes: QTBUG-95254 Change-Id: I37d93a60a0d649688bddfffd169348d874eacc92 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't report results when the results list is emptySona Kurazyan2021-07-272-0/+8
| | | | | | | | | | | | | | | | | | When inserting items into the result store, a ResultItem is created, which stores a pointer to the results list and their size. If the size of the ResultItem is set to 0, it means that a single result is stored. In case of trying to report results via an empty list, the size is 0, so result store treats it as a single result. Added checks before storing the results to make sure that the result list isn't empty. Note that empty lists are allowed in some cases for the filter mode, because ResultStoreBase::addResults() knows how to handle those cases correctly. Task-number: QTBUG-80957 Pick-to: 5.15 6.1 6.2 Change-Id: I399af4c3eef6adf82fea5df031fe9a9075006b1f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* doubleToString: Fix assert when double is NaNMårten Nordheim2021-07-271-1/+1
| | | | | | | wholePartSpace asserts that its input is >= 0, but NaN is not a number Change-Id: Iafc075663d5f8841f21edf0a3d4d36694287a51f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QTextStream: Always use direct connection inside QDeviceClosedNotifierIevgenii Meshcheriakov2021-07-271-2/+7
| | | | | | | | | | | | | | | | | | | | Force direct connection when connecting aboutToClose() signal of device to flushStream() slot of QDeviceClosedNotifier. This allows use of a QTextStream from multiple threads when synchronization is handled by the application. Queued connections from aboutToClose() don't make much sense because the device is closed immediately after emitting the signal. If a QTextStream object is used by threads different from the one where it was created, queued connection may result in attempting to flush the data after the associated device is already closed, and accessing the QTextStream's buffers from multiple threads. Fixes: QTBUG-12055 Change-Id: If601d0f04f08b248b21ed1630b7dfd3546aee068 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QtWidgets: clean up API removalsMarc Mutz2021-07-271-0/+36
| | | | | | | | | | | As suggested by Peppe and Lars, use one file per module to hold the removed functions, not one per major version and subdir. Also, make the remove macro more like QT_DEPRECATED_SINCE. Change-Id: I2ade51ccc8cb8720ece493936775dfd3b5d438d7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QDuplicateTracker: bring back appendTo() &&Marc Mutz2021-07-271-1/+19
| | | | | | | | | | | | | | This reverts commit c19695ab953c979f15bbc72c4f4a453e9a114cf6. Just because QSet has limited API doesn't mean we can't provide this in an efficient way for std::unordered_set :P Added tests. Pick-to: 6.2 Change-Id: I4f8f0e60c810acdc666cf34f929845227ed87f3b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* time: Rerun cldr2qtimezone.pyIevgenii Meshcheriakov2021-07-271-33/+33
| | | | | | | | | | | | | | This updates qtimezoneprivate_data_p.h changing any mention of Country to Territory in it. The change was introduced by the following commit: e51831260a759b58cb089cac089c202a795fc584 There are no code changes. This reduces number of changes visible after rerunning cldr2qtimezone.py. Pick-to: 6.2 Change-Id: I0898ecf224108604b7178e31fa7e76b4cb13a965 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCalendar: Make SystemId constructors with one argument explicitIevgenii Meshcheriakov2021-07-271-2/+3
| | | | | | | | This avoids unwanted type conversions. Pick-to: 6.2 Change-Id: Ie57e80da615c6bc162224fa3816fc21a47ab4b00 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* macOS: Add helper function to check whether we're running under RosettaTor Arne Vestbø2021-07-272-0/+11
| | | | | | | | As described in https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment?language=objc#Determine-Whether-Your-App-Is-Running-as-a-Translated-Binary Pick-to: 6.2 Change-Id: I16fa4be20e4a55c87c2eb760d671d27ee4de1703 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QCalendarBackend: Use QAnyStringView to create backends by nameIevgenii Meshcheriakov2021-07-273-17/+5
| | | | | | | | | | | | | | Combine two implementations of QCalendarBackend::byName() accepting QStringView and QLatin1String arguments into one accepting QAnyStringView to reduce code duplication. Add a note to QCalendar constructors accepting strings to do the same for Qt 7. Change-Id: Idfc3b9c61e22712543c723bd94fcd788da52780a Pick-to: 6.2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString::number(int): Avoid going through qlocale machineryMårten Nordheim2021-07-263-46/+60
| | | | | | | | | | | | | For increased performance, as measured with the number_qu?longlong QString benchmarks. The results are all good, reducing runtime by anywhere between 40 and 220 nanoseconds. The slowest test previously completing at ~330ns, now completing at ~105ns. Task-number: QTBUG-88484 Change-Id: Ie96e86e57b635bac01389aed531a6d9f087df983 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix typo in function nameIevgenii Meshcheriakov2021-07-261-2/+2
| | | | | | | | Fix typo: containsProhibitedOuptut -> containsProhibitedOutput. Pick-to: 6.2 Change-Id: I4eb8be4c7ceb2e96ac129ef7c64215558f7b308e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Move Android implementation of permissions API to QtAndroidPrivateTor Arne Vestbø2021-07-265-303/+292
| | | | | | | | | | | | And remove plumbing from public QCoreApplication API, which is going to be removed in follow up patch after leaf modules have moved to the private Android API. The public permissions API will be reintroduced in 6.3 after further work. Pick-to: 6.2 Change-Id: I46772284b98d0ced8d4a624a850adaa4a1dfe645 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Doc: Ensure deprecated APIs in Qt Core are documented as suchNico Vertriest2021-07-2310-71/+55
| | | | | | | | | | Added \deprecated [version_since] when needed Remove references to deprecated functions in \sa statements Fixes: QTBUG-94534 Pick-to: 6.2 Change-Id: I3b3d4277d63fc5d6d207c28ff2484aed30b83247 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make QFutureWatcher::isFinished() consistent with the watched QFutureSona Kurazyan2021-07-232-7/+2
| | | | | | | | | | | | | | | | | | | | | All the getters of QFutureWatcher are consistent with the getters of the corresponding QFuture, except for the isFinished() method, which returns 'true' only after the finished() signal is delivered. This behavior might be unintuitive for the users. In particular, isFinished() returns 'false', even if it's called immediately after waitForFinished(). [ChangeLog][QtCore][QFutureWatcher][Important Behavior Changes] The QFutureWatcher::isFinished() method now indicates if the related QFuture is finished, instead of indicating if the finished() signal was delivered. This makes it consistent with the future that is being watched. Fixes: QTBUG-91048 Pick-to: 6.1 6.2 Change-Id: I6ae9b882b23e06198a82c95b026491bd480b3bf0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove some now-redundant casts to qint64Edward Welbourne2021-07-221-8/+3
| | | | | | | | | | | | | One was long redundant. The other two, relatively recently added, should be redundant thanks to the former enum member MSECS_PER_DAY being changed to a constexpr qint64 by commit 4059af81d33bb1f6a7773b77d3039f2fc53fcd23 Change-Id: I601ed8dae905fed6399ce29c25545ec651e9838a Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* CMake: Fix Windows -debug-and-release builds with CMake 3.21.0Alexandru Croitor2021-07-221-5/+19
| | | | | | | | | | | | | | | | | | | | | CMake 3.21.0 introduced a regression where per-config sources can't be specified for object libs when building Qt with Ninja Multi-Config and cross-config mode on. We hit that in our Windows resource compiler handling. To work around the issue, pass the config-specific sources directly to the target rather than via an object library, when using CMake 3.20 or later. The original issue of not being able to do that has been fixed in 3.20. Amends ba6175eb731927f2489cdd7d899616a9889aba67 Amends a1ccedeb440216dce87fad01746935a89fd8715e Amends 657fa0462d552110e2ba14bcac46275e6066993f Pick-to: 6.2 Fixes: QTBUG-95229 Change-Id: Idea6d5bcc54b3124c66c45538c2e06e92f288f5f Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Android: stop making throwing promisesGiuseppe D'Angelo2021-07-221-25/+1
| | | | | | | | | | | No Qt API throws exceptions, ever. Kill the throwing paths, leaving the normal paths in which a permission request is denied. Pick-to: 6.2 Change-Id: I6bebaf155c5232444bf5014e25e9c469d5dccfa6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSet::erase - extend docsIvan Solovev2021-07-211-0/+5
| | | | | | | | | | | | | Explicitly specify that calling this method for an empty set or with an invalid iterator results in undefined behavior. On a debug build an assert is triggered in such case, but on a release build it will access the incorect index of an array. Task-number: QTBUG-91736 Pick-to: 6.2 6.1 Change-Id: Ibc3e91512a0ad9d9779a41083fedb8a91780380b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QFileSelector: Preserve path to root directoryFabian Kosmale2021-07-211-1/+4
| | | | | | | | | | | | | | | | While QFileSelector is documented to work on files, select accepts arbitrary URLs. Moreover, the QML engine can end up intercepting arbitrary (user provided) URLs, including to directories. Prior to this change, passing "file:///" or "/" to the function would break: We would temporarily get a "//" path, which is invalid, and thus we would return an invalid in the end. Prevent this by only appending a slash to the path when it doesn't have one. Fixes: QTBUG-85410 Pick-to: 6.2 Change-Id: I1d2807a9d225df611c3a5e871e3c1d90a6a25953 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* emit layoutAboutToBeChanged timelyLuca Beldi2021-07-201-11/+19
| | | | | | | | | | | layoutAboutToBeChanged must be called before persistentIndexList as the user might create persistent indexes as a response to the signal Fixes: QTBUG-93466 Pick-to: 6.2 5.15 Change-Id: I73c24501f536ef9b6092c3374821497f0a8f0de4 Reviewed-by: David Faure <david.faure@kdab.com>
* Fix quadratic performance hit in Q(Multi)Map::insert() with hintEdward Welbourne2021-07-201-9/+19
| | | | | | | | | | | | | | | | | | | | | | | The insert() overloads that took a const_iterator started by calling std::distance(begin(), pos) - which has a cost linear in how far pos is from begin() - in order to, after detach()ing, obtain an iterator at the same offset from the new begin(), using std::next() - also linear. This leads to quadratic behavior when large numbers of entries are added with constEnd() as the hint, which happened to be tested by tst_bench_qmap. That wasn't running, due to some assertion failures, but once those were fixed the hinted tests timed out after five minutes, where their unhinted peers completed comfortably within a second. Check whether detach() is even needed and bypass the std::distance() / std::next() linear delay when it isn't. This brings the hinted tests down to running faster than their unhinted equivalents. Pick-to: 6.1 6.2 Task-number: QTBUG-91713 Change-Id: I6b705bf8fc34e67aed2ac4b3312a836e105ca2f2 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Simplify the application permission APIAssam Boudjelthia2021-07-193-66/+66
| | | | | | | | | | | | Remove read/write variants of the permission types to make the API simpler and more versatile. If the user wishes to have more control over the permission requests/checks, they can use more platform-specific code. Pick-to: 6.2 Task-number: QTBUG-94407 Change-Id: I2b72041aa3effaac7e7f7361237cf1146817b525 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make QCalendarBackend's ID an opaque typeEdward Welbourne2021-07-198-60/+107
| | | | | | | | | | As Giuseppe pointed out in API change review, an opaque type should be used. Task-number: QTBUG-94407 Pick-to: 6.2 Change-Id: I862a6f52d284317e1243fd91f45bb0af130d154a Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Don't create ${target}_qml_files target any moreCraig Scott2021-07-191-8/+3
| | | | | | | | | | | | | | The qml files should now always be added via dedicated functions provided by the qtdeclarative repo. Those functions take care of adding the files to targets so that they will show up in IDE file lists, so we should not add them to a separate target as well. This will also remove one unnecessary build target, which will reduce visual noise in some IDEs. Pick-to: 6.2 Change-Id: I79bf1ea8fb8a2f15643e052d50ac582a91bdff1a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use member function instead of template function to resolve native interfaceTor Arne Vestbø2021-07-172-32/+25
| | | | | | | | | | | | | | The use of a freestanding function is not needed now that the name doesn't alias the nativeInterface accessor function, and was just adding complexity to the machinery. People not familiar with the code will have an easier time following the flow through the helper member function, and we no longer need to declare our own export macros. Pick-to: 6.2 Change-Id: I17530b7e89939cfc19ab8ffaa076b7129ae02dcf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Handle single- and multi-config differences more robustlyCraig Scott2021-07-171-6/+7
| | | | | | | | | | | | | Projects sometimes set both CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE regardless of what CMake generator they are using. They shouldn't, but it is common enough that we should protect against it. The GENERATOR_IS_MULTI_CONFIG global property is the only robust way to know which type of generator we are using, so switch to that for how we detect this. Pick-to: 6.2 Change-Id: If5d6568da0d2adb3275bbaf9a7d3bd3e033dc636 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Clean up and simplify qt6_extract_metatypes implementationAlexandru Croitor2021-07-162-74/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove copying of json files in non-prefix builds. Previously, this was done to mimic the directory layout of prefix builds in a non-prefix build, but the extra complexity is not worth it. Keeping the files in the build directories of each repo in a non-prefix build should be good enough. As a result, we don't need to distinguish which file path should be passed in INTERFACE_SOURCES. Now we have only 2 paths to consider, the BUILD_INTERFACE one and the INSTALL_PREFIX one, rather than 3 different paths. Move the code that handles installation closer together. Rename the internal COPY_OVER_INSTALL option to ___QT_INTERNAL_NO_INSTALL. We might want to expose it as a public option later, but it depends on whether we will disable default installation for user projects. Remove assignment of some properties that are not used anymore. Amends c431e2d33c2b13dee8b43a08c267c20ec1ae9654 Pick-to: 6.2 Task-number: QTBUG-94942 Change-Id: I3a26d1988987b2ce7c7d01d2311c13b3da3175a8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Fix qt6_extract_metatypes json file generation ruleAlexandru Croitor2021-07-161-39/+23
| | | | | | | | | | | | | | | | | | | | | | | | Change the copying of ${CMAKE_CURRENT_BINARY_DIR}/${target}_metatypes.json to ${prefix}/lib/metatypes/${target}_metatypes.json to happen as part of the command generating the file, rather than copying the file as part of a separate custom target or POST_BUILD event. This ensures that the custom commands in qt6_qml_type_registration that use those files as dependencies will cause them to be generated before the qml type registration happens, thus eliminating errors like Error 5 while parsing qtbase/lib/metatypes/qt6quick_metatypes.json: illegal value Pick-to: 6.1 6.2 Fixes: QTBUG-94942 Change-Id: Idddd73786d1a622984965c60ac9b4c3bc2c13ab5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Consistent handling of disabled items in QItemSelectionModelAndreas Buhr2021-07-153-22/+56
| | | | | | | | | | | | | | | | | | | | | | | | In QItemSelectionModel, items which are disabled or marked as not selectable should not be considered as selected. But this was not handled consistently. The following methods considered only items which are enabled and marked selectable: selectedIndexes(), rowIntersectsSelection(), and columnIntersectsSelection(). The following methods considered only items which are marked selectable, but did not check whether they are enabled: selectedRows(), selectedColumns(), isRowSelected(), isColumnSelected(), isSelected(). Finally there is hasSelection(), which did not check for enabled nor for selectable. This patch introduces consistent behavior. All methods check both whether the items are enabled and whether they are selectable now. [ChangeLog][QtCore][QItemSelectionModel][Important Behavior Changes] All methods in QItemSelectionModel now consider only items which are marked as enabled and selectable as part of the selection. Fixes: QTBUG-93829 Pick-to: 6.2 Change-Id: I4725243ea6b0db4f289ce34ada22c7a9d3282713 Reviewed-by: David Faure <david.faure@kdab.com>
* QCryptographicHash: use a std::array to hold result (was: QByteArray)Marc Mutz2021-07-153-27/+69
| | | | | | | | | | | | | | | | | | | | | | The maximum size for a hash result is 64 atm. Even if, and esp when, we'll get to 128 and 256 bytes in the future, there's no reason to use dynamic memory, because the sizes will always be statically known. So use, essentially, a std::array<char, 64> to hold the result internally. Add a bit of convenience API on top to limit impact on the rest of the code and add a few static_asserts that ensure this is large enough. Then give users access to the internal buffer by adding QByteArrayView resultView() const noexcept. The documentation snippet is taken from QString::data(), suitably adjusted. Use resultView() in a few places instead of result(). [ChangeLog][QtCore][QCryptographicHash] Changed to use a statically-sized buffer internally. Added resultView() to access it. Change-Id: I96c35e55acacbe94529446d720c18325273ffd2f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Improve error reporting when requesting unsupported native interfaceTor Arne Vestbø2021-07-152-18/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By switching out the static_assert for an enable_if we end up producing a clearer error, at the call site: /qt/qtbase/examples/gui/rasterwindow/main.cpp:69:9: error: no matching member function for call to 'nativeInterface' app.nativeInterface<QNativeInterface::QCocoaGLContext>(); ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /qt/qtbase/src/gui/kernel/qguiapplication.h:176:5: note: candidate template ignored: requirement 'NativeInterface<QNativeInterface::QCocoaGLContext>::isCompatibleWith<QGuiApplication>' was not satisfied [with NativeInterface = QNativeInterface::QCocoaGLContext, TypeInfo = QNativeInterface::Private::NativeInterface<QNativeInterface::QCocoaGLContext>, BaseType = QGuiApplication] QT_DECLARE_NATIVE_INTERFACE_ACCESSOR(QGuiApplication) ^ By using SFINAE for the TypeInfo we can also ensure that it works for types that are not native interfaces, such as if the user tries to call nativeInterface<QString>(). Since we can no longer use decltype(*this) to resolve the base type we need to change QT_DECLARE_NATIVE_INTERFACE_ACCESSOR to take the type as an argument, as we do for other QT_DECLARE_FOO macros. Pick-to: 6.2 Change-Id: Ie3f7e01ab7c3eb3dcc2ef730834f268bb9e81e0c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaType: Support converting any QFuture<T> to QFuture<void>Arno Rehn2021-07-152-0/+31
| | | | | | | | | | | | | | | | QMetaType now implicitly knows how to convert any QFuture<T> to QFuture<void> without needing to manually register a converter function. QtWebChannel will make use of this to transparently support QFuture<T> return types. [ChangeLog][QtCore][QMetaType] QMetaType now supports converting any QFuture<T> to QFuture<void>. Task-number: QTBUG-92903 Change-Id: Ied7e71be37c346cc3d2c274ffb0d91a6821ab4d4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Change QCollator's default locale to QLocale().collation()Edward Welbourne2021-07-151-4/+8
| | | | | | | | | | | | | | | | | | | | | This replaces QLocale::system().collation(), which left client code with no way to change this default. Since QLocale's default is the system locale initially, the old behavior is retained until the first call to QLocale;:setDefault(). Addition of a separate collation locale in 5.14 changed from using the default locale to using the system's collation locale; the present change restores the ability to override this. [ChangeLog][QtCore][QCollator] The default locale used by QCollator is now the collation locale of the default QLocale. This restores the ability (lost at 5.14) to control the locale used by QString::localeAwareCompare(), while retaining the use of a collation locale when the default is the system locale. Task-number: QTBUG-95050 Pick-to: 6.2 6.1 5.15 Change-Id: I232772bb8f23fffd74573174de70ef2deae372a9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTranslator: Fix loading of meta catalogs from absolute .qm pathKai Köhne2021-07-151-3/+8
| | | | | | | | | | | | | | | In case of QTranslator translator; translator.load("somedir/file.qm"); and file.qm being a meta catalog file, the sub-catalogs in somedir couldn't be located, unless "somedir" was set as second argument. Pick-to: 5.15 6.1 6.2 Fixes: QTBUG-95013 Change-Id: I06103244ce2ff9800c2c64cb0c17f9bc7ef0e8de Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>