summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Use QAbstractItemModelTester or QFileSystemModelAndreas Buhr2022-05-182-4/+21
| | | | | | | | | | | | This patch enables usage of QAbstractItemModelTester on QFileSystemModel. QAbstractItemModelTester called fetchMore() on all items. QFileSystemModel represents the whole file system. This led to very long test runs. To avoid this, this patch introduces a new feature in QAbstractItemModelTester, namely to disable calling of fetchMore(). Change-Id: Ie5d2e22fa4c143be7c080d9f79632cd2cbe07aac Reviewed-by: David Faure <david.faure@kdab.com>
* Make uic generate correct C++ commentsVolker Hilsheimer2022-05-182-3/+3
| | | | | | | | | Revert the change to uic of 05fc3aef53348fb58be6308076e000825b704e58. Task-number: QTBUG-67283 Change-Id: Icfd83bb6d80b91d4e58f1be460f6772ba49a6921 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Optimize atomics in QObject::moveToThread() [2/2]: de-duplicate loadsMarc Mutz2022-05-181-1/+1
| | | | | | | | | | | | | | We don't need to reload d->threadData, as we've already loaded it into a register three lines above, so use the already-loaded value. We don't care whether we might have read a different value the second time around, because that would mean we had a race condition elsewhere in the program (e.g. concurrent moveToThread() calls). Pick-to: 6.3 Change-Id: I29a27ca23302288b5900ac6b45b8690a80e85680 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Optimize atomics in QObject::moveToThread() [1/2]: relax a pointer loadMarc Mutz2022-05-181-1/+1
| | | | | | | | | | We don't need an acquire fence for checking a pointer for nullness, and we're not dereferencing the pointer later, so use a relaxed load there. Pick-to: 6.3 Change-Id: Id84e6fc50100f1bf6a4e33f89424f8b1cbb250cd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix data race in QObject::moveToThread()Marc Mutz2022-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | We dereference thisThreadData in the next line, at a point in time where we haven't, yet, verified that it's this_thread's QThreadData, so we need an acquire fence. The alternative would be to re-arrange the code so that dereferencing the pointer is delayed until after we verified it's this_thread's, but that doesn't seem readily possible. Even if it was easy, we'd first need to verify whether there are any writes into QThreadData objects after they've been constructed, in which case the acquire fence may be needed even in case it's 'ours'. So just add the acquire fence. Pick-to: 6.3 6.2 5.15 Change-Id: I468bc1f971bd87345bfcd6c13b7384bdf09d086a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtWidgets: restore Qt 5 compatibility for save/restore stateGiuseppe D'Angelo2022-05-185-0/+10
| | | | | | | | | | | | | | | | | | | | | | | Several classes in QWidget use QDataStream internally in order to save and restore state. These QDataStream usages were not versioned, meaning that if Qt changes the serialization for some datatype, then the data saved between different Qt versions becomes incompatible. Note that the save/restore API in question just produce opaque blobs as QByteArrays -- the user has no control over the QDataStream objects and thus versions. Fix by version the usages. In QHeaderView this has caused a regression because QBitArray *did* change version between Qt 5 and 6. In general, using QDataStream without explicit versioning is a mistake, so deploy the same fix elsewhere as well. Fixes: QTBUG-99487 Pick-to: 5.15 6.2 6.3 Change-Id: I82bb5c266f4e5dedc0887cbef855dccab1015e29 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: <doctor.whom@gmail.com>
* moc: Add line breaks to the qt_incomplete_metaTypeArray<>Friedemann Kleint2022-05-181-11/+14
| | | | | | | | The code is hard to read due to the long line generated. Task-number: QTBUG-100145 Change-Id: I1d1a7a547db71cca1e710d39df809f079fc2dafe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QTextDocument/QGraphicsTextItem: skip layout in setTextWidth(0)David Faure2022-05-173-6/+11
| | | | | | | | | | | | | | | | | | In a QGraphicsTextItem without a width yet, there's no need to do any layouting. The use case is obviously items with an app-defined size, not the default where text items adapt to their contents. Results: 0.065 msecs to create a QGraphicsTextItem with some text (layouted) 0.036 msecs to set everything up in a QGraphicsTextItem with 0 width QTextEdit was abusing the width 0 to mean "no wrap, width comes from contents", but since the value -1 means that already in QTextDocument, QTextEdit now uses a width of -1 for that meaning. Change-Id: I67ad59c305e5dd34830886e4e6c56dde03c93668 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTlsBackendOpenSSL: don't allocate memory for a QString appendeeMarc Mutz2022-05-171-1/+1
| | | | | | | | Use the QLatin1String overload of QString::append(). Pick-to: 6.3 Change-Id: Id8ddfd72199cfb627c2d6648ce3011979f92094e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QKeySequence/Mac: remove NumEntries variableMarc Mutz2022-05-171-6/+3
| | | | | | | | | | | Keep it DRY. Just let the compiler figure out the size. Pick-to: 6.3 6.2 Change-Id: I2bf1c44d4e2060a9398700d16ab98d67c849814c Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Remove more unused qreadwritelock.h includesMarc Mutz2022-05-172-2/+0
| | | | | | Pick-to: 6.3 6.2 Change-Id: I4962c1abcc58d36500a56ccca680f6f36c3b5d89 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qobject_p.h: remove unused qreadwritelock.h includeMarc Mutz2022-05-172-1/+1
| | | | | | | | | | | | | | | | | Only qcoreapplication_p.h uses a QReadWriteLock (tanslationMutex), so include it only there. This include has caused QAtomicPointer<QReadWriteLockPrivate> to percolate to the top-5 of template instantiation hogs when compiling QtWidgets, as reported by Clang -ftime-trace. This patch improves that, because qcoreapplication_p.h isn't part of the PCH and is much less frequently included into QtWidgets TUs (68 instead of 142 times). Pick-to: 6.3 6.2 Change-Id: I2518040d83a04e7cef0645d7f4bf641fb50f49ff Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QPropertyBindingPrivate: de-inline functions that modify heapObserversMarc Mutz2022-05-172-16/+20
| | | | | | | | | | | | | Manipulating owning containers is costly at runtime, but also at compile-time, so don't do it in inline functions, do it out-of-line. Removes the top-2 entries[1] in a Clang -ftime-trace QtWidget build. [1] at the time of writing of this patch Change-Id: I5da5030788b0d976a0ab7875f87ba3b51dbb1231 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QReadWriteLock: fix another data race in stateForWaitCondition()Marc Mutz2022-05-171-0/+1
| | | | | | | | | The writerCount member variable is only ever accessed under Private::mutex protection, so we need to lock the mutex here, too. Pick-to: 6.3 6.2 5.15 Change-Id: I1717e5282eed2ecc14ccdc5090b9fc41174cccc8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix int/qsizetype mismatches in qstring.hMarc Mutz2022-05-171-7/+6
| | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QString] Fixed result truncation mod INT_MAX in fromStdSstring(), fromStdU16string(), fromStdU32string(), and fromStdWstring(). [ChangeLog][QtCore][QAnyStringView] Fixed result truncation mod INT_MAX in asLatin1StringView(). [ChangeLog][QtCore][QUtf8StringView] Fixed result truncation mod INT_MAX in toString(). Pick-to: 6.3 6.2 Change-Id: I944c561018a6ab4581ad6b1d71ec1ba1accba4a4 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Give some TLC to FlaggedDebugSignaturesMarc Mutz2022-05-171-7/+5
| | | | | | | | | - add noexcept - use std::array instead of C array - add comment explaining locations.size() Change-Id: Ied6c043e693fecc232878a00ea882c97bda150b6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QObject: Turn flaggedSignatures into a thread_local staticMarc Mutz2022-05-172-25/+22
| | | | | | | | | | | | | | | | | | | | ... out of QThreadData. No-one except two functions in qobject.cpp uses the object, and its creation is constinit, so there's no advantage to expose it to the world as a QThreadData member. Remove it from QThreadData, move the class' definition to the unnamed namespace in qobject.cpp, ensure constinit'ability by letting the language zero out the members (as opposed to an STL algorithm call), declare it constinit thread_local static, and adapt the two users (basically, removing the retrieval of QThreadData::current()). Almost no effect on Clang, but saves ~400 bytes on optimized GCC 11.2 Linux AMD64 C++20 builds. Change-Id: I22432d4ec5eb4ab59920656409b21768983fb4db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QJniHelpers: don't rely on qreadwritelock.h transitive includeMarc Mutz2022-05-171-0/+1
| | | | | | | | | | | ... from qcoreapplication_p.h Amends 5fd6704091febcc4abbc8d7ce06a393572524fa5. Pick-to: 6.3 Change-Id: I00bda35aa7bfd590105d7fe275af181ba7b53446 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Doc: Document qt_add_resources' OUTPUT_TARGETS argumentJoerg Bornemann2022-05-171-0/+6
| | | | | | | | | Originally, this argument was meant for internal use only. But it turned out useful for user projects too. Pick-to: 6.2 6.3 Change-Id: I58af5ca8303fa9166d41a0538a60913d1fba9784 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Widgets: Use effect region bounds when drawing with repaint managerAntti Määttä2022-05-173-3/+6
| | | | | | | | | | | | When drawing widgets with graphics effect using repaint manager, if we do not combine the effect region some child widgets are not affected by the graphics effect since they are not included in the dirty region. However always using region bounds breaks the referenced bug use case. Fixes: QTBUG-102374 Pick-to: 6.3 6.2 5.15 Change-Id: Iaf4eaba34db863500a0600b344e5062f2b36b9bf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add qsimd_x86_p.h to the QtCore source treeAlexey Edelev2022-05-171-0/+6
| | | | | | | | | | | | Need to collect all header files that belong to the module to make them visible in CMake source tree. In future commit they will be used to consider what headers need to be installed for each platform. Amends 28b4bd7dbbd4c0d4e2e04aff0ff885ec163975bc Change-Id: I7ab4063350254324869d5c2d0ba0f7e336da96fb Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDBusArgument: ensure std::vector isn't seen as an associative containerDavid Faure2022-05-171-1/+1
| | | | | | | | | This broke compilation of qDBusRegisterMetaType<std::vector<MyStruct>> because std::vector<T> is in fact std::vector<T, std::allocator<T>>. Pick-to: 6.2 Change-Id: I6a13f5f0476a3faa3a43da54d90d652b4bdd8186 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QWidgetTextControl: don't clear() a new empty documentDavid Faure2022-05-161-1/+1
| | | | | | | | | | | | | | Before: 0.063 msecs per iteration After: 0.054 msecs per iteration clear() takes time because: 1) QTextDocumentLayout::documentChanged() => doLayout() => layoutFrame() 2) QTextDocumentPrivate::init() => insertBlock() => finishEdit() => QTextDocumentLayout::documentChanged() => layoutStep() => ... => doLayout() again Pick-to: 6.3 6.2 Change-Id: I7a13164d06a1ed77226f2b9d7d12e69ce5b31dfe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Return specific types for frequently used Java objectsVolker Hilsheimer2022-05-178-15/+58
| | | | | | | | | | | | | | | | | | This allows us to specialize JNI type signature templates for e.g. the context object, which in Java signatures is "android/content/Context". Introduce a Q_DECLARE_JNI_TYPE macro that takes care of the plumbing. The types declared this way live in the QtJniTypes namespace, and transparently convert from and to jobject. Since jobject is a typedef to _jobject* we cannot create a subclass. Use a "Object" superclass that we can provide a QJniObject constructor for so that we don't require the QJniObject declaration to be able to use the macro. The APIs in the QNativeInterface namespace doesn't provide source or binary compatibility guarantees, so we can change the return types. Change-Id: I4cf9fa734ec9a5550b6fddeb14ef0ffd72663f29 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Fold methods for object return type into generic methodsVolker Hilsheimer2022-05-172-103/+126
| | | | | | | | | | | | | Since we know at compile time whether the return type is an object type, we can use 'if constexpr' and auto return type in the call(Static)Method and get(Static)Field functions to call the object-type methods. This makes the object-methods conceptually obsolete, but don't declare them as deprecated as long as they are still used in submodules to avoid warning floods and build failures in -Werror configurations. Change-Id: Ic3019ed990a9252eefcb02cdb355f8a6ed6bc2ff Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QString: don't use utf16() just to create a u16stringMarc Mutz2022-05-161-1/+1
| | | | | | | | | | | | QString::utf16() will detach from QStringLiterals in order to ensure NUL-termination, we don't need the returned pointer NUL-terminated, because we pass the length explicitly to the u16string ctor, so just use data(). Task-number: QTBUG-98763 Pick-to: 6.3 Change-Id: If883901a41480f469162ff4ed5bef927a3bf060a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QReadWriteLock: fix data race in stateForWaitCondition()Marc Mutz2022-05-161-1/+1
| | | | | | | | | | The function dereferences the load()ed pointer, so it needs an acquire fence. Pick-to: 6.3 6.2 5.15 Change-Id: Ib951de3f00851d915fec3392cdaba64f4a994300 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Stylesheet: fix toolbutton menu indicator renderingVolker Hilsheimer2022-05-161-12/+17
| | | | | | | | | | | | | | | | | | Turn off native indicators if we have custom rules, and if we drew natively, don't draw custom indicators. This amends ea0e0a865237983b484ed88447b9fc4c473e2759 which turned off custom drawing too aggressively, removing custom indicators also if no custom drop down arrow (which is only relevant for drop down menu buttons) was set. When then drawing the custom indicator, respect positioning rules in the style sheet. Extend baseline test. Fixes: QTBUG-102866 Pick-to: 6.3 6.2 Change-Id: I5ca353f42e704ec3f6e57677c35118a9cb358b0b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QReadWriteLock: fix data race in dtorMarc Mutz2022-05-161-1/+1
| | | | | | | | | | | | | | | | | | We need an acquire fence before we delete the d-pointer. Otherwise, the reads that the dtor performs (QReadWriteLockPrivate contains many non-trivial data types such as std::mutex and QVLA), race against writes performed in other threads. The qWarning() indicates that QReadWriteLock can not rely on external synchronization to ensure a happens-before relationship between reads in the dtor and said writes. While an explicit fence just before the delete would suffice, the guard return is an extremely unlikely error case, and if we ignore it, then loadAcquire() is correct, so use that. Pick-to: 6.3 6.2 5.15 Change-Id: I29773b665a7f864cd6b07a294da326e8b10399b5 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows QPA: Fix text input with Input Method EditorsAndré de la Rocha2022-05-161-15/+1
| | | | | | | | | | | | | | | Removes a workaround that was added to force the Windows On-Screen Keyboard to automatically appear on Windows tablets, since it is no longer needed in currently supported Windows releases and was interfering with text input using Input Method Editors. Also remove logic for programmatically disabling the OSK, since it is no longer needed here as well, and is already supported in the UI Automation code elsewhere in the Windows QPA. Pick-to: 6.2 6.3 Fixes: QTBUG-98003 Change-Id: I6c4781852a5e9f96330d54a24ee3893dcd43a28c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Windows: Make QScreen::name() more user-friendly, take 2Yuhang Zhao2022-05-162-13/+45
| | | | | | | | | | | | | | | | | | | | | | | | The first attempt introduced in e9fd1c6aab28f had an unwanted side-effect which makes the screen name non-unique and made the screen manager think multiple different monitors with the same name is one same monitor. This behavior is of course wrong and unwanted but it was missed due to there's no unit test for this property and I was not familiar enough with QPA stuff. As a result the change was reverted in 851dc581cf9a76. However, the original change is still a good improvement, so we bring it back, but fixed the side-effect mentioned above, by letting the screen manager compare the device name instead of monitor name. If multiple monitors have the same name, a numeric suffix will be appended to the monitor name to let people still be able to distinguish between them. Change-Id: Ic03105d0825abbb3d21cb51d1da3ab2cbb4ca913 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-164095-158009/+8749
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Correctly read and write CF_DIB bmp dataViktor Arvidsson2022-05-162-22/+50
| | | | | | | | | | | | | | | | | | | | When decoding CF_DIB data through the bmp handler we have to do some assumptions on where the pixel data starts since there's no file header to get the offset value from. We have to do this because theres some optional data after the info header that needs to be skipped over in some cases. These optional color mask values are now also written when putting a CF_DIB into the clipboard for maximum compatibility with other apps on Windows. This fixes the issue where pasted dibs would be offset by 3 pixels on Windows. Fixes: QTBUG-100351 Pick-to: 6.2 6.3 Change-Id: Icafaf82e0aa3476794b671c638455402a0d5206f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Android A11Y: handle LocationChanged event only for focused elementIvan Solovev2022-05-169-15/+17
| | | | | | | | | | | | | | | | | | LocationChanged event unconditionally triggered invalidateVirtualViewId call. That call results in TYPE_WINDOW_CONTENT_CHANGED Android event, which causes a lot of background processing. That is not correct, because LocationChanged event is generated by every accessible element, not only the one that has A11Y focus. This patch checks event->uniqueId(), and processes only events that come from the focused accessible element. Done-with: Mike Achtelik <mike.achtelik@gmail.com> Task-number: QTBUG-102594 Pick-to: 6.3 6.2 5.15 Change-Id: I6b941733c9d215fed5ee5a7aeeb5be234add9ebe Reviewed-by: Mike Achtelik <mike.achtelik@gmail.com> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Item widgets: clean up treatment of Qt::TextAlignmentRole / CheckStateRoleGiuseppe D'Angelo2022-05-166-8/+112
| | | | | | | | | | | | | | | | | | | | | | | The item widgets all have an API flaw: getters and setters for the text alignment deal with int instead of Qt::Alignment. Deprecate the existing setters and introduce others taking Qt::Alignment. Store the alignment directly into the item widget (now that views know how to handle it). We can't change the getters without cluttering the API, so make that a Qt 7 change. Users can prepare by forcibly casting the return value to Qt::Alignment; this is going to work in Qt 6 and 7. While at it: streamline the handling of Qt::CheckStateRole as well, avoiding to rely on a pointless Qt::CheckState to int conversion through QVariant (the setter stores a Qt::CheckState, but the getter retrieves an int and converts it to a Qt::CheckState). Task-number: QTBUG-75172 Change-Id: I9f29e818e93cb2dc1d8e042bc320162c2f692112 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QKeySequence: Fix the one-off error in the mac glyph array sizeLaszlo Papp2022-05-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | It seems that the size of the corresponding array in the code has a one-off error. This is now fixed. The end of the array passed to lower_bound is wrong because the hard-coded size is size + 1. However, the end is array + size. This is what lower_bound expects from an array. Or any other algorithm for that matter expecting the end of a container as an argument. This can cause issues with something like lower_bound because a potential "empty" fill is not sorted as lower_bound would expect the data structure. It could have been fixed by decreasing the size by one, however it is a more future-proof solution to avoid hard-coding the size and just use std::size(array) instead. Pick-to: 5.15 6.2 6.3 Change-Id: I1d25a5b1a80a3b2634b229e0718108ad5e7808a0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add QTextDocFragment::to/fromMarkdown() & QTextCursor::insertMarkdown()Shawn Rutledge2022-05-144-6/+88
| | | | | | | | | | | | | | | | | | | | | Also add the beginnings of an autotest for QTextCursor::insertHtml(), for comparison purposes. We can see that the block to be inserted is merged with an existing block by default rather than being inserted as a new one, with both HTML and Markdown insertions. So now we test for leading and trailing newlines in the markdown to be inserted, to determine whether we need a new block into which to insert, and to "hit enter" at the end of the insertion. QSKIP the toMarkdown() comparisons if GeneralFont is mono. This happens on Boot2Qt systems in CI. Task-number: QTBUG-76105 Task-number: QTBUG-94462 Task-number: QTBUG-100515 Task-number: QTBUG-103484 Change-Id: I51a05c6a7cd0be4f2817f4a922f45fa663982293 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add floating point color space conversionsAllan Sandfeld Jensen2022-05-143-17/+311
| | | | | | | | | | This allows color space conversions that produces values outside the 0.0->1.0 range, which is one of the intended functions of the floating point image formats. Change-Id: I63b37b0f6934d4382edafb4709486c785a637c67 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Use correct condition for the qopengles2ext.h fileAlexey Edelev2022-05-131-1/+5
| | | | | | | Amends b98706f12207112645cc02a6df4868ebda2db8be Change-Id: I5d7af699d0afed4deebc5afd39725f1af68833b5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add variadic template overloads for QJniObject/Environment methodsVolker Hilsheimer2022-05-134-191/+301
| | | | | | | | | | | | | | | | | | | | | | | | | This allows the compiler to deduce the template arguments based on the provided method parameters, which we can then pass to the methodSignature and fieldSignature helpers to generate the signature string completely at compile time. Since we can't partially specialize template member functions, replace the specializations for void methods with compile-time-if branches in the general templates. This variadic template now prevents implicit conversion from the LiteralStorage types to const char* signatures, so catch the case where such a type ends up in the parameter list. Due to overload resolution rules for constructors, we need to explicitly disable the constructor if any of the arguments is a string literal type, as we have to keep the old C-style variadic function working for such calls. Add variations that use the variadic templates to the unit tests. Change-Id: I8734664b38bae932369462330a9a03302254c33c Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QVersionNumber: de-inline QList constructor calls and resize()Marc Mutz2022-05-132-12/+36
| | | | | | | | | | | | | | | | | | | The QList<int> range ctor and other QList<int> methods have percolated up near the top of the list of Clang -ftime-trace most expensive template instantiations in PCH libQt6Gui.so builds: **** Templates that took longest to instantiate: [...] 5138 ms: QList<int>::QList<const int *, true> (256 times, avg 20 ms) 4327 ms: QtPrivate::QCommonArrayOps<int>::appendIteratorRange<const int *> (256 times, avg 16 ms) The code in 6.3 is already sufficiently different for this patch to not be applicable there. Task-number: QTBUG-97601 Change-Id: I4420c8c90e472ecfd679b414cc4334d2ab55cce3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QObject: mark two error reporting functions COLDMarc Mutz2022-05-131-0/+2
| | | | | | | | | | | | | | They already nicely factored this error-only code from the normal path of execution. All that was missing was for them to be marked as COLD, so the compiler moves them out of the way even further, and optimizes them for size, not speed. TEXT size savings: ~400b on GCC 11.2 and ~500b on Clang 10 optimized C++20 AMD64 Linux builds. Pick-to: 6.3 6.2 5.15 Change-Id: I64a4123645855b4e34fbb0bc3304d144d7191a0d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix versioning of PixelScrollKai Köhne2022-05-131-1/+1
| | | | | | | | | | \since will mark the whole enum as new in 6.2 Amends 673ed80fa42a77c Pick-to: 6.2 6.3 Change-Id: I88bd73d3bf8b0da355e3200b7a9b67fc141a2b93 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* XCB: fix leaked QXcbScrollingDevicePrivateLiang Qi2022-05-132-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | ==1585319== 1,112 (720 direct, 392 indirect) bytes in 2 blocks are definitely lost in loss record 110 of 123 ==1585319== at 0x483EF2F: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==1585319== by 0x7D01D6C: QXcbConnection::xi2SetupSlavePointerDevice(void*, bool, QPointingDevice*)::{lambda()#1}::operator()() const (qxcbconnection_xi2.cpp:262) ==1585319== by 0x7D025C2: QXcbConnection::xi2SetupSlavePointerDevice(void*, bool, QPointingDevice*) (qxcbconnection_xi2.cpp:316) ==1585319== by 0x7D03D2D: QXcbConnection::xi2SetupDevices() (qxcbconnection_xi2.cpp:499) ==1585319== by 0x7CE81A3: QXcbConnection::QXcbConnection(QXcbNativeInterface*, bool, unsigned int, char const*) (qxcbconnection.cpp:105) ==1585319== by 0x7D27BEA: QXcbIntegration::QXcbIntegration(QList<QString> const&, int&, char**) (qxcbintegration.cpp:199) ==1585319== by 0x7C9D282: QXcbIntegrationPlugin::create(QString const&, QList<QString> const&, int&, char**) (qxcbmain.cpp:56) ==1585319== by 0x4B516DE: QPlatformIntegration* qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin, QList<QString> const&, int&, char**&>(QFactoryLoader const*, QString const&, QList<QString> const&, int&, char**&) (qfactoryloader_p.h:108) ==1585319== by 0x4B512A9: QPlatformIntegrationFactory::create(QString const&, QList<QString> const&, int&, char**, QString const&) (qplatformintegrationfactory.cpp:71) ==1585319== by 0x4B074EC: init_platform(QString const&, QString const&, QString const&, int&, char**) (qguiapplication.cpp:1209) ==1585319== by 0x4B0A646: QGuiApplicationPrivate::createPlatformIntegration() (qguiapplication.cpp:1491) ==1585319== by 0x4B0A7C9: QGuiApplicationPrivate::createEventDispatcher() (qguiapplication.cpp:1508) ==1585319== by 0x568853F: QCoreApplicationPrivate::init() (qcoreapplication.cpp:847) ==1585319== by 0x4B0A89F: QGuiApplicationPrivate::init() (qguiapplication.cpp:1532) ==1585319== by 0x4B05D16: QGuiApplication::QGuiApplication(int&, char**, int) (qguiapplication.cpp:653) ==1585319== by 0x451613: main (tst_qmetatype.cpp:2141) Fixes: QTBUG-95468 Pick-to: 6.3 6.2 Change-Id: I7e0b82c2d2fe464082d8fffd1696c0122c3b35b7 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qtloader.js: remove "getProcAddress" error filteringMorten Sørvig2022-05-131-6/+0
| | | | | | | | | Emscripten no longer prints an error for each getProcAddress lookup failure and this code can be removed. Change-Id: I082f420772677196c8eb82c49546825c750377ae Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* qtloader.js: forward stdErr to console.warn()Morten Sørvig2022-05-131-1/+1
| | | | | | | | | This is the correct mapping, and as a bonus the Chrome browser provides a stack trace on all output from console.warn(). Change-Id: I4a1b95475679d6b54a0690f51c23683514fe7985 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: David Skoland <david.skoland@qt.io>
* Fix removal of trailing slashMarcus Tillmanns2022-05-131-6/+6
| | | | | | | | | | | | The fsevents implementation of QFileSystemWatcher on Mac OS X tries to remove trailing slashes from the paths when calling addPaths(). If the user tries to watch "/", the path is changed to "". The fix checks whether the path is longer than 1 before removing trailing slashes. Change-Id: Iafb10e449c4f3bd600b02edbe7c549911db05048 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray: Move unique_ptr<void, free_deleter> to QVLABaseBaseMarc Mutz2022-05-131-4/+6
| | | | | | | | | | | | | | | | | This avoids repeated re-instantiations of unique_ptr with local deleters, removing that instantiation from the top of the list in Clang -ftime-trace QtWidgets builds: **** Templates that took longest to instantiate: 2627 ms: std::__1::unique_ptr<void, free_deleter> (835 times, avg 3 ms) Amends e297e80fd0ec6ce4c97ee1b40426c76377b45ecc. Pick-to: 6.3 Task-number: QTBUG-97601 Task-number: QTBUG-99039 Change-Id: I1281f6cf9248a3796d9dfdc653f19f5a67dc3bda Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* wasm: fix specialHtmlTargets codeMorten Sørvig2022-05-121-3/+2
| | | | | | | | Remove .as_handle() call, which was left over from the previous EM_ASM-based code; see 0ec75f4b9. Change-Id: I220304074f4d17e706726dab086c0330edc9ef25 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Revert "MySQL: pedantism: create and destroy the MYSQL_TIME type"Thiago Macieira2022-05-121-7/+3
| | | | | | | | | | This reverts commit 6feb28918924d80c94b6f435bc3bc981855d59d6. It causes a crash when field.myField is null. Fixes: QTBUG-102489 Pick-to: 6.3 Change-Id: I7e305799c8594ebab255fffd16ee1a41cac8d387 Reviewed-by: Andy Shaw <andy.shaw@qt.io>