summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* QString: merge the two ucstrcmp overloads into a templateThiago Macieira2022-01-181-11/+8
| | | | | | | So we don't accidentally make modifications to one and not the other. Change-Id: I0e5f6bec596a4a78bd3bfffd16c94f1025aea521 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: introduce ucstreq() to optimize equalStrings()Thiago Macieira2022-01-181-2/+15
| | | | | | | | | If the lengths aren't equal, the strings can't be equal either, so we can skip the entire comparison. Some of the front-end functions that call these entry points already check for this, actually. Change-Id: Ib42b3adc93bf4d43bd55fffd16c8ceb9594512f2 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: make ucstricmp() parameters match the compareStrings'Thiago Macieira2022-01-181-27/+20
| | | | | | | | | | | | | The compareStrings() entry points take QStringView and QLatin1String, which are both ordered [size, pointer], so match that in the ucstricmp() parameters. This further reduces the prologue of the compareStrings() functions before reaching the case-sensitive comparison. There's no need to do the same for the case-sensitive functions because they're getting inlined. Change-Id: I0e5f6bec596a4a78bd3bfffd16c8ffc980c8af0c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: add Q_NEVER_INLINE for ucstricmp()Thiago Macieira2022-01-181-3/+3
| | | | | | | | | | | | | | | Case-insensitive comparisons are not common, but both GCC and Clang inlined the ucstricmp() functions into QtPrivate::compareStrings(), with the side-effect that a lot of unnecessary setup code saving CPU registers was executed in the prologue of those functions. After this, Clang 13 emits both compareString() functions without any push/pop to save registers on x86-64; GCC 11 still emits a few, but fewer than before (it's emitting some unnecessary overhead for the loops). Change-Id: I0e5f6bec596a4a78bd3bfffd16c8fc2c0be9165f Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: remove the old unaligned 4-byte compares in ucstrncmp()Thiago Macieira2022-01-181-60/+9
| | | | | | | | | | | | | This is very old code, predating the public Qt history (Qt 4.5). It predates all other SIMD code in qstring.cpp, actually. Now that we do have implementations for MIPS DSP, ARM Neon and x86 SSE2, this content has very little value. It would be relevant for other architectures Qt still supports (POWER and RISC-V come to mind), but I guess the compiler's auto-vectorizer functionality can do a better job than this content. Change-Id: I0e5f6bec596a4a78bd3bfffd16c90733fb0d8f22 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* CMake: add support for GNU/HurdPino Toscano2022-01-193-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Add a "HURD" CMake platform specification, so it can be properly checked in the build system. Set QT_DEFAULT_MKSPEC to the existing hurd-g++ mkspec. Hurd supports $ORIGIN in RPATH, so enable it. Hurd uses X11, so add it to the X11_SUPPORTED list. Enable few more feature checks that apply to Hurd as well: either because they are provided by GNU libc itself, or because they are implemented on Hurd. Check and set the ELF interpreter, as it is a common functionality of the GNU toolchain. Change-Id: Id347033560bbc5a2a4e2c3abb493c948c002b40e 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: Alexandru Croitor <alexandru.croitor@qt.io>
* Restore std::as_const() where a qAsConst was lost between 5.15 and 6Edward Welbourne2022-01-181-2/+2
| | | | | | | | | | Amends commit 837a29b0b92c72b7b9d66a427c24a9fa8037f4f4's fix for shadowing to take account of the loss of const-qualification of uiLanguages where it was then used in a ranged-for loop. Pick-to: 6.3 6.2 Change-Id: Ic4021bd9917cb27832a197126cc80a7f384a14a2 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QNetworkRequest: Document how Qt handles 301 and 302 status codesMårten Nordheim2022-01-181-0/+5
| | | | | | | | | To make it explicit Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-92909 Change-Id: I8f8dc99628168a566158acef72ae2a5e001eef88 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove (set but) unused member from QTimerPrivateEdward Welbourne2022-01-181-3/+1
| | | | | Change-Id: I004fef8ce84cdc74837f674239c05901000bee33 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QProcess/Unix: fallback on _POSIX_PIPE_BUF w/ missing PIPE_BUFPino Toscano2022-01-181-0/+5
| | | | | | | | | | | | | | | | | | | PIPE_BUF is optional in POSIX, e.g. "where the corresponding value is equal to or greater than the stated minimum, but where the value can vary depending on the file to which it is applied." [1] GNU/Hurd does not provide PIPE_BUF, so fallback to its minimum acceptable value, that is _POSIX_PIPE_BUF. [1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html Also, explicitly include <limits.h> in this file, to make sure PIPE_BUF or _POSIX_PIPE_BUF are available without relying on other headers to pull <limits.h>. Change-Id: Ifae964db81841e1d31fc09e73b45594af9a326d1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString::toLatin1_helper_inplace: simplify the codeThiago Macieira2022-01-173-21/+43
| | | | | | | | | Hot function, so help the compiler out. In particular, this removes any touch to the ref count, so there are no atomic operations or dead code leading to memory allocations and deallocations. Change-Id: I0e5f6bec596a4a78bd3bfffd16c9a0fbd8dd2c12 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QMetaType: add a missing check for null d_ptrThiago Macieira2022-01-181-1/+1
| | | | | | | | | | | | | Bug introduced in 6.0. This is the only unprotected d_ptr I could find. [ChangeLog][QtCore][QMetaType] Fixed a bug that would cause QMetaType::compare() and QVariant::compare() to crash on invalid meta types and variants. Pick-to: 6.2 6.3 Fixes: QTBUG-99960 Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1f7b2d146688 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QRhiGles2: replace two QSet<int> with QDuplicateTrackerMarc Mutz2022-01-182-8/+9
| | | | | | | | | | Apart from a more fitting, minimal, API, QDuplicateTracker also transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or at least reduce, memory allocations. Pick-to: 6.3 Change-Id: Ied2574734949b2dadc1bcbaa9d1e3c0ed98ba50a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* JSON: When clearing duplicate object entries, also clear containersUlf Hermann2022-01-181-10/+44
| | | | | | | | | | | | | | | | | Previously, if you had multiple entries with the same name in an object, and some of them were again objects or arrays, parsing the JSON document would leak memory. Also, we use std::stable_sort instead of std::sort now, so that we don't accidentally randomize the order of elements with equal keys. [ChangeLog][QtCore][JSON] A memory leak in the JSON parser when reading objects with duplicate keys was fixed. Pick-to: 5.15 6.2 6.3 Fixes: QTBUG-99799 Change-Id: Ic2065f2e490c2d3506a356745542148ad9c24262 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: don't allocate in fromString() in the common caseMarc Mutz2022-01-182-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use QVarLengthArray instead of QList to avoid allocations in the case where the result fits into inline storage. Of course, we now perform one allocation more when we need the QList backend, but a) that should be the rarer case and b) we use 32 (more than InlineSegmentsCount) Prealloc for the QVarLengthArray to reliably skip the first few QList non-reserved capacity jumps (measured to be {4, 12, 28} for back-insertion, not all of which is probably available for append()s) to come out ahead either way. Reviewers may object, saying that we could just reserve(32) the QList, too, but while that would skip over the first few QList reallocations alright, it means we'd be carrying the extra capacity around for the duration of the QVersionNumber's lifetime (unless we'd shrink it at the end, bringing back the additional allocation and that solution back to par compared to this one). As a consequence: [ChangeLog][QtCore][QVersionNumber] Can now be also be constructed from QVarLengthArray. Change-Id: I4016367f64f6cefa6ed9147d33b06636f36b02cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: port fromString() to QAnyStringViewMarc Mutz2022-01-185-68/+60
| | | | | | | | | | | | | | | | | We can handle the UTF-8 case by reinterpreting it as Latin-1. This way, the suffixIndex stays valid as a return value. As a drive-by, optimize away toLatin1() calls by using a QVLA. We really need a better way of converting UTF-16 -> L1 than qt_to_latin1()... [ChangeLog][QtCore][QVersionNumber] fromString() now takes QAnyStringView (was: QString, QStringView, QLatin1String) and a qsizetype pointer (was: int pointer). Change-Id: I86abaadba2792658fbf93ccd1e0b86e3302c697c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: change int to qsizetype in fromString()Thiago Macieira2022-01-173-8/+48
| | | | | | | | | This completes the update to qsizetype in this class, adding a couple of methods that need to be removed in Qt 7. They're only required where int is not qsizetype (i.e., 64-bit platforms). Change-Id: I0e5f6bec596a4a78bd3bfffd16c9de29bec4c637 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Offscreen: Implement QPlatformBackingStore::toImageVolker Hilsheimer2022-01-181-0/+1
| | | | | | | | | This makes testing of actually produced output easy in unit tests. Pick-to: 6.3 Task-number: QTBUG-99962 Change-Id: Ia806539230af12d1eae1e31ef7a47155d9bc1bed Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CMake: re-enable SIMD on AndroidThiago Macieira2022-01-171-34/+34
| | | | | | | | | | | Except for MIPS, which is disabled in Qt 5 too. It's not my place to question why. This partially reverses commit b6e75ff3eaccc4f0322c9735533a1f3435597eba. Change-Id: Ib42b3adc93bf4d43bd55fffd16c1feffb9c5890c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QLatin1String: perform the comparison to another QL1S using memcmp()Thiago Macieira2022-01-171-4/+4
| | | | | | | | | | | | | | | | | | qstrncmp() would stop at the first null character, which isn't correct. The tests that had been disabled in tst_qstring.cpp (with an inaccurate comment) were actually passing. I've added one more to ensure that the terminating null is compared where needed. [ChangeLog][QtCore][QLatin1String and QUtf8StringView] Fixed a couple of bugs where two QLatin1Strings or two QUtf8StringViews would stop their comparisons at the first embedded null character, instead of comparing the full string. This issue affected both classes' relational operators (less than, greater than, etc.) and QUtf8StringView's operator== and operator!=. Pick-to: 5.15 6.2 6.3 Change-Id: I0e5f6bec596a4a78bd3bfffd16c90ecea71ea68e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove unused .qrc filesJoerg Bornemann2022-01-179-278/+0
| | | | | | | | Task-number: QTBUG-94446 Change-Id: I136d8b4ab070a832866aa50b5701fc6bd863df8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Convert date-time to UTC before claiming it's in GMTEdward Welbourne2022-01-171-4/+4
| | | | | | | | | | | | | | | | | | QNetworkHeadersPrivate::toHttpDate() used a custom format to output a date-time; the format supplied GMT as suffix, but neglected to convert the date-time to UTC, so local-time was formatted as if it were UTC, regardless of its actual offset from it. Fixing this (by the obvious toUTC() call) broke formatting when the supplied header value was a QDate, since it's packaged as a QVariant and QVariant's conversion of QDate to QDateTime uses local time's (not UTC's) start of day. So fix headerValue() to separate QDate and QDateTime cases and use startOfDay(Qt::UTC) to get the right start of the day. Added tests for non-UTC date-times appearing correctly in HTTP headers. Fixes: QTBUG-80666 Pick-to: 6.3 6.2 6.2.3 5.15 Change-Id: I2792bce14a07be025cf551b0594630260c112269 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Simplify some #if-ery and use positive testsEdward Welbourne2022-01-171-8/+6
| | | | | | | | | | Two cases coincide without feature textdate, and the first falls through to the second with the feature, making it possible to simplify the #if-ery, converting its tests to positive form and skipping a duplicate case body in the process. Change-Id: I2c0ee800442474707bf8893bd72b9706fef54485 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move input event logic into QWasmCompositorDavid Skoland2022-01-179-598/+658
| | | | | | | | | | | | | | | | | | | | | Move the window logic and state out of QWasmEventTranslator and into QWasmCompositor. The reasoning for this change is that the state of the windowing system was split between QWasmCompositor (eg. window stack) and QWasmEventTranslator (eg. dragged and pressed windows). This change moves the input handling and state to QWasmCompositor and demotes QWasmEventTranslator to a helper class. In this model, QWC acts as a proper window system / display server and can leverage multiple helper classes which are "owned" by the QWC. Here is a quick diagram illustrating the proposed general architecture around WASM window handling and its difference from typical OSes: https://i.imgur.com/vcBwUPf.png Change-Id: Idca617992b8e1b431e5c71d46b5db61597c99e75 Pick-to: 6.3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Doc: Use \inmodule for all classes and headersTopi Reinio2022-01-1717-2/+20
| | | | | | | | | | | | | | | QDoc made some assumptions about the module a class/header belongs to, based on the source file path. This feature is rather error-prone and unnecessarily complex and will be removed from QDoc. Define modules explicitly to avoid documentation warnings when this removal happens. Pick-to: 6.2 6.3 Change-Id: I7947d197db5ac36c12e816caa19bb2f74eda8849 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* QFusionStyle: don't draw an invalid outline for up/down buttonsTimur Pocheptsov2022-01-171-20/+24
| | | | | | | | | | When they are disabled ('NoButtons'). Otherwise, we end up with a tiny dot (top left or right corner of a spinbox). Pick-to: 6.2 6.3 5.15 Fixes: QTBUG-99486 Change-Id: Ic99f4bce2abd57c988254296a749b5d5b23cfb39 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QAuthenticator: Use views for arguments in private functionsMårten Nordheim2022-01-172-34/+40
| | | | | | | | | Some lines in tests had to be updated because they lost the implicit conversion from char* to QString. Change-Id: I95af5859ced95b9ca974205398e38c0bd4395652 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Make QListIterator snippets more robustKai Köhne2022-01-177-19/+23
| | | | | | | | | | | qDebug() << i.next(); can become a NOOP if the code is compiled with QT_NO_DEBUG_OUTPUT. Pick-to: 5.15 6.2 6.3 Fixes: QTBUG-97535 Change-Id: I9085b40ac9b4de2bb06f16e03fd5100902b08d4f Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Doc: Remove mentioning of Fowler bookKai Köhne2022-01-1720-38/+19
| | | | | | | | | It is out of print since years, and probably quite dated by now (released 1997). Pick-to: 6.3 Change-Id: I1653eb404713c15d70b8a15858e8c7d12b2e71cb Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* qmetatype: Fix incorrect more than one typedef warningJonas Kvinge2022-01-171-1/+1
| | | | | | | | | | | | | | The names are the keys of a hash so they can come in any order. That means the loop above, which stops before the end if it finds a name that is not the official one, may not have seen the official yet. If it has reached the end, then there is no typedef alias. Fixes: QTBUG-99620 Pick-to: 6.2 6.3 Change-Id: I3bd638766c494b32c665190d01db15c4cbc587b5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Replace QString::utf16 with QString::data where appropriateØystein Heskestad2022-01-175-10/+10
| | | | | | | | | | | QString::utf16() needlessly detaches fromRawData() to ensure a terminating NUL. Use data() where we don't require said NUL, taking care not call the mutable data() overload, which would detach, too. Task-number: QTBUG-98763 Change-Id: Ibd5e56798c0c666893c12c91ff0881842b8430c7 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QStorageInfo: limit Linux-only code with Q_OS_LINUXPino Toscano2022-01-161-0/+2
| | | | | | | | | This fixes a build problem (use of PATH_MAX) by eliminating a Linux-specific condition that can't happen on HURD anyway. Pick-to: 6.3 Change-Id: I5dcaf104a60b7850b8af3964fc4cd02ab24acd7b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: change int to qsizetype for index and lengthThiago Macieira2022-01-162-30/+34
| | | | | | | | | | | | | | | | | | This class is not exported, so we can change the non-exported methods. None of the exported methods required change; notably, QVersionNumber::Segments::setVector didn't because it's only called with values 1, 2, and 3. [ChangeLog][Potentially source-incompatible changes] Updated the QVersionNumber API to use qsizetype where length and index values were used. This change retains binary compatibility and the vast majority of users will not experience a source compatibility problem. It could occur with ambiguous overloads when passing results from QVersionNumber to other API not using either int or qsizetype. There could also be new warnings from compilers about converting 64-bit types to 32-bit ones. Change-Id: I0e5f6bec596a4a78bd3bfffd16c9984b61c9b55b Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QTextStream: code tidiesGiuseppe D'Angelo2022-01-162-10/+13
| | | | | | | | | | | | Port the internals to qsizetype, and use QStringView instead of QString as a function parameter. The padding() function is changed to take a qsizetype to avoid warnings, but the maximum padding that can be specified is still limited by the range of an int (this is guarded via an assert). Change-Id: I9dd98e5a534990a1758b080900a12dc793528d19 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QAnyStringView: fix code point -> code unit in the docsGiuseppe D'Angelo2022-01-161-1/+1
| | | | | | | | | | The docs are saying that QAnyStringView sizes are measured in terms of code units of the underlying encoding, not code points. Pick-to: 6.3 6.2 Change-Id: Ic72ffd122e45631e8626c9d57ec24ca348918424 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtGui/math3d: Fix QQuaternion::getEulerAngles for GimbalLock casesYuya Nishihara2022-01-161-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is heavily inspired by the patch written by Inho Lee <inho.lee@qt.io>, which says "There is a precision problem in the previous algorithm when checking pitch value. (In the case that the rotation on the X-axis makes Gimbal lock.)" In order to work around the precision problem, this patch does: 1. switch to the algorithm described in the inline comment to make the story simple. 2. forcibly normalize the {x, y, z, w} components to eliminate fractional errors. 3. set threshold to avoid hidden division by cos(pitch) =~ 0. From my testing which compares dot product of the original quaternion and the one recreated from Euler angles, calculation within float range seems okay. (abs(normalize(q_orig) * normalize(q_roundtrip)) >= 0.99999) Many thanks to Inho Lee for the original patch and discussion about rounding errors. Fixes: QTBUG-72103 Pick-to: 6.3 6.2 5.15 Change-Id: I8995e4affe603111ff2303a0dfcbdb0b1ae03f10 Reviewed-by: Yuya Nishihara <yuya@tcha.org> Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QMutableEventPoint: turn into memberless structMarc Mutz2022-01-151-33/+4
| | | | | | | | | | | | | | | | ... as a befriendable namespace. This breaks all remaining users of QMutableEventPoint, thus forcing them to port to the new static-setter-only API that reliably avoids the UB that the old QMutableEventPoint::from(), in particular, depended on. Fixes: QTBUG-99615 Pick-to: 6.3 Change-Id: Id162cd98f13b52c4f491749ee73826b1c5755453 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QCSS: Support Qt 5-style integer property selectorsVolker Hilsheimer2022-01-154-35/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5 style sheets, objects could be selected by an enum-type property using the integer value of the enum value, e.g QToolButton[popupMode="1"] { ... } In Qt 6, the the new meta type system and QVariant implementation enabled QVariant::toString to return the string representation of the enum value instead for a property containing an enum. Since QStyleSheetStyle's attribute matching is string based, this breaks the Qt 5 style selector, and QCSS code instead needs to use e.g. QToolButton[popupMode=MenuButtonPopup] { ... } While the new syntax is arguably preferable, this is an unintentional change that silently breaks style sheet code (no error or warning at compile- or run-time). To support Qt 5-style selectors, we have to change the StyleSelector interface of the QCssParser API so that we can pass through what type of value the attribute extractor should return; if an integer string "1" is provided, then we need to compare the enum integer value; if the string provided does not represent a number, then we need to compare the name of the enum value. Since the pure virtual attribute() method that needs to be implemented to extract the attribute value of the node is implemented in modules outside qtbase, add a second virtual method that takes the entire QCss::AttributeSelector, which includes the value to match. Extractor implementations can use it to evaluate which type of data to return for an exact match. The default implementation calls the old attribute() method so that existing StyleSelector implementations continue to work. Make the respective change in the QStyleSheetStyleSelector, and simplify the surrounding code. Adjust other StyleSelector implemnentations in qtbase. As a drive-by, remove the superfluous virtual declaration from those overrides. Once submodules are adjusted to override this virtual function instead of the (now no longer pure) virtual attribute() method, that method can be removed. Pick-to: 6.3 6.2 Fixes: QTBUG-99642 Change-Id: I9a2b3498f77bf7cab5e90980b7dab2f621d3d859 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix Pick Screen Color with multiple monitorsFawzi Mohamed2022-01-151-1/+3
| | | | | | | | | | | QScreen::grabWindow expects screen coordinates, not global ones, use QScreen::geometry() to compute them. Fixes: QTBUG-99472 Pick-to: 6.2 6.3 Change-Id: Ic4b99577b8cb394e6cd0a2d3f554bb3ec8250afa Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Zhang Hao <zhanghao@uniontech.com>
* tests: port to new QMutableEventPoint static APIMarc Mutz2022-01-151-0/+9
| | | | | | | | | | | | | | | | | | This code didn't actually use QMutableEventPoint::from(), so didn't run into the UB that from() depended on, but it's in the way of making QMutableEventPoint a befriendable namespace instead of a public subclass of QEventPoint. Replaced the QMutableEventPoint ctor that takes a timestamp, and therefore isn't compatible with the ctors on QEventPoint, with a static function that returns QEventPoint instead. Port QList initialization to braced-initialization as a drive-by. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: If5a1dbea21cc31cdefdb640716793421c8ec0af4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Prevent repeated instantiations of ↵Marc Mutz2022-01-153-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qRegisterNormalizedMetaType<QList<QModelIndex>>() This, finally, shows some expected results: Clang -ftime-trace: $ ClangBuildAnalyzer --analyze qtgui-spec-before.trace | head -n6 Analyzing build trace from 'qtgui-spec-before.trace'... **** Time summary: Compilation (523 times): Parsing (frontend): 665.7 s Codegen & opts (backend): 298.9 s $ ClangBuildAnalyzer --analyze qtgui-spec-after.trace | head -n6 Analyzing build trace from 'qtgui-spec-after.trace'... **** Time summary: Compilation (525 times): Parsing (frontend): 628.3 s Codegen & opts (backend): 301.0 s GCC 11 time (bash builtin): $ time for ((i=0; i < 3; ++i)) do touch ../qt5/qtbase/src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so real 4m10,918s user 49m10,099s sys 3m11,719s $ git revert --no-commit HEAD $ time for ((i=0; i < 3; ++i)) do touch ../qt5/qtbase/src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so [268/268] Creating library symlink qtbase/lib/libQt6Gui.so.6 qtbase/lib/libQt6Gui.so real 4m18,630s user 51m11,491s sys 3m16,479s The technique in the comment in qmetatype.h doesn't work on Clang - it runs into -Winstantiation-after-specialization. The whole extern template stuff so miserably fails to meet the goals set out in N1448, not only for MSVC and class templates, but, it seems, on all compilers, and for function templates, too, that I'm giving up on it for now. Unfortunately, I'm not really seeing a way to hide this stuff behind a macro, yet. Task-number: QTBUG-97601 Pick-to: 6.3 Change-Id: I500fd04555e0bd76ac021f75582bd8d8cf339378 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtNetwork: Include moc filesMårten Nordheim2022-01-1523-0/+46
| | | | | Change-Id: I227a9541bf76c1c048a694f022b8fc419c0c2544 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Don't include qeventpoint_p.h from qevent_p.hMarc Mutz2022-01-1410-1/+10
| | | | | | | | | | | The header no longer uses QMutableEventPoint. Fix TUs that relied on the transitive include. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: Iae4ff34ea708304fcd365fd763875dd4a97a1cf8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QFlatMap: don't sort already ordered dataMarc Mutz2022-01-141-1/+1
| | | | | | | Pick-to: 6.3 6.2 Change-Id: Id7ab2fe09c01500ca5bd23751ba29ed1394bb9b6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix crash when text shaping failsEskil Abrahamsen Blomfeldt2022-01-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | If text shaping failed for some reason (for example if the string passed to Harfbuzz contains ignorables only), we would return a single glyph for the whole string. But we forgot to initialize the log clusters array, which could cause crashes later when this was read. We initialize a single cluster consisting of the "missing glyph" glyph to be consistent. Amends fccd419dd632306a4bd85928223e0a56a59510ef. [ChangeLog][QtGui][Text] Fixed a possible crash with certain fonts when shaping strings consisting only of control characters. Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-89155 Fixes: QTBUG-92358 Change-Id: I1ec0237d99b48be2a8bb340f0feb056bca4fdffe Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QWindow: Remove unnecessary castVolker Hilsheimer2022-01-141-2/+1
| | | | | | | | | We already have a QMouseEvent, don't static_cast the QEvent again to the parent-class of QMouseEvent. Pick-to: 6.3 6.2 Change-Id: Ifd8a5a82d0a8ded564a68ec4f3ae877886c6e1c7 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QWindow: fix UB (invalid static_cast)Marc Mutz2022-01-141-1/+6
| | | | | | | | | | | | | | | | | | | Do the cast to QMouseEvent only after we determined that it's actually a QMouseEvent. Says ubsan: src/gui/kernel/qwindow.cpp:2558:27: runtime error: downcast of address 0x7fffca0e5af0 which does not point to an object of type 'QMouseEvent' 0x7fffca0e5af0: note: object is of type 'QShowEvent' ff 7f 00 00 b0 09 01 b8 61 7f 00 00 11 00 00 00 00 00 00 00 b3 8a b5 41 00 00 00 00 80 50 5a cc ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QShowEvent' Only cast _after_ determining that `ev` is-a mouse event. Amends 3d71c4b740d23d5c3f380f495990f35ea17dc2a0. Pick-to: 6.3 6.2 Change-Id: I8455c998e2f4390a1483c1a097eb095358963ace Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix warning on macOS builds, unbreak -developer-buildVolker Hilsheimer2022-01-141-1/+1
| | | | | | | | | | | The mix of signed (qsizetype) and unsigned long when comparing breaks local -Werror,-Wsign-compare builds. Amends d83dbc3db2f305e745cd75a9fd9c97128eaac42f. Change-Id: I7910b7e2dfaaa01d8069ce52e97c0166e6d3fa30 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* convertDoubleTo: invert the condition so we catch NaNs earlyThiago Macieira2022-01-141-1/+1
| | | | | | | This is floating point, so De Morgan doesn't always apply. Change-Id: I89446ea06b5742efb194fffd16bb9e36025cb387 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* convertDoubleTo: move the precision upgrade test upThiago Macieira2022-01-141-4/+13
| | | | | | | | | | Hopefully, the compiler will realize that the suprema calculated below are actually bigger than these limits and make the appropriate dead code eliminations. Change-Id: I89446ea06b5742efb194fffd16bb99f78b26eb0e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>