summaryrefslogtreecommitdiffstats
path: root/src/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Add a way of notifying QFutureWatcher when pause is in effectSona Kurazyan2020-05-297-16/+82
| | | | | | | | | | | | | | | | | | | | | | | | Because setting QFutureInterface to paused state does not mean that the computations that are already in progress will stop immediately, it may be useful to get notified when pause actually takes effect. Introduced the QFutureWatcher::suspended() signal, to be emitted when there are no more computations in progress, and no more result ready or progress reporting signals will be emitted, i.e. when pause took effect. Added {QFuture, QFutureWatcher}::isSuspended() methods for checking if pause took effect. QtConcurrent will now to send QFutureCallOutEvent::Suspended event when the state is paused and there are no more active threads. [ChangeLog][QtCore][QFutureWatcher] Added a new QFutureWatcher::suspended() signal, to be emitted when pause took effect, meaning that there are no more computations in progress. Added {QFuture, QFutureWatcher}::isSuspended() methods for checking if pause took effect. Fixes: QTBUG-12152 Change-Id: I88f2ad24d800cd6293dec63977d45bd35f9a09f0 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* CMake Build: Do not set "lib" prefix for modules (plugins)Cristian Adam2020-05-291-0/+4
| | | | | | | CMake sets "lib" as default prefix for Windows-GNU platforms. Change-Id: I49e3123c385610307c84c584a21f5f3827a6fafd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix a typo and an odd phrasingEdward Welbourne2020-05-291-7/+6
| | | | | | | | | | | One initializes data "byte by byte" not "byte per byte", at least in any dialect I'm familiar with. A byte array can be "created from raw data" but if it was "from a" thing it'd have to be a datum of some sort. Change-Id: Id9706b191f08f03418b9ea6f481797d93a278dff Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Implement support for QProperty<T> with a static observerSimon Hausmann2020-05-285-4/+382
| | | | | | | | | | | | | | | | | | | | | | | A common pattern in Qt Quick will be QProperty members that are connected to a callback that needs to perform something when the value changes, for example emitting a compatibility signal or marking scene graph node data dirty. To make such a pattern more efficient, a new QNotifiedProperty type is introduced that offers the same API as QProperty<T>, with two changes: (1) The template instantiation not only takes the property type as parameter but also a callback pointer-to-member. (2) Since that member itself cannot be called without an instance and to avoid storing an instance pointer permanently, the API for setBinding and setValue are adjusted to also take the instance pointer. For the former it gets stored in the binding, for the latter it is used to invoke the callback after setting the new value. Change-Id: I85cc1d1d1c0472164c4ae87808cfdc0d0b1475e1 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add missing number/setNum() overloadsLars Knoll2020-05-282-0/+46
| | | | | | | | QString has the overloads taking a long/ulong. QByteArray also has toLong/ULong(), so add these to make the API symmetric. Change-Id: I6d1f98ca95fabd32b012f1c3df603dc54e187ec3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix most obvious typos in doc commentsIvan Tkachenko2020-05-283-18/+18
| | | | | | | | | | | Just opened some files with spell checker turned on, and corrected what was underlined. Also, see QTBUG-84427. Change-Id: I702b5bf2cfe1f23c928a6a57f117a2f571ad86ea Pick-to: 5.15 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Cache system zone ID when fetched from the file-systemEdward Welbourne2020-05-281-64/+141
| | | | | | | | | | | | | | Record the device and inode numbers when found and assume we can safely re-use the name if those have not changed. Tidy up some preprocessor trivia in the process and moved zone-availability check functions to before the system name lookup. Pick-to: 5.15 Task-number: QTBUG-75585 Change-Id: I3660922ef3c94b553a20f887a676e8921693b30f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QDateTimeParser recognize local time offsetsAndrei Golubev2020-05-281-13/+10
| | | | | | | Fixes: QTBUG-84209 Pick-to: 5.15 Change-Id: Iedbc7beafcaa55c72fec3ac5a5f519c6ed5f7770 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add a QPropertyAliasUlf Hermann2020-05-273-10/+399
| | | | | | | | | | | | A property alias is the equivalent of the "alias" keyword in QML. It provides the same API as QProperty, but redirects any access to the QProperty it was initialized with. When the original property is destroyed the binding becomes invalid and ignores any further acccess. Task-number: QTBUG-84370 Change-Id: I0aef8d50e73a2aa9e7703d51194d4c5480573578 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove deprecated QProcess methodsVolker Hilsheimer2020-05-272-187/+3
| | | | | | | | | | | | | Add default parameter for arguments in start, startDetached, and execute for better source compatibility with Qt 5.15. This has the risk of then hiding incorrect calls to the previous overload taking a single "command" strings if code is ported from pre-5.15 or ignores deprecation warnings. This is acceptable, given that the alternative is that all calls to these functions would require a default constructed QStringList as the second parameter. Change-Id: I1ba4df97ac4894d007da5083c8359015d784ddbb Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QProperty: Support multiple observersUlf Hermann2020-05-274-17/+32
| | | | | | | | | Previously, only the first observer would get notified. Also, make sure that the notifiers are always retained when switching between bindings and values. Change-Id: I9c25c0f2e288dac3a335b68e618f7ddeb44be25a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QProperty: Apply coding style and avoid warningsUlf Hermann2020-05-271-1/+1
| | | | | Change-Id: I14efdb293a4be39b3849b34bd8013fdab016ce7e Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* Don't queue events in QFutureWatcher when pause is requestedSona Kurazyan2020-05-272-26/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When QFutureWatcher (or QFutureInterface) is paused, it doesn't mean that it will take effect immediately: the pending tasks may still be in progress and keep reporting results. At the moment QFutureWatcher will queue those events and report only with the next resume. This behavior is wrong, QFutureWatcher should not decide when to report events, the sender should decide when is the right time. There's no benefit in reporting already happened events with delay. Because of this, even the pause event itself was being reported after resume. Fixed the behavior by removing the logic of queueing events when the state is set to "paused". It seems unlikely that the users of QFutureWatcher rely on reporting events with delay. [ChangeLog][Important Behavior Changes][QtCore] QFutureWatcher will not immediately stop delivering progress and result ready signals when the future is paused. At the moment of pausing there may be still computations that are in progress and cannot be stopped. Signals for such computations will be still delivered after pause, instead of being postponed and reported only after next resume. Fixes: QTBUG-12152 Change-Id: I9f0b545ac096578c52cc72d60575c018c01e3368 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* QMimeDatabase/xml: use xmlstarlet instead of xmlEric Lemanissier2020-05-261-2/+2
| | | | | | | | some distributions (eg Ubuntu) don't provide xml executable, but only xmlstarlet executable Change-Id: Icc801ded8d4ec1ec4d1dab93289a2365f8cd9cbd Pick-to: 5.15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't change the implementation of a method depending on QT_USE_QSTRINGUILDERLars Knoll2020-05-261-23/+13
| | | | | | | | | | | | | | | | | | | | | | | This is rather evil and caused crashes in static builds, when library and application where compiler with different settings of the QT_USE_QSTRINGBUILDER flag. The reason is that the implementation of QStringDecoder::operator() was different (and returning different data) with or without the setting. The compiler would thus create two very different versions of this method in different .o files. When linking the app, one of the implementations would be chosen, leading to crashes in places where the other one was expected. Fix this by only providing the QStringBuilder enabled version of the methods. They return a temporary object that's converatable to a QString/QByteArray anyway. Make sure that qdoc shows a simple signature. As a drive by fix a compile error in a code path that didn't get hit so far. Change-Id: I312fa564d0bc6b464f2b4466de1d53841f7b7b0f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Initialize variableLars Knoll2020-05-261-1/+1
| | | | | | Change-Id: Ibcccd93fd4654a087c323fde08dbadb64d22156c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Document Qt 6 changes for QHash, QMultiHash, QSetKai Koehne2020-05-261-0/+47
| | | | | Change-Id: I9a83d33f05d7c3e5d23399129dfac45a1cb0d6ad Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add 'Qt Core Changes in Qt 6'Kai Koehne2020-05-262-0/+46
| | | | | | | | | Skeleton to document changes to Qt Core in Qt 6. Task-number: QTBUG-71036 Task-number: QTBUG-84051 Change-Id: I2720beffb934121258331efd9eeb91c07d40a5bf Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add a property to QSFPM to show children of accepted itemsGiulio Camuffo2020-05-262-8/+80
| | | | | | | | [ChangeLog][QtCore][QSortFilterProxyModel] Add a 'autoAcceptChildRows' property to always show children rows of accepted rows. Change-Id: I2402469ece438179d0f19888b9775cc27cf5c749 Reviewed-by: David Faure <david.faure@kdab.com>
* Change QString::toIntegral_helper to use QStringViewLars Knoll2020-05-252-26/+25
| | | | | | | This implicitly makes it use qsizetype for the length. Change-Id: Ib39a5a8dd71e48b45179079f7c7fe5e4edbdb5eb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cleanup header fileLars Knoll2020-05-251-104/+0
| | | | | | | | | Remove dead code Change-Id: I315f9ae2f098b1a7b72d7cd24161325822c62edd Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QItemSelectionModel: simplify QItemSelectionRangeChristian Ehrlicher2020-05-232-31/+1
| | | | | | | | Simplify QItemSelectionRange by removing the unneeded user-defined functions - the compiler can generate them by it's own. Change-Id: I49c00f937df98bb1ad18057b7bae7a0e06919909 Reviewed-by: David Faure <david.faure@kdab.com>
* Models: remove version check for clearItemData()Christian Ehrlicher2020-05-232-4/+0
| | | | | | | The version checks for clearItemData() are no longer needed now. Change-Id: I5052188fb96cf637128662f3442d339820f0f41d Reviewed-by: David Faure <david.faure@kdab.com>
* Licenses: Remove reference to change in Qt 5.4Kai Koehne2020-05-221-3/+2
| | | | | | | Qt 5.4 is not documented anymore since quite some time. Change-Id: I6811ead502178f7acbed8cf450e42d7fd33ae29b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Adjust resize() behavior of QString and QByteArray to match Qt 5Lars Knoll2020-05-212-25/+7
| | | | | | | | | | | | | resize() to a smaller size does not reallocate in Qt 5 if the container is not shared. Match this here. As a drive-by also fix resize calls on raw data strings to ensure they are null terminated after the resize. Change-Id: Ic4d8830e86ed3f247020d7ece3217cebd344ae96 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Extend QTypeInfoMerger to more than four argumentsMarc Mutz2020-05-191-15/+11
| | | | | | | | | | | Use template argument pack and C++17 fold expressions. Because MSVC doesn't grok fold expressions in enumerator-definition contexts, use static constexpr bool variables. Change-Id: I13a676d9be687679ef41f7b003e50116c4cd533c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Sweep Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6 -> Q_DECLARE_SHAREDMarc Mutz2020-05-196-6/+6
| | | | | | | | | | | | This is Qt 6, so Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6 is the same as Q_DECLARE_SHARED. Let's hope we'll collectively get better at detecting missing Q_DECLARE_SHARED so we won't need a Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT7 in the future. Change-Id: I3da9faff4c66b64a3b257309012a2a10a6c6d027 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Generate information about 3rdparty libs in module .pri filesJoerg Bornemann2020-05-191-11/+15
| | | | | | | | | | | | | For modules that are not yet ported to CMake and that use QMAKE_USE += libfoo we need to provide the information about libfoo in the qt_lib_XXX.pri files. Also, we now generate qt_ext_XXX.pri files for bundled 3rdparty libs. Task-number: QTBUG-75666 Change-Id: I9e4b057a197554ecb37c294c0bf09e2a2b3aa053 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix relocated Qt to be found when its path has non-ASCII charactersAlexandru Croitor2020-05-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | The path returned by dladdr seems to be encoded with the current locale encoding which means that if it contains unicode characters, the fromLatin1() call mangles the path, and QFile::exists reports that the path does not exist. To preserve non-ASCII characters use fromLocal8Bit() instead. This should fix the runtime issue of finding the Qt prefix when the Qt library path has non-ASCII characters. Amends 2f52afda8e77429c00029f94e887ed37dfb4e584. Amends 4ac872639ed0dd3ae6627e05bdda821f7d128500. Fixes: QTBUG-84272 Task-number: QTBUG-15234 Pick-to: 5.14 5.15 Change-Id: I37019ed219cf2cf7d9663cb1e16acdb97b3bdf09 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: throughly port internals to char16_tMarc Mutz2020-05-194-108/+76
| | | | | | | | | | This includes allocating QString data as char16_t instead of ushort. This isn't the end of the port, but an important milestone: the traditional foldChar() functions are now all unused. Change-Id: I766bebc2d70b6972e2045d3474c7f5770f4676d9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.15' into dev"Liang Qi2020-05-192-2/+7
|\
| * Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-05-182-2/+7
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/text/qbytearray.cpp Change-Id: I63706409464d31391012bacdadfd1f6300509787
| | * Merge remote-tracking branch 'origin/5.15.0' into 5.15Qt Forward Merge Bot2020-05-142-2/+7
| | |\ | | | | | | | | | | | | Change-Id: I06396fa0a3d1687a0935e48d290358edbb0e59e8
| | | * qstandardpaths_win.cpp: Fix GetCurrentProcessToken() for Win7v5.15.0-rc2Fredrik Orderud2020-05-071-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GetCurrentProcessToken() was made an inline function for Windows 8. Expand it to ensure builds work independent of WINVER and disable low integrity support for Windows 7. Fixes: QTBUG-83941 Task-number: QTBUG-83453 Change-Id: Ic989f16621cd80cbc70c6b62779afab8a12714df Reviewed-by: Fredrik Orderud <forderud@gmail.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | | * QCborValue: catch overflow in QByteArray when decoding chunked stringsThiago Macieira2020-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We checked against integer overflow, but not against overflowing the QByteArray size limit. That caused a std::bad_alloc to be thrown, which is bad when decoding unknown data. QCborStreamReader wasn't affected, since it doesn't merge chunks. Change-Id: I99ab0f318b1c43b89888fffd160c36f495fada87 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
| | * | Small fixes for the Q*Ref deprecation stuffMarc Mutz2020-05-141-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - don't force the deprecation sentence into a separate memory location (gives the compiler more leeway in how to lay stuff out) - split the switch (will be useful when extending) - fix a spelling mistake in one of the messages Change-Id: Ied137dc8eee7047177983660e1a6776a0bf46bde Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| | * | Fix QRunnable::ref use in QThreadPoolAllan Sandfeld Jensen2020-05-122-26/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reference counter could only ever be -1, 0 or 1, as an autoDeleted QRunnable can only be in a single thread pool. This commits keeps the reference counting for now, but asserts sanity, simplifies locking and fixes a leak. Pick-To: 5.15 Fixes: QTBUG-20251 Fixes: QTBUG-65486 Change-Id: I4de44e9a4e3710225971d1eab8f2e332513f75ad Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit 891b60bbc84ddde077072df3426539c716d47459)
* | | | webOS: Fix allocateTimerIdJani Hautakangas2020-05-181-1/+8
|/ / / | | | | | | | | | | | | | | | Change-Id: I8b3777f4035401763d86b0245de43b63573b9ea6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | Cleanup qUncompressLars Knoll2020-05-171-21/+8
| | | | | | | | | | | | | | | | | | | | | | | | Cleanup the code in qUncompress and make use of QArrayDataPointer to keep track of memory. Change-Id: I2c11f0468813698d2b7c25acd0f8786a289739a0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Don't access QArrayData::sharedNull() from QByteArray anymoreLars Knoll2020-05-171-4/+2
| | | | | | | | | | | | | | | | | | Change-Id: I1292f8d2d62fa96ae4c6aa91c7c95c1f3a18570f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | QChar: make fullConvertCase()'s result type more usableMarc Mutz2020-05-172-15/+22
| | | | | | | | | | | | | | | | | | | | | | | | Move it into the function, give it an explicit size and make it iterable and indicate to QStringView that it's a compatible container. Change-Id: I483d9225ac73ad93f2037489f2d32473c377e8b7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | | Add central macro to disable float comparison warningsMarc Mutz2020-05-161-0/+6
| | | | | | | | | | | | | | | | | | | | | QParsedNumber will need it, as do some others, like QAngle. Change-Id: Iee09f498d2cdbb28d43b94301328ec7858661ad2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Add support of cancellation handler callbacks to QFutureSona Kurazyan2020-05-155-18/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | Added QFuture::onCanceled() method, for attaching handlers to be called when the QFuture gets canceled. Change-Id: I1f01647d6173ba0c1db6641e14140108b33ac7c4 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | Add support of connecting signals to QFutureSona Kurazyan2020-05-153-1/+169
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduced QtFuture::connect(sender, signal) function returning a QFuture object, which is resolved when the signal is emitted. Task-number: QTBUG-81589 Change-Id: Idbe301eb247b468b9b34f3470c3359d6a7af2f3a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | | QTaggedPointer: some API cleanupsMarc Mutz2020-05-152-31/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - don't refer to the class with template arguments in the body of the class (incl. one where we got the template args wrong) - make namespace-level swap a non-member friend - make default ctor constexpr and non-explicit (default ctors should never be explicit) - make ctor from std::nullptr_t constexpr - remove op= from std::nullptr (will be handled by op=(T*) anyway) - pass QTaggedPointer by value (it's a Trivial Type, so can be passed in registers) - fix missing QTypeInfo for non-default Tag types - remove unused include limits.h - make qHash-able (why is the tag ignored?) Change-Id: Idee1d685ac365c988698a8637fd5df3accfc1396 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QMetaType: Support char16_t and char32_tFabian Kosmale2020-05-153-1/+58
| | | | | | | | | | | | | | | Change-Id: Ieec6d4bc64967d875ea12b31638aab05bc682ea3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | CMake: Enable default usage of utf8 sources for Qt consumersAlexandru Croitor2020-05-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And enable the same default when building Qt itself (it's implicit). Allow opting out on a target-by-target basis, by using the public qt_disable_utf8_sources() API call. Change-Id: Ifc19a744d57b96b1c74a6926a0c6628c2a820464 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* | | QString: remove more functions overloaded on charMarc Mutz2020-05-152-38/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These functions mess in bad ways with the overload set (they, fatally, attract char16_t, e.g.). The no-ascii warning now comes from the QChar(char) constructor, so it's not lost. [ChangeLog][QtCore][QString] Also removed op=(char), op+(char, QString), op+(QString, char). Change-Id: I1471c9ddb4c6869aff6e527516e2c78b80b7d7d3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QString: fix an aliasing issue in remove(QString)Marc Mutz2020-05-151-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even in Qt 5, remove() can be passed an alias to *this. In Qt 6, with the advent of substring sharing, this will become even more pronounced. Use the same fix as was already used in QString::insert(). Pick-to: 5.15 Change-Id: I1a0d3d99fd7dff6e727661646d2cbfdc94df2682 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | QString: fix quadratic behavior in QString::remove(QString)Marc Mutz2020-05-141-10/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling linear-complexity remove(int, int) in a loop is O(N²). Fix by implementing a remove_if()-like algorithm which ensures each character is written at most once, which is linear. [ChangeLog][QtCore][QString] Fixed quadratic worst-case complexity of remove(QString). The function now has linear complexity in all cases. Pick-to: 5.15 Change-Id: I12f70fbc83fb5da4a9aae4bd02f525d7657cc940 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>