summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
Commit message (Collapse)AuthorAgeFilesLines
* QUtf8StringView: ensure binary compatibility throughout 6.xv6.1.0-rc1Thiago Macieira2021-04-203-32/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | We can't depend on whether the user compiles with -std=c++17 or -std=c++20. So select what we can depend on and make that permanent. Prior to this change: $ cat /tmp/test.cpp #include <QtCore/QUtf8StringView> void f(QUtf8StringView) {} $ qcd include $ g++ -S -o - -I. /tmp/test.cpp | grep globl | c++filt .globl f(QBasicUtf8StringView<false>) $ g++ -fPIC -std=c++20 -S -o - -I. /tmp/test.cpp | grep globl | c++filt .globl f(QBasicUtf8StringView<true>) After this change, they're both "false". QUtf8StringView should have been a concrete class that derived from QBsicUtf8StringView<whichever> and inherited all its constructors. We'd cause ODR violations in C++20, but nothing worse than what we usually do for BC reasons. That solution is too late for Qt 6.x. Let's revisit in 7.0. Pick-to: 6.1 dev Change-Id: I6bcbe88c072a438b8b4efffd166e77199ecb39e3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QString: add missing char8_t* constructor / fromUtf8 overloadsGiuseppe D'Angelo2021-04-192-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we support: QString s = QString::fromUtf(u8"foo", 3); But we don't support QString s = QString::fromUtf8(u8"foo"); QString s(u8"foo"); There's no reason not to have these two functions. Guess what, we've actually got code _in Qt_ that tries to build a QString out of a char8_t; that code stops compiling under C++20 (which is supported, but not CI-tested at the moment, it seems). Re-add the missing constructor and fromUtf8 overloads. [ChangeLog][QtCore][QString] Added a constructor and a fromUtf8() overload taking a `const char8_t *` argument. Task-number: QTQAINFRA-4117 Task-number: QTQAINFRA-4242 Change-Id: I1f0ae658b3490b9e092941cabcc7fb8fc4c51aa3 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit b322bfcc14845a4b6a6eef85ef359b1e4591a5ca) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't access moved-from objectVolker Hilsheimer2021-03-041-7/+6
| | | | | | | | | | | | | | | | | | | | Clang's static analyzer tooling warns about this access-after-move [1]. While the comment above the function indicated that this was deliberate and relying on a moved-from QString being valid, it is still bad practice. Since 'str' is empty in moved-from state if - and only if - it was a non-const reference, make a compile-time check of the constness of type T instead. [1] https://testresults.qt.io/codechecker/daily_analyses/qtbase/dev/qtbase-dev-20210301-e14ccf0553/qstring.cpp_clang-tidy_b0545db57a2cc5dac67a56f76322ffd0.plist.html#reportHash=209ee3db0b17d21919326a1ad6635318 Change-Id: Iac1813b61b6a3c2ef4053b911a4043c5382f85e4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 49113c905d5868e6b76bb6b7b3e0a20b0c56a23a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Specification of pointer usageHou Lei2021-01-291-7/+8
| | | | | | | Avoid C-style casts when possible. Change-Id: I8e86eb8c439b456da41d52a5666190330edeeda2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: add move constructorIvan Solovev2021-01-262-6/+75
| | | | | | | | | | | | - Add move constructors to QRegularExpression, QRegularExpressionMatch and QRegularExpressionMatchIterator. - Update the documentation to explicitly state that only destructor and assignment operators can be called for a moved-from object Task-number: QTBUG-86634 Change-Id: I06b4f54e300541033a9a18339c97338717a06da0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QLocale: Allow direct conversion from language, country, and script codesKai Köhne2021-01-253-7/+51
| | | | | | | | | | | | | | | This complements patch a148c7b5d71d244, where languageToCode(), countryToCode() scriptToCode() methods were introduced, with matching codeToLanguage(), codeToCountry(), and codeToScript() methods. This allows us to remove the use of private Qt Core API in Qt Linguist. [ChangeLog][QtCore][QLocale] Added static codeToLanguage(), codeToCountry(), codeToScript() methods that convert ISO code strings to the respective enum values. Change-Id: If5c0843a718c006ade086a6f74ceb86ac6e0fce4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QLocale: add a Q_CHECK_PTRGiuseppe D'Angelo2021-01-201-0/+1
| | | | | | | | | Avoid complaints from static analyzers that the pointer returned by malloc might be null. Change-Id: I3ec3ba03d0b5283dd569200a3040a5fe5990f763 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Build fixes for GCC 11Ville Voutilainen2021-01-192-0/+3
| | | | | | | Task-number: QTBUG-89977 Change-Id: Ic1b7ddbffb8a0a00f8c621d09a868f1d94a52c21 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocale: Allow direct conversion to language, country, and script codesKai Köhne2021-01-182-2/+49
| | | | | | | | | | | | | | | | | | | | Currently the codes are only exposed in aggregated form, i.e. through name(), bcp47Name(). There are use cases though where you are only interested in either language, country, or script codes. One example is in Qt Linguist. This patch therefore exposes the static languageToCode(), countryToCode(), scriptToCode() methods that were so far only available in the private API also in the public API. [ChangeLog][QtCore][QLocale] Added static languageToCode(), countryToCode() scriptToCode() methods that convert enum values to the respective ISO code strings. Fixes: QTBUG-39542 Fixes: QTBUG-64942 Change-Id: Ib1d5c3293e2f53245ba4c1fc8159275bcb290080 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Minor tidy-up: two sizetype fixes, two \nullptr usesEdward Welbourne2021-01-082-4/+4
| | | | | Change-Id: I6c4a1296350ecaf9a661dba22670fbb2ad23bd77 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Mark places where we missed conversion to unicode character typesEdward Welbourne2021-01-083-6/+6
| | | | | | | | | | | We should use char32_t for the toUcs4() methods of QString and QStringView and use char16_t for QString::utf16(), thereby matching QStringView. These naturally imply knock-on changes in various places. Unfortunately, we didn't make those changes in Qt 6, so they'll have to wait for Qt 7. Change-Id: I18451d4b31b76658092e19d3fcbc8bc0fe5ce307 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-071-90/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QLocale: Remove dead codeKai Köhne2021-01-062-12/+0
| | | | | | | The code using it got removed in qttools commit 01da5d9a Change-Id: I14d36ac939f2647139fcc42591a044a03e707553 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QRegularExpression: mention raw string literal in the docsAhmad Samir2020-12-281-0/+8
| | | | | | | | | | | | | | Raw string literals (since C++11 according to [1]), make writing/reading regex patterns easier, since one can just use e.g. "\w\d" without having to escape those backslashes e.g. "\\w\\d"; this is especially useful with longer/more complex regex patterns. [1] https://en.cppreference.com/w/cpp/language/string_literal Pick-to: 5.15 6.0 Change-Id: I119f9566d27222b915af931ee7e13e064baede61 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* QString: update documentationIvan Solovev2020-12-151-117/+212
| | | | | | | | | | | | | | The QString documentation is aligned with QList regarding common wording and ideas: - Extend general class description - Revise description of several methods - Fix examples to use qsizetype instead of int - Wrap descriptions at 80 characters Pick-to: 6.0 Task-number: QTBUG-87962 Change-Id: I7d5a7e829ce8b98a0a1a7fae6b7ae0dec4effbae Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QStringView: add constBegin and constEndThiago Macieira2020-12-122-4/+23
| | | | | | Change-Id: I55083c2909f64a1f8868fffd164f21118a9d3ec5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Assert validity in QStringIterator's unchecked methodsEdward Welbourne2020-12-111-6/+18
| | | | | | | | | | These methods should never be used on strings not known to be valid UTF-16. Their optimizations will produce undefined behavior otherwise. Change-Id: I03a95140dcbdd1f7189eea1be69289ce227331a5 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Workaround bogus compiler warningFabian Kosmale2020-12-101-1/+10
| | | | | | | | | gcc 9.x (but not 10.x) issues a bogus warning when strlen is used on a string literal; disable the warning for those versions. Upstream bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91490 Change-Id: I7a2a4d0f6ddafcafcd9fcc62fc41ad5d78e61627 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QStringView: add some QRegularExpression-related overloadsGiuseppe D'Angelo2020-12-104-0/+176
| | | | | | | | | [ChangeLog][QtCore][QStringView] Added the indexOf(), contains(), lastIndexOf() and count() methods taking a QRegularExpression. Fixes: QTBUG-89050 Change-Id: Ic726754f67e06b3764302d2fad252e0378a77afc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString::lastIndexOf: fix off-by-one for zero length matchesGiuseppe D'Angelo2020-12-101-2/+2
| | | | | | | | | | | Otherwise, it would report that lastIndexOf of an empty pattern in an empty string doesn't exist. Next commit adds extensive autotests; for now, disable a broken autotest (which already features a comment about why it's broken). Change-Id: I9a0e5c0142007f81f5cf93e356c8bd82f00066f7 Pick-to: 5.15 6.0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStringConverter: add comments marking the BOM checks and emissionsThiago Macieira2020-12-091-0/+5
| | | | | | | | Because obscure cultural references never go out of style. https://twitter.com/steveklabnik/status/1327745325688365056?s=21 Change-Id: Idbe0d2174d4943d1865cfffd1647dd3a18af1801 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QString: fix count(QRegularExpression)Giuseppe D'Angelo2020-12-091-3/+9
| | | | | | | | | | | | | | | | | There is an off by one in the implementation of count(): a match must be attempted even at the very end of the string, because a 0-length match can happen there. While at it, improve the documentation on the counter-intuitive behavior of count(), which doesn't merely count how many times a regexp matches into a string using ordinary global matching. [ChangeLog][QtCore][QString] Fixed a corner case when using QString::count(QRegularExpression), causing an empty in the last position not to be accounted for in the returned result. Change-Id: I064497839a96979abfbac2d0a96546ce160bbc46 Pick-to: 5.15 6.0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: improve lastIndexOf(QRegularExpression) docsGiuseppe D'Angelo2020-12-091-0/+4
| | | | | | | | | | | Due to how regex matching works, lastIndexOf has to be implemented by matching from the string's beginning until the from position is reached. This might not be obvious for users, so document that. Task-number: QTBUG-89050 Pick-to: 5.15 6.0 Change-Id: I4b69ea753e7d417d980031926f1e01d77e58720d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix qdoc warning from incorrectly named method parameterVolker Hilsheimer2020-12-081-2/+2
| | | | | | | | | | | Amends 2eb7d6073d5132a8bf269f5c6fc9f89fde446ab5. Pick-to: 6.0 Task-number: QTBUG-87962 Change-Id: I55c9e8cf7db9e1e1644a76f29a9dc61b161ae551 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix MSVC warning C4267 in qstring.cppKai Koehne2020-12-081-2/+4
| | | | | | | | | | | | | | | | Fix warnings qstring.cpp(9650): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data qstring.cpp(9654): warning C4267: 'argument': conversion from 'size_t' to 'uint', possible loss of data QDataStream::writeBytes expects an uint as second parameter, not size_t. This reverts parts of 744e55b85a96b37a, where the explicit cast to size_t was introduced. Pick-to: 6.0 Change-Id: I2750a6f48fc09730aa9fa21dcc31f82e33b48b8b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Inline QCollator's QString methods via QStringViewEdward Welbourne2020-12-072-10/+6
| | | | | | | | | | Can't be done before Qt 7 unless we do it now, as it'd be BiC. Task-number: QTBUG-86400 Change-Id: Ib7b2e7b20b4a80b53dfc6535efe90d1674f38e81 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 53a1e015fdb4082900f306b5e2cca7bd5df77d03) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QByteArray: update documentationIvan Solovev2020-12-051-69/+147
| | | | | | | | | | | | | The QByteArray documentation is extended to align with QList and QString regarding common wording and ideas: - Extend general class description - Revise description of several methods - Wrap descriptions at 80 characters Pick-to: 6.0 Task-number: QTBUG-87962 Change-Id: Ie9e8ef47a85d0867c2fa63889a60cafbe76ee47a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString/QByteArray: add missing Q_CHECK_PTRThiago Macieira2020-12-042-0/+15
| | | | | | | | | | | | | | So these two classes throw when trying to allocate silly sizes or in OOM conditions. We probably want to move these Q_CHECK_POINTER into QTypedArrayData but I didn't want to do that in this commit. Task-number: QTBUG-88256 Task-number: QTBUG-88253 Change-Id: Ifc61bb80b9bf48a386abfffd1648176111770174 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use (new) erase()/erase_if() algorithmsMarc Mutz2020-12-051-15/+2
| | | | | Change-Id: I45c18fd45c20b226e44d16315e3ebb6c305d4ab0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Indicate the limited locale selection in the POSIX backendEdward Welbourne2020-12-041-2/+3
| | | | | | Change-Id: I82798de7ff313121144798969eed85c23e852d10 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix documentation of QStringTokenizerAndreas Buhr2020-12-032-12/+28
| | | | | | | | | | | | Documentation of QStringTokenizer was broken, mainly because most parts of the interface were defined in base classes. This patch gets those members into QStringTokenizer itself in order to document them. Task-number: QTBUG-88533 Pick-to: 6.0 Change-Id: Id00a79db4b293958a9c5ed53a518a97721d228c0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix documentation warnings about QCollator propertyAndreas Buhr2020-12-031-2/+2
| | | | | | | | | | | | The documentation of ignorePunctuation in QCollator did not strictly follow conventions, leading to warnings in building the documentation. This patch fixes this. Task-number: QTBUG-88533 Pick-to: 6.0 Change-Id: Ia1273ec8e440099afe729b54423760ad5ac26290 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRE: discourage users from assuming that QRE stores the subjectGiuseppe D'Angelo2020-12-031-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | When matching over a QString we store a (shallow) copy of it. That has always been an implementation detail and people should've never relied on it, but Hyrum's law, we don't want to actually exploit this by NOT taking the copy. Converesely, matching over QStringView already requires that the string data is kept alive as long as QRE(Match) objects are alive. Add a doc note to give us the freedom to do the change in Qt 7. [ChangeLog][QtCore][QRegularExpression] QRegularExpression takes a shallow copy of a QString subject when matching over it. This means that users can destroy or modify the string data while still having match results over it. This behavior is deprecated; in a future version of Qt, QRegularExpression will no longer take a copy. Note that behavior has always been undocumented and users were never supposed to modify a subject string while match objects were alive on it. In practice, it's very unlikely that your code is relying on the existing behavior. Change-Id: Ibc5f900c09a007139fb12fc4d7f11e4a8f31bf38 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString::fromUtf8: remove a stray cast to intGiuseppe D'Angelo2020-12-031-1/+1
| | | | | | Change-Id: I0dba7ba130c3fa96eda63a0fa1a39c5f0bb863b7 Pick-to: 6.0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRegularExpression: plaster some [[nodiscard]]Giuseppe D'Angelo2020-12-031-0/+5
| | | | | | | On some of the "most important" API. Change-Id: I800b53bb7b9a95d0184f813e7ba501a7ebd485c0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: plaster more and more [[nodiscard]]Giuseppe D'Angelo2020-12-031-22/+22
| | | | | | | The situation was quite inconsistent. Use the attribute more. Change-Id: If21817b4c2ea1148ad4ad80e7a50fab721a58b65 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLatin1String: documentation updatesIvan Solovev2020-12-021-61/+246
| | | | | | | | | | | | | | | Some updates for QLatin1String documentation: - Update signatures of some methods - Update outdated description for several methods - Add missing docs for friend operators - Wrap descriptions at 80 characters Pick-to: 6.0 Task-number: QTBUG-87962 Change-Id: I1c3c5ce2a6f4f57f92ab503a734c8244fe7cd7c5 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString/QByteArray: add erase/erase_ifGiuseppe D'Angelo2020-12-014-0/+100
| | | | | | | | | | | | | [ChangeLog][QtCore][QString] Added erase() and erase_if() for consistent container erasure. [ChangeLog][QtCore][QByteArray] Added erase() and erase_if() for consistent container erasure. Change-Id: I23e8565d39044c1f1d756500589c1f2b65e1a88f Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-304-4/+4
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Fix warning about copy during range iterationTor Arne Vestbø2020-11-271-1/+1
| | | | | | Pick-to: 6.0 Change-Id: I6c916d79a5e86502a1fdfd5f2b851f4a4396149a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make QCollatorSortKey's operator<() a hidden friendEdward Welbourne2020-11-271-6/+3
| | | | | | | Documentation change to follow, as part of a QCollator doc overhaul. Change-Id: Ie8d3df15a6c0f86b611a8866adf12f3355cc9710 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Clean up QCollator's documentation and tell fewer liesEdward Welbourne2020-11-271-53/+58
| | | | | | | | | | | | | | | | | | | | Its collation strategy can't be passed to the constructor, so describing it as initialized with a strategy was misleading. The "Linux without ICU" disclaimer was poorly phrased and only mentioned on one of the options; it actually applies to all. The operator() was marked internal, but the class doc's claim that QCollator can be used with std::sort() relies on it being callable. Moved option descriptions to the getters and filled in the missing ones. Mention the default in all cases. Added a minimal illustration of how to use a QCollator. Fixes: QTBUG-72233 Change-Id: Ifa846eca05e8e42aaa08c4947a59a82d8a8a79bc Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix spacing in QCollator documentationEdward Welbourne2020-11-271-19/+19
| | | | | | | | | Many doc-comments had their end-comment marker indented. Keep separate from real doc changes, to appease the inanity 'bot. Task-number: QTBUG-72233 Change-Id: Id6b8244aeccd81ba7be461ec2b344910c106c17d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Return a more useful date-time on parser failure in spring-forward gapEdward Welbourne2020-11-271-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up to 5.15.0, QDateTime::fromString(), when parsing a string that matched the format but represented a date-time in a spring-forward's gap, would return an invalid date-time object that represented a "best shot" date-time, correcting the error in the string as best it could. In 5.15, in order to handle time-spec information correctly, we adapted the date-time parser to have a fromString() variant that parsed a date-time as a whole, rather than as a date and a time; as a result, QDTP::fromString() now returns false and QDT::fromString() returned a default-constructed instance instead of the invalid date-time that QDTP had produced. Amend 76054516047d8efb8529443830bb4d9ddf01010f to restore the prior behavior of returning the invalid date-time object from QDTP instead of a default-constructed invalid date-time. Also document what this implies for the caller's ability to recover from the situation, if a best shot result is better than nothing. [ChangeLog][QtCore][QDateTime] Restored pre-5.15.0 behavior when parsing a date-time from a string (and document what it implies): if the string has the right form but represents a date-time that was skipped by a time-zone transition (e.g. a DST spring-forward), the invalid date-time object returned can, none the less, be used to recover a near-by date-time that may be more useful in some cases. From 5.15.0 to 5.15.2 and in 6.0.0, a default-constructed QDateTime was returned in place of this more informative invalid date-time. Task-number: QTBUG-88633 Pick-to: 6.0 5.15 Change-Id: If0b439038d5fe48eefb951c62f3aae2933bb5651 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mark two impossible code-paths with Q_UNREACHABLEEdward Welbourne2020-11-272-2/+3
| | | | | | Change-Id: I8c04f512b078d4c13d759854b65f4d39b7b80e75 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Doc: Consistently use book style capitalization for QStringKai Koehne2020-11-271-2/+2
| | | | | | Pick-to: 5.15 6.0 Change-Id: I2ab64fe58ad737b23f0829ed91591efaa0c22c6f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Linkify all mentionings of QT_NO_CAST_TO_ASCIIKai Koehne2020-11-271-134/+66
| | | | | | | | | This way the user can directly click the link, instead of looking at the 'see also' section. Pick-to: 6.0 Change-Id: I50b62fe0b376a3f6462c11abc46a001c334ba82a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Improve *_CAST_FROM_ASCII documentationKai Koehne2020-11-271-14/+9
| | | | | | Pick-to: 5.15 6.0 Change-Id: Iba73c0a38e2c4add740aab20036aa39c56eb4d98 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QString/QByteArray: add erase() for iteratorsGiuseppe D'Angelo2020-11-264-0/+32
| | | | | | | | | | | | | Otherwise they're not usable with iterator-based algorithms that e.g. remove, partition and the like. [ChangeLog][QtCore][QString] Added erase(). [ChangeLog][QtCore][QByteArray] Added erase(). Change-Id: I78829b1a5365dd53b6b6423ceedbc52edeafbc63 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Clean up docs of QCalendar-related QLocale::toString() variantsEdward Welbourne2020-11-232-45/+63
| | | | | | | | | | | | | Some of the new functions were added without documentation, or without updating the docs to mention the optional calendars. Shuffle the methods so that the one with calendar is what the primary documentation comment describes and the one without is documented as an overload. Pick-to: 5.15 Change-Id: Iee4cdb1d3b0ed21a50e205a5275a0695a2667550 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>