summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix potential memory leak by adding a virtual destructor to AnchorVertexVolker Hilsheimer2020-05-121-17/+18
| | | | | | | | | | | | | | | | | | The subclass AnchorVertexPair is allocated and passed around as pointers to AnchorVertex, and placed in lists that are then later cleaned up via qDeleteAll. This very likely results in memory leaks, as the compiler- generated ~AnchorVertexPair destructor is never called. Add a virtual destructor. Since there now is a vtable generated for AnchorVertex, remove the m_type member (which is only used for string generation in debug builds) and make toString virtual instead. Change-Id: I2cf184c0b1da1bd59b056a0f696a0e5479d4cb4e Fixes: QTBUG-84094 Coverity-Id: 218707 Pick-to: 5.15 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* MSVC: Fix build with -developer-buildEskil Abrahamsen Blomfeldt2020-05-121-2/+2
| | | | | | | | Passing 0xA7 to a signed char causes a truncation warning with MSVC2017. Make the cast explicit. Change-Id: Ief1a97c52544b271556811816f7804074bd336df Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Port qustrlen and qustrchr to char16_tMarc Mutz2020-05-124-19/+19
| | | | | | | Fix callers. Change-Id: Iaf604c890941aa3de3bd31da300b2066e65968ed Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace some QString::fromRawData() with QStringViews around the codeMarc Mutz2020-05-124-4/+4
| | | | | | | | | Even though QString::fromRawData() may not be as expensive as it used to be, it's still and out-of-line call _and_ more characters to type, so replace with QStringView construction where applicable. Change-Id: I70662da1bd45284f67e117e92b25d242afb8aaf8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Teach QDateTimeParser some common time-zone offset formatsAndrei Golubev2020-05-123-60/+141
| | | | | | | | Fixes: QTBUG-83687 Fixes: QTBUG-83844 Pick-to: 5.15 Change-Id: Ia1c827017b93cf8277aa5a0266805d773d2d9818 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Cache QUrl::idnWhiteList() absent user_idn_whitelistMarc Mutz2020-05-121-7/+10
| | | | | | | | | | | | Instead of creating a QStringList from a static array anew for each call, cache the result in a static variable. If we have to pay for the overhead of implicitly-shared classes, we should at least reap the benefits, too. Use IILE to gain automatic thread-safety (thread-safe statics). Change-Id: Ib92dd9cb85f84e013f98ca81565cc392bb39e76b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Specify QTextOption behavior in drawTextPaul Wicking2020-05-121-1/+2
| | | | | | | | | | Be more specific about overriding behavior when using the drawText overload that takes a QTextOption argument. Fixes: QTBUG-41894 Pick-to: 5.15 Change-Id: I8b38cb383005f1a07f4c6d70050e0d2cbb551521 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Doc: fix QRandomGenerator code snippetsTasuku Suzuki2020-05-121-4/+4
| | | | | | | | Use the static global instance to call bounded() and fillRange(). Pick-To: 5.15 Change-Id: I91678b7c985ab9d0dcdf09aadad6cb8f495c02cd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Close memory leak in QTestLib support for item model testingVolker Hilsheimer2020-05-121-4/+14
| | | | | | | | | | | | QTest::toString allocates memory by calling qstrdup; that memory must be freed by the caller. Change-Id: I218bc57b3312fdd9195fb49eaed7d20df4bf717c Fixes: QTBUG-84081 Coverity-Id: 186979 Covierty-Id: 186980 Pick-to: 5.15 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QtCore: use new QChar::fromUcs{2,4}()Marc Mutz2020-05-124-16/+7
| | | | | | | | | | Also replace one case of QChar(0) with QChar::Null. These were errors in my local tree, which means they're included in bootstrap builds (incl. qmake). Change-Id: I3dffa9383fd1a30aa43fe2491ad95bb2b1869b40 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Sweep of int-ish → char-ish types near calls to QString::fromU*()Marc Mutz2020-05-124-7/+7
| | | | | | | | | | | | The fromUtf16(ushort*) and fromUcs4(uint*) overloads are going to be deprecated. Use the newer fromUtf16(char16_t*) and fromUcs4(char32_t*) overloads. As a drive-by, use std::end()/std::size() where applicable. Change-Id: I5a93e38cae4a2e33d49c90d06c5f14f7cb7ce90c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use QChar::fromUcs4() moreMarc Mutz2020-05-122-3/+5
| | | | | | Change-Id: I02be41de92d84145186de9ac5f5ea3541a941964 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QUrlQuery: improve defaultQuery{Value,Pair}Delimiter()Marc Mutz2020-05-122-6/+8
| | | | | | | | | | | | | | - constexpr - noexcept - return char16_t (this converts implicitly to QChar, but allows use elsewhere, too) [ChangeLog][QtCore][QUrlQuery] The defaultQueryValueDelimiter() and defaultQueryPairDelimiter() functions now return char16_t instead of QChar. Change-Id: I4662f832a89ae9f4a984ea9349b5e0e212a09c95 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QUrl: replace some lower-case macros with functionsMarc Mutz2020-05-121-3/+5
| | | | | | | It's cleaner. Change-Id: Ib2297b905f5dd242c5e7ab431393398e7c93ecbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix coverity warnings about uninitialized data membersVolker Hilsheimer2020-05-122-2/+2
| | | | | | | | | | | | | | | | | | | Coverity alerts about uninitialized members. While this might be ok in the code here (ie TreeNode::splitLeft is never used for leaf nodes) it can easily result in undefined behavior and other hard-to-debug issues. Initializing the struct with initializer syntax; compiler explorer indicates that the compile will be able to optimze the calls to avoid duplicate initialization of data members. Change-Id: I0eb5d26e34f466d8c659c1945f02601aef511fbf Fixes: QTBUG-84160 Fixes: QTBUG-84156 Coverity-Id: 218601 Coverity-Id: 11398 Pick-to: 5.15 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Rhi: improve qHash implementationsGiuseppe D'Angelo2020-05-122-5/+26
| | | | | | | | Use the combiners and an algorithm. Change-Id: I577950bbd2e8b0556f28e2a8381e432c22bb0dc9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Long live qHashMulti(Commutative)Giuseppe D'Angelo2020-05-129-47/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a helper function so that we have a shortcut. Instead of writing: QHashCombine hash; seed = hash(seed, fieldA); seed = hash(seed, fieldB); // etc. return seed; one can now simply write: return qHashMulti(seed, fieldA, fieldB, fieldC); Port a few usages inside qtbase as a demonstration. [ChangeLog][QtCore][QHash] Added the qHashMulti and qHashMultiCommutative functions as convenience helpers to calculate a hash from multiple variables (typically, data members of a class). Change-Id: I881a9ad41168df20ceecc6588a94abe7ddc6a532 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* qmake: Remove the DISCARDABLE flag for icon resourcesYuhang Zhao2020-05-111-1/+1
| | | | | | | | | | According to [1] the DISCARDABLE attribute is for 16-bit Windows, and it is ignored. We can drop it. [1] https://docs.microsoft.com/en-us/windows/win32/menurc/common-resource-attributes Change-Id: I70e5b0441a9d20f6c76c3d7a84947f8bce5c8fbd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Add more entries for rc filesYuhang Zhao2020-05-111-1/+31
| | | | | | | | | As what we did for QMake. Amends commit 317383217baa280b7e7401a5adc4ce976320e272 Change-Id: Iab3b755193b5483362896da20a03fe2d59f37192 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* qmake: Update the macro namesYuhang Zhao2020-05-121-2/+2
| | | | | | | | | | | | | | | | I generated a rc file using VS2019 and I found that it's using other macros. According to [1], both of VOS_NT_WINDOWS32 and VOS__WINDOWS32 refers to "File was designed for 32-bit Windows", although they have different values, and 0x0L is the value of VFT2_UNKNOWN. So I think it's safe to update them. VS2019 is using them as the default template for rc files, after all. [1] https://docs.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource Change-Id: Ibaf91394668844492f1357da05b881b9d81aa15f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QDebug: sprinkle usage of QDebugStateSaverGiuseppe D'Angelo2020-05-111-12/+8
| | | | | Change-Id: I6dc134acca2bbc010139113f196869b36da9b240 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QDebug: clean up handling of QMap/QHashGiuseppe D'Angelo2020-05-111-17/+28
| | | | | | | | | Prepare for the fact that the multi-key containers will no longer inherit from the single-key ones. Refactor the code to follow the existing. Change-Id: I5fd4d7e33f8184c015e18e169af72e11a5e84f0d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* CMake: Workaround fix for failing RC file generation on WindowsAlexandru Croitor2020-05-111-2/+1
| | | | | | | | | | | | | | | For some reason the Help target doesn't get its RC file generated when building qttools, which leads to a build failure. We don't quite know yet why all this is happening, but a workaround fix seems to be to use an OBJECT library instead of an INTERFACE library to propagate the generated RC file. Amends 657fa0462d552110e2ba14bcac46275e6066993f Fixes: QTBUG-84155 Change-Id: I1e1c2f3b05bae2ed009020d031c6510a517c01ec Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* uic: Adapt to ActiveQt module restructuringFriedemann Kleint2020-05-111-11/+11
| | | | | | Task-number: QTBUG-78167 Change-Id: I827db1bf519a6ffcc609d215e08622bf910d519e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CA fetcher - do not add CA root if it's already presentTimur Pocheptsov2020-05-111-0/+2
| | | | | | | | | | | As it was found recently CA fetcher, while building a chain with a missing intermediary, may return the root we are already aware of (had in the "ROOT" store). While this is in general harmless, it can be a bit surprising if some code is analyzing the list of CA certificates after a handshake. Pick-to: 5.15 Change-Id: I1df3b537e2a812de17e2c94ad4643cf36e7e946f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Make qtbase compile without QT_CONFIG(timezone)Andrei Golubev2020-05-113-4/+12
| | | | | | | | Fixes: QTBUG-83795 Pick-to: 5.15 Change-Id: I05eaaf57d87a9111d3609ebab81bc707f8af98f0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QXmlStreamReader: port Private::put...() to QStringViewMarc Mutz2020-05-113-32/+28
| | | | | | | | This enables the use of QChar::fromUcs4() instead of QString::fromUcs4() in a call to putStringLiteral(). Change-Id: I6ed933cc92bfbb70ed2b168b7deeeb466bc6bfeb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QSettings: port iniUnescapedKey() from int to char16_tMarc Mutz2020-05-111-3/+3
| | | | | | | | | | The 'ch' never had to be a 32-bit variable. It only ever gets assigned 16-bit unsigned values, so make it a char16_t and thus implicitly convertible to QChar, even when QChar(int) is being deprecated or removed. Change-Id: I8391c393ca860f8f73f1495d7764dacd57275ea7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Update PCRE2 to 10.35Giuseppe D'Angelo2020-05-1142-3270/+4576
| | | | | | | | | [ChangeLog][Third-Party Code] PCRE2 has been update to version 10.35. Change-Id: I9793bdd3d25b88eea0d4479f544b297d065b5fb6 Pick-To: 5.15 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove dead code from src/widgetsVolker Hilsheimer2020-05-1133-268/+14
| | | | | | | | Code that's removed via QT_VERSION(6, 0, 0) check is already no longer compiled. Change-Id: I70865f330a6260ac2e9cf2770d599a5b6f7bb7d4 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QtGui: fix deprecated QChar conversionsMarc Mutz2020-05-1115-35/+30
| | | | | | | | | Conversions from non-char-types to QChar are going to be deprecated. Use QChar::fromUcs2(), fromUcs4(), QLatin1Char(), or convert the constructor argument to char16_t. Change-Id: Ib45ebd5560aa3a2bc460037ab09773607485c6e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QRegularExpression: cast to PCRE2_SPTR16Marc Mutz2020-05-111-4/+4
| | | | | | | | | | It seems that PCRE2_UCHAR16 is exactly ushort, even though it's documented to be uint16_t. There's no requirement for these to be the same type, nor for the PCRE typedef to continue to point to the same type, so add explicit casts. Change-Id: I89f65d29feaada84ea00688976a123364857bc58 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Split PixelLayout to separate source fileAllan Sandfeld Jensen2020-05-1114-1869/+1958
| | | | | Change-Id: I0beafa39d92550ea78e78a07b25ce1253cc6668d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QString: optimize insert() of a substringMarc Mutz2020-05-111-5/+2
| | | | | | | | | The old code malloc()ed a buffer to hold a copy of the data if a substring of *this was to be inserted. Instead, use a QVarLengthArray. Pick-to: 5.15 Change-Id: Ia3b4d7509bff2375ec0da5c890ecff2e9f7f335c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* eglfs: Send proper enter/leave events when multiple screens are in useShawn Rutledge2020-05-113-7/+19
| | | | | | | | | | | | | | | | | | | | Given that there is only one mouse (which might change some day, but hasn't yet), there can only be one window containing the mouse, regardless of which screen it's on. The implementation before was only able to send enter/leave events when moving from one window to another on the same screen; but we need the enter/leave events to be sent when moving between two full-screen windows on two screens as well. Also send an enter event the first time the mouse moves, to whichever window that happens to be. A Wayland compositor that renders its own cursor will need to know which screen is in use at the beginning. Pick-to: 5.15 Fixes: QTBUG-83973 Task-number: QTBUG-55161 Task-number: QTBUG-79924 Change-Id: Ie6f36cd33b103955a70bac73c1485bf475c08468 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Port QtPrivate::findString() from ushort* to char16_t*Marc Mutz2020-05-111-7/+7
| | | | | | | Lots of casts disappear... Change-Id: I21be426c9e4629657990ed4c896e4fce537aa1f0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Modernize foldCase() internal functionsMarc Mutz2020-05-112-1/+26
| | | | | | | | | Overload uint/ushort versions with new char16_t/char32_t ones, and [[deprecate]] the old ones. There's too much churn for doing the replacement in one patch. Change-Id: Ib1f90a1c46b80aa0fb1ea00ce614af49f49bd712 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QXmlStreamSimpleStack: port to qsizetypeMarc Mutz2020-05-113-29/+29
| | | | | Change-Id: Ie4ea7ca83dc1870d1a4a4cfbe4447b5d971b33bf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QXmlStream: use even more ranged for loopsMarc Mutz2020-05-111-4/+21
| | | | | | | | | Write a small range adapter that maps begin() to rbegin() and end() to rend() of the underlying range, use it to replace indexed reverse loops with ranged for ones. Change-Id: I5498a23106b0432ce885e72e5e3912910f50b5c1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port qt_to_latin1() (and it's variants) from ushort to char16_tMarc Mutz2020-05-113-15/+13
| | | | | Change-Id: Id341257f0ac1d6fd1d3176fb34fad253d2bddfb9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Adapt qxmlstream.g to older changes to qxmlstream_p.hMarc Mutz2020-05-101-2/+2
| | | | | Change-Id: I35c0700ed29d756949b95c3a26fdf9f087b5ef1c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QXmlStream: use more ranged for loopsMarc Mutz2020-05-103-18/+29
| | | | | | | | | More compact and isolates against decltype(size()) issues. Had to make QXmlStreamSimpleStack iterable. Change-Id: Icfa7b2ab09995c7a442fd8a5b2f5d6ce90120822 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QXmlStreamReader: avoid double QHash lookupsMarc Mutz2020-05-102-12/+12
| | | | | | | | | | | | | | | | | | | Replace if (hash.contains(x)) { // lookup #1 ~~~ hash[x]; // lookup #2 with if (auto it = hash.find(x); it != hash.end()) { // lookup ~~~ *it; // no lookup halving the number of QHash lookups. The container is not shared, so there's no danger of a detach when going directly to the non-const function. Change-Id: Ifae409f98e0be972b31a24326ad548723831fda8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port qt_from_latin1() from ushort to char16_tMarc Mutz2020-05-104-24/+28
| | | | | Change-Id: I054e2f604be7253d3322751d55d03b5bac09aefc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace uses of QString::fromUtf16(ushort*) with (char16_t*)Marc Mutz2020-05-103-6/+6
| | | | | | | | | Ditto fromUcs4(uint*) with fromUcs4(char32_t*). The ushort/uint forms will be deprecated. Change-Id: Ia4ce45ed8679951b24af13109e3e498f51fc3c89 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QXmlStreamReader: fix a qint64 -> int truncationMarc Mutz2020-05-101-2/+2
| | | | | | | | | QIODevice::read() returns qint64, not int, and nbytesread is qint64, too. Pick-to: 5.15 Change-Id: I6d41c5c656336a95bb115b461282e9f247493c25 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Correctly parse non BMP char refs in the sax parserLars Knoll2020-05-101-2/+12
| | | | | | | | Update the auto test accordingly, and at the same time remove all uses of QTextStream (as they aren't required). Change-Id: I71b7cf6a6b54ea59507f27d5d2d04cc5ae5885fc Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Clean up state handling for ICU and iconv based codecsLars Knoll2020-05-106-40/+39
| | | | | | | | Get rid of the hack for the FreeFunction and instead add a proper function pointer to clear the data to the ConverterState struct. Change-Id: I104aae1a4381c69f1a254713ec76e1aeaa862cdc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Windows QPA: Fix missing accessible name change eventsAndre de la Rocha2020-05-103-0/+17
| | | | | | | | | | | | | | Accessible name change events were not being relayed through UI Automation. This caused changes in the state of combo boxes and possibly other quick controls to be missed by UI Automation clients. This would result, for instance, in Narrator not reading the state of a combo box when its current index was changed with the keyboard. Fixes: QTBUG-70621 Pick-to: 5.15 Change-Id: I16de0ff2bb0fb5227111d5347c25f442e9b0a533 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Explain what the QStringView levels meanGiuseppe D'Angelo2020-05-091-0/+12
| | | | | | | | | Insofar the information was just in the commit message (00a8be85d168530e71511f6eb265d00fdd747cd3); add that explanation to the code itself. Change-Id: Ice1919c803a31918e8228091b3192728cbbc32f4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>