summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* a11y uia: Bridge QAccessibleSelectionInterfaceMichael Weghorn2023-07-183-46/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bridge QAccessibleSelectionInterface that was introduced in commit 9d16d5e2245c26e5746fd7609300b84a2a983457 to UIA's ISelectionProvider and ISelectionProvider2 interfaces by extending the existing WindowsUiaSelectionProvider to make use of the QAccessibleSelectionInterface. Also make use of that interface to implement handling for the ISelectionProviderItem interface methods when an object has a parent that implements the QAccessibleSelectionInterface. Sample use from NVDA's Python console [1] with this commit in place: 1) start NVDA 2) run the interview example (examples\widgets\itemviews\interview\interview.exe) 3) select "Item 1:0", "Item 2:0" and "Item 3:0" by left-clicking on "Item 1:0" in the left view, then shift+clicking on "Item 3:0". 4) press Numpad_insert+control+z to start the NVDA Python console and capture snapshot variables 5) query and use the interfaces using NVDA's Python console: >>> import UIAHandler >>> selectionpattern2 = focus.parent.UIAElement.GetCurrentPattern(10034).QueryInterface(UIAHandler.IUIAutomationSelectionPattern2) >>> selectionpattern2.CurrentFirstSelectedItem.CurrentName 'Item 1:0' >>> selectionpattern2.CurrentLastSelectedItem.CurrentName 'Item 3:0' >>> selectionpattern2.CurrentItemCount 3 >>> selectionitempattern = focus.UIAElement.GetCurrentPattern(10010).QueryInterface(UIAHandler.IUIAutomationSelectionItemPattern) >>> selectionitempattern.CurrentIsSelected 1 >>> selectionitempattern.RemoveFromSelection() 0 >>> selectionitempattern.CurrentIsSelected 0 >>> selectionpattern2.CurrentItemCount 2 >>> selectionitempattern.Select() 0 >>> selectionitempattern.CurrentIsSelected 1 (Note that calling selectionitempattern.AddToSelection in that example would also unselect all other currently selected entries, because the underlying implementation has a selection mode of QAbstractItemView::SingleSelection set in QAccessibleTree::selectRow, which gets called from QAccessibleTable::select via QAccessibleTableCell::selectCell.) [1] https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#PythonConsole Change-Id: I7003bae5bbcfd5c685620bf710781165ed70f106 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* a11y uia: Support ISelectionProvider2Michael Weghorn2023-07-185-2/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support UIA's ISelectionProvider2 interface [1] in addition to ISelectionProvider. The ISelectionProvider2 interface inherits from the ISelectionProvider interface. A follow-up commit that will introduce bridging the QAccessibleSelectionInterface, introduced in commit 9d16d5e2245c26e5746fd7609300b84a2a983457. While at it, also reserve space for the amount of children in the QList in QWindowsUiaSelectionProvider::GetSelection before inserting them one by one, to avoid reallocations. Sample use of the ISelectionProvider2 interface from NVDA's Python console [2] with this commit in place: 1) start NVDA 2) run the gallery example (examples\widgets\gallery\gallery.exe) 3) click on the "Style" listbox at the top 4) press Numpad_insert+control+z to start the NVDA Python console and capture snapshot variables 5) query and use the interface using NVDA's Python console >>> import UIAHandler >>> iselection2 = focus.parent.UIAElement.GetCurrentPattern(10034).QueryInterface(UIAHandler.IUIAutomationSelectionPattern2) >>> iselection2.CurrentItemCount 1 >>> iselection2.CurrentFirstSelectedItem.CurrentName 'windowsvista' >>> iselection2.CurrentLastSelectedItem.CurrentName 'windowsvista' [1] https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nn-uiautomationcore-iselectionprovider2 [2] https://www.nvaccess.org/files/nvda/documentation/developerGuide.html#PythonConsole Change-Id: I43642e9e39b63c65da97af976cc322a8e5868170 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Handle authenticate challenge for NegotiateMårten Nordheim2023-07-181-1/+2
| | | | | | | | | | | | | | | | | Because we didn't handle Negotiate in the "Start" phase during handleAuthenticateChallenge, we would not emit the auth signal before our second attempt, assuming the server prompts us for one. Emitting the authenticationRequired signal is needed for users to be able to set the Service Principal Name (SPN) option. Alternatively, username and password if not relying on Single sign-on. Done-by: Emil Wipplinger <> Pick-to: 6.6 6.5 Fixes: QTBUG-114559 Change-Id: I833c08dfeda36a6548c5ad6b8af4b8aa9d644c45 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QGenericUnixThemesDBusListener: Remove stray qDebug()Axel Spoerl2023-07-181-1/+0
| | | | | | | | Remove a stray qDebug() statement, that was forgotten in the source. Pick-to: 6.6 6.5 Change-Id: I5c413b4356f05570474fa2a0d6ad661785c818b0 Reviewed-by: Liang Qi <liang.qi@qt.io>
* QMutex: add missing <chrono> includeIvan Solovev2023-07-181-0/+2
| | | | | | | | | | std::chrono is still used in the header. Do not rely on transitive includes, instead include the header explicitly. Pick-to: 6.6 Change-Id: If9140499e5dccf0065a4826831d3b83813910318 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QSemaphore: add missing <chrono> includeIvan Solovev2023-07-181-0/+2
| | | | | | | | | | std::chrono is still used in the header. Do not rely on transitive includes, instead include the header explicitly. Pick-to: 6.6 Change-Id: I2cf5dc275c3272151efd655a4fa85936942c5708 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix warning in recently-added testlib snippetEdward Welbourne2023-07-181-4/+4
| | | | | | | | | | | | Amends commit fa296ee1dcf4c16fb6f242cf08949485e499fec3 to implement MyObject::startup(), mark it void (its return was ignored) and flag its static wrapper as [[maybe_unused]] to calm a compiler warning. As a drive-by, fix indentation of the class definition. Change-Id: I3918bf8a4625a7e2b4e6d4e0cbfa68a337115865 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Make Qt headers work with MSVC /W4Kai Köhne2023-07-182-19/+28
| | | | | | | | | | | | | | | This requires explicitly marking constexpr if conditions to fix C4127 issues: qtbase/src/corelib/text/qstringbuilder.h(112): error C2220: the following warning is treated as an error qtbase/src/corelib/text/qstringbuilder.h(112): warning C4127: conditional expression is constant qtbase/src/corelib/text/qstringbuilder.h(112): note: consider using 'if constexpr' statement instead Change-Id: I9787fb37099f811c52f93c94c9edb4da8aafdfe5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use new QByteArray::assign() in QTlsBackendOpenSSL::dhParametersFromPem()Marc Mutz2023-07-181-1/+1
| | | | | | | | | | | QBA::assign() re-uses existing unshared capacity(), if any, and is therefore potentially more efficient than = QByteArray(.,.) (and never slower). Pick-to: 6.6 Task-number: QTBUG-106201 Change-Id: I2c45aa268c4c06396e9d7e0490666a13d8cfd532 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSslDiffieHellmanParameters: fix mem-leakMarc Mutz2023-07-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Says ASAN: Direct leak of 524 byte(s) in 1 object(s) allocated from: #0 0x7f708f0a67cf in __interceptor_malloc ../../../../gcc/libsanitizer/asan/asan_malloc_linux.cpp:145 #1 0x7f707d94bf9e in CRYPTO_malloc crypto/mem.c:196 #2 0x7f707d7bd248 in asn1_item_flags_i2d crypto/asn1/tasn_enc.c:65 #3 0x7f707d7bd1b7 in ASN1_item_i2d crypto/asn1/tasn_enc.c:45 #4 0x7f707d85b7be in i2d_DHparams crypto/dh/dh_asn1.c:54 #5 0x7f7075a82223 in q_i2d_DHparams(dh_st*, unsigned char**) qsslsocket_openssl_symbols.cpp:435 #6 0x7f7075a82223 in QTlsBackendOpenSSL::dhParametersFromPem(QByteArray const&, QByteArray*) const qssldiffiehellmanparameters_openssl.cpp:139 #7 0x7f708ca9b588 in QSslDiffieHellmanParametersPrivate::initFromPem(QByteArray const&) qssldiffiehellmanparameters.cpp:285 #8 0x7f708ca9b588 in QSslDiffieHellmanParameters::fromEncoded(QByteArray const&, QSsl::EncodingFormat) qssldiffiehellmanparameters.cpp:94 #9 0x55fd8a545ebe in tst_QSslDiffieHellmanParameters::constructionPEM() tst_qssldiffiehellmanparameters.cpp:98 [...] The pointer returned in the out-parameter of a i2d_DHparams() call is supposed to be OPENSSL_free()ed by the user (this is not at all obvious from the docs¹, but an SO answer² indicates that's how it should be (as well as asan stopping from complaining with this patch applied)). ¹ https://www.openssl.org/docs/man3.1/man3/i2d_DHparams.html ² https://stackoverflow.com/a/53563669. Amends 2cf63c71ebe139890526057dcc51b24ea6df6c30. [ChangeLog][QtNetwork][SSL] Fixed a memory leak in parsing of PEM-encoded Diffie-Hellman parameters. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I9ed4a26c4676db1c0d54a1945a4fb5014ce568cd Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Provide QStringConverter equivalent of QTextCodec::availableCodecsFabian Kosmale2023-07-182-0/+61
| | | | | | | | | | | | A text editor commonly wants to display a list of codecs that are supported. With the introduction of the ICU based QStringConverter, that list is no longer statically known. So provide the necessary functionality. Fixes: QTBUG-109104 Change-Id: I9ecf59aa6bcc6fe65c8872cab84affafec4fa362 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* SlotObjectGuard: mark ctor nodiscardMarc Mutz2023-07-181-1/+1
| | | | | | | | QUIP: 19 Pick-to: 6.6 Change-Id: Idaf8cda12fe2ca97a763d78ff4c8cd7304d178e5 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Treat simple spaces as equivalent in date-time format separatorsEdward Welbourne2023-07-171-2/+24
| | | | | | | | | | | | | | | | The user might not be aware of, or able to see, the difference between Unicode's assorted horizontal spacing characters, leading them to expect their input to be accepted for a format despite differences in spacing. So treat the various horizontal spacing (other than tab) characters as equivalent when matching the separators in a date-time format. Add a test-case that failed before this fix. Fixes: QTBUG-114909 Pick-to: 6.6 6.5 Change-Id: I3e798d3e5b89adb8e86168ebd3954904b258d630 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* QDTP: Fix handling of no-digit numeric fieldsEdward Welbourne2023-07-171-14/+35
| | | | | | | | | | | | | | | | | | | A numeric field with no digits is Intermediate, since digits can be typed into it. The testing for this was complicated by the fact that a sign might be either a sign in the field or the start of a following separator. Break out the testing of separator matching at the start of a view. This simplifies the existing checks for full separator match and we can use it in the no-digit numeric field's handling to make the check more robust (matching the whole separator, rather than only its first character). It incidentally prepares the way for other changes. Pick-to: 6.6 6.5 Task-number: QTBUG-114909 Change-Id: I5abfccbcae3cba0979b4723c400de038fe2bf324 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix wrong scan code values in key events obtained on WindowsLi Yefeng2023-07-171-5/+13
| | | | | | | | | | | The scan code (Windows) value depends on the extended-key flag (KF_EXTENDED 0x0100) in the key message. This flag was kept in scan code value, which is wrong. It is not part of scan code, and when it's on, another byte 0xE0 should be prepended to scan code. See: https://learn.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#extended-key-flag Change-Id: Iddcabb0aae92bb784883bddc9a34fe134d787b32 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Explicitly specify the alignment of QUuid::Id128Bytes unionIvan Solovev2023-07-171-1/+1
| | | | | | | | | | | | | | ... because otherwise the union can change its alignment based on the presence of the data128 member. For example, QtBluetooth explicitly #undef's __SIZEOF_INT128__ in its removed_api.cpp, which leads to UB without this patch. Found during API review Pick-to: 6.6 Change-Id: Ia17122cc9f3d422530cf722ea528591fce7ab7ff Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUuid: handle quint128 and Id128Bytes data in the same wayIvan Solovev2023-07-171-15/+29
| | | | | | | | | | | | | | | | | | The QUuid(quint128) ctor was handing the incoming data differently from the QUuid(Id128Bytes) ctor. Same was valid for the return values of QUuid::toUint128() vs QUuid::toBytes(). The provided test didn't reveal it, because it was treating the same 128-bit input value as BE in one place, and as LE in another place. This patch fixes the test, and updates the implementation of QUuid(quint128) ctor and toUInt128() method to verify that the updated test passes. This commit amends 8566c2db85a6f579a1a0432d0b7621633158e04c Pick-to: 6.6 Change-Id: I24edb8ba0c8f7fd15062ba0b2a94ad387c3e98b6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUuid: remove pointless inline keywordIvan Solovev2023-07-171-2/+2
| | | | | | | | | | constexpr functions are implicitly inline Found during API review. Pick-to: 6.6 Change-Id: I94daa0a67336fa99a1465115edb83e545580a78a Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Testlib: Make QTEST_ASSERT usable in constexpr functionsKai Köhne2023-07-171-3/+2
| | | | | | | | | | | Commit 8ea27bb1c669e21100a6a042b0378b3346bdf671 adapted the definition of Q_ASSERT already. Adopt the same logic for QTEST_ASSERT. Pick-to: 6.5 6.6 Change-Id: I5a5d0f62df79b18635d3b426a439c35b25d739c2 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* wasm: Render Qt::SubWindow borderlessPiotr Wierciński2023-07-172-5/+16
| | | | | | | | | Windows with Qt::SubWindow flag should not have platform decoration. Fixes: QTBUG-115054 Pick-to: 6.5 6.6 Change-Id: I7111df6057a087080194c1d46e350df839bec437 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Adapt setBackingStore() overrides in QWasmWindow and QEglFSWindowAxel Spoerl2023-07-164-3/+15
| | | | | | | | | | | This is a follow up to a4ca9e80658bca7dad1529f03c1b59173a6ecf62, adapting the backing store setters to become proper overrides of the newly implemented QPlatformWindow::setBackingStore(); Pick-to: 6.6 Change-Id: Id4f5ff8650ca4e4d3cab1d71d27041c6129bf4ea Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QCborValue: fix memleak on Array to Map coercionMarc Mutz2023-07-151-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When converting from an array to a map, we double the number of elements, spread the old elements out to make one free slot of space in front of each, and then place Integer values counting from 0 into the free slots. The old code contained a loop that would add a strong reference to the original elements that happen to be containers and thus are ref-counted in the first place. But this additional strong reference is not needed: In both cases, detached or in-place, the detach() call that ensured unique ownership of 'map/dst' will have either directly or indirectly updated the ref-counts of the elements correctly, and the following loops just reshuffle the elements in the QList, they don't create new copies (QtCbor::Elements doesn't by itself manipulate container->ref, but even if it did, the copy would have increased, and the assignment of the Integers would have decreased, the ref-count again). Adding the strong ref without a user then caused the container members to be leaked. Fix by removing the loop. [ChangeLog][QtCore][QCborValue] Fixed a memory leak when an array was coerced into a map. Amends ccea34464075759424e61806c7bc98ee3e658670. Not picking to 6.4 as it's closed at this time. Fixes: QTBUG-115249 Pick-to: 6.6 6.5 Change-Id: I369c372e91c3f0cfe3c65f9b0ea8507d08fdaf48 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement virtual void QPlatformWindow::setBackingStore()Axel Spoerl2023-07-147-11/+29
| | | | | | | | | | | | | | | | | | QWidget re-uses an existing backing store. Platform windows depend on being associated to a backing store, in case they become toplevel windows. If a platform window gets deleted and re-created each time it is shown or hidden, it has to be manually associated to the re-used backing store. This patch partly reverts fbf0aeea7d3b38ced7a16fcd5c3e2e9b45536292. It removes Android specific code from QWidgetPrivate::create(), which has been added to suppress re-using backing stores in the absence of the new API. Fixes: QTBUG-97482 Pick-to: 6.6 Change-Id: Iaa1b7652efa120ec1955914c0383e8ccd8a41429 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QWidget: Don't re-use backing store on AndroidAxel Spoerl2023-07-142-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | QWidget re-uses backing stores created in QWidgetPrivate::create(). The Android platform plugin creates a new platform window, when a widget becomes a toplevel window. When it is hidden, the platform window is deleted. The link between QAndroidPlatformWindow and its backing store is made in the constructor of QAndroidPlatformBackingstore. When a new QAndroidPlatformWindow is constructed and the backing store is re-used, there is no more link between platform window and platform backing store. This has lead to screen assets not being painted, when shown more than once. This patch forces QWidgetPrivate::create() to construct a new backing store on Android. This way, toplevel windows always have a backing store associated with it. It adds an assertion to QAndroidPlatformScreen::addWindow(). That will make e.g. tst_QWidget::visible() crash without the fix. Fixes: QTBUG-97482 Pick-to: 6.6 6.5 6.2 Change-Id: Ib1b172068b03549df161ab93ac24a273221d5423 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QNativeIpcKey: add implicit default ctorDennis Oberst2023-07-141-1/+5
| | | | | | | | | | | | Add an implicitly callable default ctor, to enable default returns, but still disallow implicit conversion whilst assigning: QNativeIpcKey k = QNativeIpcKey::Type::~~ // not allowed auto fn = []() -> QNativeIpcKey { return {}; } // allowed Pick-to: 6.6 Change-Id: I0f8476a588b3931f0e1f41a6c3a3fd8f2eb75b93 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QNativeIpcKey: make isEmpty() and isValid() noexceptDennis Oberst2023-07-141-2/+2
| | | | | | | | They have no preconditions and cannot throw. Pick-to: 6.6 Change-Id: I9c3020e00cffc84dfc3a14469cbb80557a4df5cf Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* a11y uia: Bridge newly added relations to UIAMichael Weghorn2023-07-132-0/+32
| | | | | | | | | | | | | | | | Support UIA property IDs UIA_DescribedByPropertyId, UIA_FlowsFromPropertyId and UIA_FlowsToPropertyId by using the Qt relation types newly introduced in f5358e5932bc8701621389c265c4ea86c92c536c. As described in f5358e5932bc8701621389c265c4ea86c92c536c and afbfe30093d49eff0ec4c28c220d33c233b9f807 for AT-SPI, the relation type needs to be "inverted" for UIA just the same, since Qt's semantics is the other way around. Task-number: QTBUG-105864 Change-Id: Id557389af6609197f4c3b37741e4201028627004 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* tst_QThread: Unbreak UBSan buildMarc Mutz2023-07-131-1/+1
| | | | | | | | | | | | tst_QThread peeks into QThreadPrivate, which means that a UBSan build needs access to QThreadPrivate's type_info, for which we need to export the class. Amends 268ff00ef50a74ffa58e53c2c8897b7a7319be41. Pick-to: 6.6 6.5 Change-Id: Ic26df3d323d50b51d369d5f2bd78db7e047b5341 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QBasicFutureWatcher: get rid of the PrivateMarc Mutz2023-07-131-23/+12
| | | | | | | | It's not needed anymore, because the class is no longer part of the ABI. Pick-to: 6.6 Change-Id: Idfacc6023288ce603b30ab5aa904106e8c850444 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QNativeIpcKey: add missing noexcept to swapDennis Oberst2023-07-131-1/+1
| | | | | | | Pick-to: 6.6 Change-Id: I57d5f22823597a56d93fc2f8f30b538684ce77ad Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* String-like containers: add implicit conversions towards std:: string viewsGiuseppe D'Angelo2023-07-138-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In C++20 std::basic_string_view has gained a range constructor (like QStringView always had), but that range constructor has been made explicit. This means we can't just pass a QString(View) to a function taking a u16string_view. The consensus seems to be that that types that should implictly convert towards stdlib's string views should do that via implicit conversion operators. This patch adds them for * QByteArrayView => std::string_view * QString(View) => std::u16string_view * QUtf8StringView => std::string_view or std::u8string_view, depending on the storage_type QLatin1StringView doesn't have a matching std:: view so I'm not enabling its conversion. QByteArray poses a challenge, in that it already defines a conversion towards const char *. (One can disable that conversion with a macro.) That conversion makes it impossible to support: QByteArray ba; std::string_view sv1(ba); // 1 std::string_view sv2 = ba; // 2 because: * if only operator const char *() is defined, then (2) doesn't work (situation right now); * if both conversions to const char * and string_view are defined, then (1) is ambiguous on certain compilers (MSVC, QCC). Interestingly enough, not on GCC/Clang, but only in C++17 and later modes. I can't kill the conversion towards const char * (API break, and we use it *everywhere* in Qt), hence, QByteArray does not get the implicit conversion, at least not in this patch. [ChangeLog][QtCore][QByteArrayView] Added an implicit conversion operator towards std::string_view. [ChangeLog][QtCore][QString] Added an implicit conversion operator towards std::u16string_view. [ChangeLog][QtCore][QStringView] Added an implicit conversion operator towards std::u16string_view. [ChangeLog][QtCore][QUtf8StringView] Added an implicit conversion operator towards std::string_view (QUtf8StringView is using char as its storage type in Qt 6). Note that QUtf8StringView is planned to use char8_t in Qt 7, therefore it is expected that the conversion will change towards std::u8string_view in Qt 7. Change-Id: I6d3b64d211a386241ae157765cd1b03f531f909a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Static build fix for RenderDoc dependencyHatem ElKharashy2023-07-131-1/+1
| | | | | | | | Modify configure.cmake to avoid breaking static builds while using RenderDoc with QGraphicsFrameCapture. Change-Id: Id0f39304b20ab3a98bfb0206cf5b52031d38f0ab Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Move QBasicFutureWatcher behind the ABI boundaryMarc Mutz2023-07-136-124/+83
| | | | | | | | | | | | ... and out of QtPrivate. No inline API requires it anymore, so move it into the only TU using it. Can't move it into the unnamed namespace because of the friend declaration in QFutureInterfaceBase. Pick-to: 6.6 Change-Id: I27452960492bc1193a4d0eaeb2acd913d4dd02a5 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* CMake: Fix error in qt_generate_deploy_app_scriptJoerg Bornemann2023-07-131-1/+6
| | | | | | | | | | | | | | | | ...when using a Qt cross-built for embedded Linux and NO_UNSUPPORTED_PLATFORM_ERROR set. Attempting to install such a project will now give the following output: -- Skipping runtime deployment steps. Support for installing runtime dependencies is not implemented for this target platform (Linux, shared Qt libs, cross-compiled). Pick-to: 6.5 6.6 Fixes: QTBUG-114069 Change-Id: Idd2af2135d2ca3cc0e5eeafb7701e891f8a0cc25 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QFuture: Extract Method watchContinuation() (DRY && SCARY)Marc Mutz2023-07-132-22/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code violated the following principles: - DRY: the same code occurred 3× in the code-base - SCARY: the vast majority doesn't actually depend on template arguments, causing template bloat Solve both with a tiered Extract Method. We cannot change the order of the operations performed on QBasicFutureWatcher, in particular not the connect() to the contination w.r.t. setFuture(), so we cannot leave the connect to the continuation lambda outside the function, as it would mean to also leave the setFuture() call outside. Thanks to Volker's makeCallableObject(), we can, however, type-erase the lambda using QSlotObjectBase, which is what connect() internally creates, anyway, therefore bringing the whole function behind the ABI boundary. As a non-QObject, non-QMetaObject friend, we're lacking support for actually doing something useful with a QSlotObjectBase, but that can be fixed in the implementation now. The interface is stable, which is what matters for 6.6 now. This will allow a subsequent commit to drag QBasicFutureWatcher behind the ABI boundary, unexporting it. Saves a whopping 8KiB in tst_qfuture text size on optimized C++20 Linux AMD64 GCC9 builds. Pick-to: 6.6 Done-with: Fabian Kosmale <fabian.kosmale@qt.io> Change-Id: I0e5c2564907d92f6938689ab249be11fc0332ba5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Arno Rehn <a.rehn@menlosystems.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QVariant: make customConstructShared() SCARY¹Marc Mutz2023-07-131-2/+8
| | | | | | | | | | | | | | | | | | | Extract Method non-template customConstructSharedImpl() to avoid instantiating std::unique_ptr with a different per-F Deleter over and over again. Not picking to 6.5 because the function was confined to the qvariant.cpp TU in those versions. Cf. 11791e2a50417661679f84aeae21ce959cab638f and d783363f60173f1bc6525f1a8bbbd87f1e3afc1d for similar issues. ¹ https://www.open-std.org/jtc1/sc22/WG21/docs/papers/2009/n2911.pdf Pick-to: 6.6 Change-Id: I73d21d929a7db2ab47f62a3246cf913d82e3db75 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRecursiveMutex: remove QDeadlineTimer::Forever leftoverMårten Nordheim2023-07-131-6/+0
| | | | | | | | | | | | | | | Amends 5f531ae2ac873c09deda096d292777422c4dee4d The overload taking QDeadlineTimer::ForeverConstant was required, prior to making it an enum class, because the conversion preferred 'int'. It was made an enum class for 6.6 and most overloads were removed, including the one for QMutex, but QRecursiveMutex was missed. Pick-to: 6.6 Change-Id: I4490dd3d7641c06346ea502f10c09915411319ad Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* ThreadPoolThreadReleaser: add Q_NODISCARD_CTORMarc Mutz2023-07-131-0/+1
| | | | | | | QUIP: 19 Pick-to: 6.6 Change-Id: I465a2ef8edc103f0655a7732f3aaaf18748854c4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "QUuid: use NSDMI to initialize the members"Ivan Solovev2023-07-121-5/+6
| | | | | | | | | | | | | | | | | This reverts commit c3c5d2cab07ffed1ddfb7978870c05917d89fa39. Reason for the revert - it breaks the purpose of the Qt::Uninitialized ctor The commit also updates the QUuid(quint128, QSysInfo::Endian) ctor to avoid the compiler errors: error: member ‘QUuid::data*’ must be initialized by mem-initializer in ‘constexpr’ constructor Pick-to: 6.6 Change-Id: I0057fab3d7203adaddad3e890129668923a9eef6 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add the 'version' argument to 'qt_deprecates' pragmaAlexey Edelev2023-07-121-11/+73
| | | | | | | | | | | | | | | | | | | | | | syncqt uses qt_deprecates pragma to generate deprecated header files that might live forever in Qt packages. This adds the version argument to the pragma, that allows specifying the version when the respective header file should be removed. The new pragma format is the following: pragma qt_deprecates(<header>[,<major.minor>]) If deprecation version of the deprecated header file is lower than the current Qt version, syncqt will display the respective warning in the log and skip generating the deprectated header file. Also the user warning message now displays the exact version when the header file will be removed. Task-number: QTBUG-115029 Pick-to: 6.6 Change-Id: Ifd7464b8539b8be93b95690fd1ca70ef0b14e436 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Don't set QT_BUILDING_QT for single standalone testsAlexandru Croitor2023-07-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Standalone test projects have the following condition in the beginning of their project: if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) find_package(Qt6BuildInternals COMPONENT STANDALONE_TEST) endif() When configuring the project the first time, QT_BUILDING_QT is not set, find_package is called, configuration succeeds. But because standalone projects implicitly include QtSetup.cmake, that file sets the QT_BUILDING_QT cache var to true, and upon test reconfiguration, cmake errors out with: Unknown CMake command "qt_internal_add_test" or similar. This happens because QT_BUILDING_QT is true on the second reconfiguration and the find_package mentioned above is not executed anymore, leading to unknown internal command errors. Set a new QT_INTERNAL_IS_STANDALONE_TEST variable when we detect a standalone test and check for its value in QtSetup so we don't set QT_BUILDING_QT to TRUE anymore. Adjust a few code locations where QT_BUILDING_QT being false might trigger different behavior for standalone tests. Task-number: QTBUG-93020 Change-Id: I5413b9f37653225175a1006f7626e023045b5979 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
* Add support for setting the initial directory in portal file dialogDavid Redondo2023-07-121-13/+12
| | | | | Change-Id: I2bceddb470e7870f19fc616e3dbae73cc057cb66 Reviewed-by: David Edmundson <davidedmundson@kde.org>
* moc: Print sterror(errno) when moc can't write the output fileAlexandru Croitor2023-07-121-3/+6
| | | | | | | | | | Also prepend a "Error:" label to all strrerror handling locations, to make it clear where the error starts. Pick-to: 6.2 6.5 6.6 Task-number: QTBUG-101926 Change-Id: I1a781b4c5716636eff4d47a6c8554dcbd51d2697 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* moc: Store errno after fopen callAlexandru Croitor2023-07-121-2/+8
| | | | | | | | | To avoid QFile::encodeName() potentially overriding the value. Pick-to: 6.2 6.5 6.6 Task-number: QTBUG-101926 Change-Id: Ie751df877d6624238ded344474b5eccc324ec541 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc fix: QDomDocument::ParseResult is false on errorEdward Welbourne2023-07-121-2/+2
| | | | | | | | | | | The documentation claimed the exact opposite of what the implementation did. Since callers use it the way it's implemented, fix the doc. Fixes: QTBUG-112895 Pick-to: 6.6 6.5 Change-Id: I74d6259727c7af7265224c6d79ba39265663704b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* rhi: metal: Remove out of date / unneeded commentLaszlo Agocs2023-07-121-7/+0
| | | | | | | | | | | E.g. the view.layer thread checker problems are eliminated for some time now. The other mentioned XCode warning is likely not there anymore with newer XCode. Whereas the rest (that we pass validation) should be obvious. Pick-to: 6.6 6.5 Change-Id: I9754077aa6e178ee2b866b64538991412af5bb5a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix build with latest MSVCVolker Hilsheimer2023-07-121-7/+7
| | | | | | | | | | Amend 813bbc515bdd8af843ef56115711691e926d0bcb. Unclear why this passed CI, but we can't use implicit conversion of string or character literals. Pick-to: 6.6 Change-Id: I1b3515e42b09a5caae1e632320b8251c27177f52 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* rhi doc: Make getShader in the snippets more compactLaszlo Agocs2023-07-122-6/+2
| | | | | | | | One line is better than three. Pick-to: 6.6 Change-Id: Ib738ec18b51accead3897b450b26207b3fba87d8 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Add porting documentation for QMacPasteboardMime/QWindowsMimeVolker Hilsheimer2023-07-121-0/+34
| | | | | | | Task-number: QTBUG-93632 Pick-to: 6.6 Change-Id: I38294aef304adea86ecf5fbb118024037afedfe8 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* ipc common: move end-of-namespace into same scope as startMårten Nordheim2023-07-121-1/+2
| | | | | | | | | To avoid issues building with shared memory & system semaphore disabled. Pick-to: 6.6 Change-Id: I525abe97f82266b8cca0e4f1847849054c016a4b Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>