17209 Commits

Author SHA1 Message Date
Joshua Goins
c50ede0b20 Add autotest for ensuring restoring cursor shapes doesn't regress
We now try to keep track of the cursor state for each window, but was
missing an autotest (modeled after QTBUG-133541.)

Pick-to: 6.8 6.9
Change-Id: I9d081f5a3cc8bdaa860d48beb5f105afa424f102
Reviewed-by: David Edmundson <davidedmundson@kde.org>
2025-05-28 16:34:45 +02:00
Edward Welbourne
6f8431b930 Modernize string usage in corelib/time/ tests
This incidentally lets me turn on QT_NO_CAST_{FROM,TO}_ASCII for them.

In the process, convert some test-cases to addRow() and use plain QBA
in place of newRow((QString arithmetic).toLocal8Bit().constData()),

Change-Id: I0117338dd927fc4eee74688ac86975508fa43b51
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-05-28 11:28:10 +02:00
Matthias Rauter
1ecbad8da9 Add TEST_ALL_COMPARISON to tst_qstringview
While porting some of these tests to QUtf8StringView, Thiago suggested
to add the comparison tests from qcomparisontesthelper_p.h.

Pick-to: 6.9 6.8
Change-Id: Id8f2c1c5690f7219ac000eebb637f48acbc5662d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-27 13:35:40 +02:00
Edward Welbourne
d4a54ba56a Deploy QCOMPARE_op() more widely in corelib/time/ tests
Exceptions:
* In tests of comparison operators themselves, still verify.
* Hash values aren't interesting to display.

Change-Id: I046be84f0f2637eddf57409895f20f164bda9a6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-26 21:12:52 +02:00
Piotr Wiercinski
fcb89d1560 wasm: Skip tst_QDir::mkdirOnSymlink
Skip this test temporarily to enable upgrading Emscripten to 4.0.7.

Change-Id: Ieb01a3d3d231828a127c5d7c1866cab547e22fb6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io>
2025-05-26 20:11:33 +02:00
Volker Hilsheimer
bdbe4c8858 QGIM: Rename to QRangeModel
As per the discussion on the mailing list [1], we want to avoid the word
"Generic" in class names. And QGIM is by design not using 'items', so
similar to e.g. QAbstractListModel or QSqlQueryModel, we don't need to
have "item" in the class name either.

It is a "Model", which is a well defined concept in Qt, that operates on
any C++ range, which is a well defined concept in C++. QRangeModel
is the best name.

Future evolutions on this API, e.g. adding a C++ template class that
provides an idiomatic C++ range API around the data while also updating
the Qt model, are not expected to be problematic by using this name.

[1] https://lists.qt-project.org/pipermail/development/2025-May/046322.html

Change-Id: Idaa70f8b2a30754cb28da13a0e6b0e22334afa11
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2025-05-26 16:11:27 +02:00
Even Oscar Andersen
e48c19449e wasm: Fix stacking order problem for transient parent windows
Windows with a transient parent does not reflect the relationship
in the stacking order. Essentially AboveTransientParent is missing
as a configuration choice.

What makes this slightly convoluted is that the window stack
does not depend on the window (for testability).

We solve this problem by making the stack and treenode templates,
and provide test class as arguments when testing.

QWasmWindow and QWasmScreen are not templated as before.

There is also a new order type StayAboveTransientParent. Which
means that we can no longer use order type to get to the
group location (Since StayAboveTransientParent can map to either
of the three types).

The window stack tests have been updated to handle the
StayAboveTransientParent type.

Finally, we do not do anything with a normal parent
child relationship as this should already work
correctly.

Fixes: QTBUG-131699
Change-Id: Ie08e18f9e0a2339175c4a09da0a831f031df71e1
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
2025-05-26 13:27:17 +02:00
Thiago Macieira
c8d3d7a7af QAbstractEventDispatcher: prevent too late unregistering of timers
Timers can't unregister when the dispatcher object is no longer of a
dispatcher type. It's too late even at ~QAbstractEventDispatcher,
because unregisterTimer() is a pure virtual. To prevent their attempting
to unregister, we set the thread's dispatcher to nullptr if it is this
object.

This has been a latent bug, so it's worth fixing. This started happening
for me with an un-pushed change that changed the order of how
QCoreApplication and QGuiApplication destroy the main thread event
dispatcher (namely, in their destructors, not waiting for ~QObject to
deleteChildren()).

Drive-by relax the store in QThread::setEventDispatcher().

Fixes: QTBUG-137130
Pick-to: 6.9 6.8
Change-Id: I8845736c38a931af62e3fffdfd3554874df89e8e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-05-25 13:24:27 -07:00
Alexey Edelev
e7b3a094a0 Restructure android tests
Change-Id: I14bc0db28dcc928771b14a6854ba1c53d76461a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-05-24 04:57:22 +02:00
Ahmad Samir
29a00e959b qdataurl: make parsing the content-type more robust
Don't assume `charset` is the first parameter. The parameters
(attribute=value pairs) are delemited by a `;`. The order of the
parameters isn't specified, (except for `;base64` which is the last
one).

Add more tests. Add a test for image/png (.png file copied from
src/widgets/styles/images/arrow-down-16.png).

Change-Id: Ie3e45c607c093695d0c180e9a9783b2b02d7ef70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-24 01:12:55 +03:00
Ahmad Samir
cec5066f32 qdataurl: treat comma as mandatory in the data URL syntax
In the syntax specified in https://www.rfc-editor.org/rfc/rfc2397.html:
data:[<mediatype>][;base64],<data>

The comma isn't inside square brackets, so not optional.

Change the unittests accordingly, "data:text/plain" isn't empty data,
it's rather malformed.

[ChangeLog][QtCore] Changed parsing 'data:' URLs to report failure if
the comma is missing, this makes it more compliant with RFC 2397.

[ChangeLog][QtNetwork][QNetworkManager] Changed parsing 'data:' URLs to
report failure if the comma is missing, this makes it more compliant
RFC 2397.

Change-Id: I91c45f42257de7840ab45c0f8eb31b8df3d483bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-24 01:12:55 +03:00
Ahmad Samir
71bcd74542 qdataurl: don't set the mime type too early
If there is no actual data to decode, setting the mime type is
redundant. Also only set the mime type to the default if none is
specified in the URL.

Change-Id: I19f7ae98c7f1f4483069f580bea028a84a719656
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-24 01:12:55 +03:00
Ahmad Samir
8df6859f08 Fix various compiler warnings
tst_QDebug: variable is only used conditionally

tst_QTimeZone: fix string literal format

QRhiWidgetPrivate: unused local variable `q`

Change-Id: I8f9d7f86df2ff781f8ab64bee44dbebbe67eb6f3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-24 00:12:55 +02:00
Tor Arne Vestbø
4a7ccb65f0 Lazily create global share context when Qt::AA_ShareOpenGLContexts is set
The requirement to set Qt::AA_ShareOpenGLContexts before creating QGuiApp
was forcing users to also set the default surface format before QGuiApp,
which prevents us from initializing a default surface format based on
the platform integration.

By creating the global share context lazily when requested via the
Qt::AA_ShareOpenGLContext application attribute we open up this
possibility.

Change-Id: I958639c997e96321013b1080c31e2533a36c13ff
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2025-05-23 17:42:46 +02:00
Oliver Wolff
73c5c15d68 QFileSystemModel: Handle drive root paths properly on Windows
Fetching a node that was a drive root path (C:/) ended in a wrong result
on Windows. Instead of the drive root the QFileSystemModel returned the
current working directory. This was due to the fact that the code in
QFileSystemModelPrivate::node stripped the /s from the "path elements".
As "C:" (in contrast to "C:/") is seen as a relative path on Windows
that lead to wrong results.

Pick-to: 6.9 6.8 6.5
Fixes: QTBUG-133746
Change-Id: I642a67853f31ad9b6710e2b5f696f22b1f60ead3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
2025-05-22 20:24:24 +02:00
Marc Mutz
82015992c8 tst_QScopedPointer: add a test for reset/delete ordering
We have implementation divergence with libc++'s ~unique_ptr()
behavior, so make sure QScopedPointer behaves the same way as
unique_ptr is spec'ed, even though to check it, one has to rely
on UB, at least according to LLVM devs (I don't think the test
as written invokes UB).

Code's a bit duplicated. I tried making the struct a template,
but it's just too much of a fuss (needs a variable template,
which we can't use in Qt 5), so I decided to use cut'n'paste.

Task-number: QTBUG-137069
Pick-to: 6.9 6.8 6.5 5.15
Change-Id: I8b55718eaf3c6ad9a4d89d4fc9d64f0c41bb21fa
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2025-05-22 12:08:48 +00:00
Ahmad Samir
1b66b6533e QString/QByteArray: add tests for replace() with negative lengths
Change-Id: I6bb67a65fdb0d61e1e1e36dd271c98df7849a305
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-20 23:30:49 +03:00
Ahmad Samir
ef0b8bc730 tst_QString: don't cast index/length to uint in replace() tests
Most of QString's API take by signed values, so let the tests match
reality.

Also, as pointed out in the code review, use qsizetype instead of int.

Pick-to: 6.9 6.8 6.5
Change-Id: I03cba8e35d080454506a35a956ad106fd9bb3246
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-20 23:30:32 +03:00
Christian Ehrlicher
3252e1808c QWidget: don't re-polish when style did not change
Don't call style->unpolish()/polish() when the old and new style did not
change which might happen when setting a style sheet as this might
create an infinite loop and the style (re)sets some window attribute.
Bailing out early is not an option here as newStyle might be a nullptr so q->style() will fall back to the application default style.

Pick-to: 6.9
Fixes: QTBUG-133332
Change-Id: Ifa9ee4fdfa64b2768337e2d90b7bbaac5f3fcd70
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-05-20 21:00:41 +02:00
Magdalena Stojek
263f06ae8b QXmlStreamWriter: add option to stop writing after an error
By default, QXmlStreamWriter continues writing even after encountering
an InvalidCharacter, EncodingError or CustomError, which contradicts
expected behavior.

This change introduces property stopWritingOnError with two new
functions: setStopWritingOnError() and stopWritingOnError(), allowing
users to control whether output halts immediately after the first such
error.

[ChangeLog][QtCore][QXmlStreamWriter] Added setStopWritingOnError() and
stopWritingOnError() functions.

Fixes: QTBUG-135861
Change-Id: Ia3ba894fc5bd8c5ff3a548e2585af9d435dec9b2
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-20 20:33:49 +02:00
Lars Schmertmann
ed76f816e6 Android: Avoid deprecation warnings (Space-assignment syntax)
Space-assignment syntax in Groovy DSL has been deprecated.
This is scheduled to be removed in Gradle 10.0.

Pick-to: 6.9
Change-Id: I2029af79b25351337c32db96053548ce5f4f47ae
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-05-20 20:33:49 +02:00
Marc Mutz
1285dbeb3c tst_QDataUrl: add a test with spaces around the charset parameter
Requested by Ivan Solovev in review.

Pick-to: 6.9 6.8 6.5 5.15
Change-Id: I2f3dee8aad16af6748faa7660e2508e8ecd1709f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-05-20 18:33:49 +00:00
Ahmad Samir
bee20b2137 tst_QByteArray: create separate tests for replace() overloads
Change-Id: I576230a3e130ddf8e0124a8a1174a99a64dc691e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-20 02:50:03 +03:00
Ahmad Samir
a15639a3ab QByteArray: make replace(pos, len, view) consistent with QString's
Return early if `pos` is out-of-bounds.

Amends 57d91d8029064b592dee8adf819bde676763df28 (also part of this
commit message was borrowed from it).

[ChangeLog][QtCore][Important Behavior Changes][QByteArray] replace()
is now consistent with QString::replace() in its treatment of
out-of-bounds indexes.

Change-Id: Iae8cf795364654fd6438b2a4ed3162925a73cb9e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-20 02:50:03 +03:00
Ivan Solovev
927798f5de QXmlStreamReader: try to keep the source encoding of the added data
The QXmlStreamReader(QAnyStringView) constructor, as well as the
QXmlStreamReader::addData(QAnyStringView) method were almost always
converting the UTF-16 and Latin1 data to UTF-8.

This commit tries to avoid unnecessary conversions by storing the
data together with its encoding.

As a result, we now have two decoders:
* a chunkDecoder is used when the encoding of the provided chunk
  is supplied along with the data;
* a document-global decoder is used when decoding raw data that
  is provided by QBA overloads. It tries to infer the encoding
  from the content, or explicitly uses the "encoding" attribute,
  if it was provided. This is the pre-existing behavior.

This patch has several corner-cases, mostly related to the fact
that the XML parser tries to read the XML prolog and extract the
encoding from it.
For example, what happens if we pass a QString (UTF-16 encoded)
that has an XML prolog with Latin1 encoding?

  const QString data =
      u"<? xml encoding=\"iso-8859-1\"?><foo>ÄÖÜ</foo>"_s;
  QXmlStreamReader reader;
  reader.addData(data);
  reader.readNextStartElement();
  const QString text = reader.readElementText();
  QCOMPARE(text, u"ÄÖÜ"_s);

The data inside the "<foo>" block can be represented by Latin1,
but because we used QString to store it, it's already in UTF-16.

This patch uses UTF-16 chunkDecoder to decode the data, but at
the same time sets the document-global decoder to Latin1, so
that the next raw data will be interpreted as Latin1.

At the same time, if the provided encoding is not recognized,
the document-global decoder is set to UTF-8, for backwards
compatibility.

The code path that uses an underlying QIODevice is unmodified.

The patch does not add any new public APIs, so theoretically can
be cherry-picked to older branches, but I'd prefer to have some
testing on the current dev to make sure that it does not introduce
any regressions.

Fixes: QTBUG-124636
Change-Id: I89bf0cbbcf21d7533d99e56b2522dcced9f675eb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-19 20:50:25 +02:00
Morten Sørvig
a65554044c wasm: enable previously disabled tests on WebAssembly
The supported configurations for running tests on WebAsssembly
are:

  * -device-option QT_EMSCRIPTEN_ASYNCIFY=1" [old way]
  * -feature-wasm-jspi -feature-wasm-exceptions.  [new way]

(Non-asyncify/JSPI configs may work for some tests, especially
non-GUI tests).

In general all tests are now enabled for the wasm build so that
we can run the tests locally, even tests which fail/crash/hang.

Use QT_BUILD_WASM_BATCHED_TESTS to disable tests which should
not run on CI.

Task-number: QTBUG-121822
Change-Id: I20fac091d4d55bd1c947eeeb128a42a382dc11f0
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2025-05-19 16:03:29 +00:00
Mårten Nordheim
b0b9adf066 Http2: remove any reference to HttpReply when deleted
Prior to switching the protocol handler to use QHttp2Connection this
particular issue (see bugreport) was not a problem because the handling
of the IO-device being destroyed was simply to drop any pointer to
it.
QHttp2Stream, however, also has to keep track of the lifetime of
the IO-device, because it needs to abort the stream if the data
it's uploading is destroyed earlier than expected.

Now, since QHttp2Stream might also have other errors come up, we
have to connect to the generic 'errorOccurred' signal from it and
handle whatever issues arise, notifying our users that the request
for some reason cannot be fulfilled.
It's thanks to this part that we were now, in certain cases,
grabbing a stale pointer to the HttpNetworkReply and trying to
call functions on it.

We fix this somewhat indirectly. Because, after a HttpReply is
destroyed, we shouldn't even have any references to it in the
first place. And while it would usually be done as part of
handling the deleted() signal, we actually disconnect from
HttpNetworkReply's signals when we have processed one of the
finished*() functions. But since we were still connected to the stream's
signals we would still try to handle it.
For the http1 protocol handler this was already handled in
QHttpNetworkConnection::removeReply, which the HttpNetworkReply itself
calls at start of destruction. The function will go through any place
that the reply can be referenced and removes it. For http/2 it would
remove it from the list of requests yet to be sent, but not from the
in-progress list. So, we now add a new virtual function to the
AbstractProtocolHandler and specialize it in Http2 to handle exactly
this.

Fixes: QTBUG-136549
Pick-to: 6.9.1 6.9
Change-Id: Ie41863677a3b163f77d10bc3904ca515f6840be3
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-05-19 13:03:27 +02:00
Elias Toivola
52fe1d9d9e Windows 11 24H2: skip crashing tst_qnetworkinformation_appless
Current Windows 11 24H2 build version is 26100. It is assumed Windows 11
25H2 build version will be >26200, this is added to the if-condition so
>25H2 will not be skipped.

Task-number: QTBUG-136628
Task-number: QTBUG-135599
Change-Id: I2d39fd4f9db546f2d7c7db17f6569708255579b3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-05-18 18:40:00 +03:00
Elias Toivola
0cd5788ab3 Windows 11 24H2: mark tst_QDnsLookup::lookupNxDomain as expected to fail
Task-number: QTBUG-136627
Task-number: QTBUG-135599
Change-Id: Ib336f6e8018d210a80d50fdd4c1c50f691232104
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-05-18 17:40:00 +02:00
Daniel Trevitz
1cd7e01c90 For qdebug operator<< of pointer types, always check for nullptr
Also, use a consistent syntax for when the pointer is null.

Fixes: QTBUG-135856
Change-Id: I2f5c80a5650b1be6cc0d70cde7cd1e1c1990df9a
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2025-05-17 04:26:29 +00:00
Volker Hilsheimer
7869593119 QDockWidget: don't emit visibilityChanged while in destructor
Amends 2c67d47ea15c6dc34cc20d8fbdb406efb19f11d7, after which we emitted
the signal, as the setParent(nullptr) call in the destructor would call
back into the QDockWidget::event override.

That change was correct, but we are now emitted signals while in the
destructor, after a potential subclass destructor was already completed.
This crashed applications that had slots connected to those signals.

While arguably an application problem (PMF connections need to be
disconnected explicitly), we can avoid this regression by blocking
the emission of that signal when already in the destructor.

Fixes: QTBUG-136485
Pick-to: 6.9.1 6.9 6.8 6.5
Change-Id: I6d5e98136beedc94c22287ccfd1198dd80f4f95e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-16 01:16:45 +03:00
Thorbjørn Lund Martsum
5b33c4e84c QLayout - Introduce vertical and horizontal layout constraints
In most situations the simple setSizeConstraint is
sufficient to get the sizeConstaint the user wants.
However in certain other situations the QLayout size constraint
demanding same vertical and horizontal behavior could simply
be extremely annoying.

This patch fixes a design-flaw as it makes perfectly sense
to have a fixed sized or minimum size constraint in one
orientation and having it something else (e.g minMax) in
the another.

Likely the old logic was that the user could use
setMinimumWidth and setMaximumWidth on the widget itself
(and similar for height) to get this behavior, but on 2+ monitor
systems with different DPR that is not really an option
(at least not a good one).

[ChangeLog][QWidgets][QLayout] Introduced a vertical and horizontal
size constraint in layout as the size constraint behavior can depend on
the orientation.

Fixes: QTBUG-17730
Change-Id: I8aefcd2b4df228494604b41e8ab7319e9f599d07
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-05-15 23:55:03 +02:00
Alexandru Croitor
c20d7bcb86 CMake: Adjust CMP0156 policy handling for Apple platforms
Backstory.

1) Starting with Qt 6.8, the prebuilt Qt for iOS SDK is built as
static framework bundles instead of static libraries. That is done so
that we can embed a privacy manifest into each framework bundle.

2) Up until CMake 3.28, CMake would not attempt to de-duplicate static
libraries (or frameworks) on the command line. Starting with CMake
3.29, the CMP0156 policy was introduced to allow such de-duplication.

3) Since a while ago, Qt had its own policy handling for CMP0156,
which it force sets to OLD, to disable any de-duplication. That was
done to avoid possible regressions on platforms where link order
matters.

4) A developer might add the -ObjC linker flag to a project, to ensure
the linker retains all Objective-C categories it encounters in all the
static libraries that were provided on the link line. Retaining in
this case means that the /whole/ object file of a static library will
be linked to the final executable.

5) The Apple ld linker (both the legacy and the new ld_prime one)
can't cope with duplicate static frameworks on the link line when the
-ObjC flag is used.
It ends up throwing duplicate symbol errors, from trying to link the
same object file from the same static framework more than once.
The linker works just fine if the link line contains duplicate static
libraries, rather than static frameworks.

6) When a project links against Qt6::Gui and Qt6::Core, the link line
will contain Qt6::Core twice. This gets even more involved, when
linking plugins, which cause static framework cycles, and thus a
framework might appear multiple times.

Thus, we have the situation that Qt forces the CMP0156 policy to OLD,
Qt6::Core appears multiple times on the link line, no de-duplication
is performed, the project adds the -ObjC flag, and the linker throws
duplicate symbol errors.

We can fix this by force setting the CMP0156 policy to NEW when
targeting Apple platforms and using CMake 3.29+.

A potential workaround for a project developer is to set the policy
to NEW manually in their project.
Unfortunately that doesn't work for older Qt versions.
That's because CMake applies the policy value when add_executable is
called, and the policy value in qt_add_executable is the one that is
recorded when the function is defined. And the recorded policy is
always OLD, because Qt6Config.cmake calls cmake_minimum_required with
VERSION up to 3.21, which resets the policy value to OLD.

So we have to force set the policy in qt_add_executable /
qt_add_library via the existing __qt_internal_set_cmp0156 function.

The __qt_internal_set_cmp0156 had some diagnostics to show a warning
when the user modifies the policy themselves, but this never worked
because of reason stated above: the policy value was always overridden
in Qt6Config.cmake.

To actually make the diagnostic work, there is now new code to save
the policy value in the current directory scope, before Qt resets
it.
This only works if a project uses the find_package(Qt6 COMPONENTS Foo)
signature. It won't work with a find_package(Qt6Core)-like signature.

The policy value is not modified for platforms other than Apple ones
for now.

Amends 9702c3c78b2c16db6a9d0515d7d7698d9b064cd8

Pick-to: 6.5 6.8 6.9
Fixes: QTBUG-135978
Change-Id: I4d6e6c2a01e7092b417fc669d2aea40cf2dca578
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-05-15 03:08:03 +02:00
Alexandru Croitor
15178c9919 CMake: Conditionally pass PATHS to FindWrapHelper package lookup
The setup:
- build Qt with '-static -qt-zlib'
- configure a user project with plain cmake and -DQt6_DIR pointing to
  the Qt6 package

In this case, the implicit find_dependency(BundledZlib) call will
fail with:

CMake Error at lib/cmake/Qt6/QtFindWrapHelper.cmake:120 (message):
  Can't find Qt6::BundledZLIB.
Call Stack (most recent call first):
  lib/cmake/Qt6/FindWrapZLIB.cmake:6 (qt_find_package_system_or_bundled)
  cmake/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:76
    (find_package)
  lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:36 (find_dependency)
  lib/cmake/Qt6Core/Qt6CoreDependencies.cmake:39
    (_qt_internal_find_third_party_dependencies)
  lib/cmake/Qt6Core/Qt6CoreConfig.cmake:42 (include)
  lib/cmake/Qt6/Qt6Config.cmake:233 (find_package)
  CMakeLists.txt:7 (find_package)

For example it would fail for the rasterwindow example configured with:
 cmake ~/qtbase/examples/gui/rasterwindow \
   -DQt6_DIR=$HOME/builds/dev-mac-static/qtbase/lib/cmake/Qt6

The failure happens because we don't pass any additional paths to the
find_package call that looks for BundledZlib, as opposed to how we do
it for module packages.

The project configuration does not fail if it is configured with any
of the following variables:
- Qt6_ROOT or
- CMAKE_PREFIX_PATH or
- the Qt generated toolchain file.

That's because these implicitly add relevant paths where to look for
Qt packages.

This came up in qtdeclarative RunCMake CI tests, where we only pass
Qt6_DIR to the test projects. It didn't come up in qtbase, because
none of the current qtbase RunCMake tests try to find Qt6Core.

To fix this particular case, conditionally pass the same paths that
Qt6Config.cmake uses when looking for module packages, to the
find_package call that looks for the bundled target.

We do it conditionally for bundled targets only, because for system
libraries we want to default looking for the module
FindWrapSystemFoo.cmake files.

Add a RunCMake test which will try to find a few Qt modules solely
based on having only Qt6_DIR set.

Pick-to: 6.8 6.9
Change-Id: I4d4e548f4c10370c4964ab8968b5772e26855dd4
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-05-15 03:08:03 +02:00
Tor Arne Vestbø
7cb1cacd97 Merge "Merge Wayland client from qtwayland repository into qtbase" 2025-05-14 20:58:39 +02:00
Ahmad Samir
2be51c6923 QSslCertificate: add fromFile() method
QSslCertificate::fromPath() does some extra work:
- matching wildcard glob or regular expression patterns
- checks if the string it's called on is a file or a dir

That extra work isn't needed when you already have the path to a
specific certificate file.
E.g. qtlsbackend_openssl.cpp:systemCaCertificates() used to call
fromPath() on *.pem/*.crt files that it got from iterating over system
certifcates dirs.

This also de-duplicates the code in fromPath().

[ChangeLog][QtNetwork][QSslCertificate] Added fromFile() method.

Change-Id: I92ab358e4711866dd4510da42c47905c7dae58b1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-05-14 04:41:13 +03:00
Thorbjørn Lund Martsum
0d61e8ec53 Fix QHeaderView auto section resize corner case
In some situations where the model is set sufficient late
an auto resize would never be applied. See bug report for
further details.

This is solved by moving to the normal memory model when
the global resize mode is changed to resizeToContents or stretch.

Fixes: QTBUG-136453
Pick-to: 6.9
Change-Id: Ie0448042a7d23b059eaf7464a662f0f551d89fd9
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2025-05-13 14:10:15 +02:00
Frédéric Lefebvre
5358c833c4 Unblacklist tst_qComboBox::popupPositionAfterStyleChange on Ubuntu
tst_qComboBox::popupPositionAfterStyleChange is no longer flaky on
Ubuntu.

Fixes: QTBUG-129029
Pick-to: 6.9 6.8 6.5
Change-Id: I3581fe73516d21d599dfb520fe53a0d855c811f6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-13 12:10:12 +00:00
Frédéric Lefebvre
8875e88b61 Unblacklist tst_qWidget_window::mouseMoveWithPopup on Ubuntu
tst_qWidget_window::mouseMoveWithPopup is longer flaky on Ubuntu.

Fixes: QTBUG-129568
Pick-to: 6.9 6.8 6.5
Change-Id: Iae9155e21de91ba8068dde622bbd41f3e454dbe2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-13 12:10:12 +00:00
Frédéric Lefebvre
3393d85108 Unblacklist tst_qWidget::saveRestoreGeometry on Ubuntu
tst_qWidget::saveRestoreGeometry() is no longer flaky on Ubuntu.

Fixes: QTBUG-126495
Pick-to: 6.9 6.8 6.5
Change-Id: I65e12e958aa028237f56a9e7b3824e9aa837b799
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-13 14:10:12 +02:00
Frédéric Lefebvre
cb1c184ee8 Unblacklist tst_qFileSystemModel::sort() on Ubuntu
tst_qFileSystemModel::sort() is no longer flaky on Ubuntu 24.

Pick-to: 6.9 6.8 6.5
Change-Id: I5a96cd06c78e2ff95d3d043cb6b11254946e5e19
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-13 12:10:12 +00:00
Liang Qi
2d79012542 Merge Wayland client from qtwayland repository into qtbase
The qtwayland repository has been filtered for commits relating
to the Wayland client, via the following git-filter-repo command:

 git filter-repo --paths-from-file wayland-move.txt --force --refs HEAD

And then merged into the qtbase repository via

 git merge --allow-unrelated-histories

The following git-filter-repo instructions have been used:

src/CMakeLists.txt
src/CMakeLists.txt==>src/platformsupport/wayland/CMakeLists.txt
src/configure.cmake
src/configure.cmake==>src/platformsupport/wayland/configure.cmake
src/client/Qt6WaylandClientMacros.cmake
src/client/Qt6WaylandClientMacros.cmake==>src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake
src/compositor/Qt6WaylandCompositorMacros.cmake
src/compositor/Qt6WaylandCompositorMacros.cmake==>src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake

src/3rdparty/
src/3rdparty/patches/==>src/3rdparty/wayland/patches/

src/3rdparty/protocol/ivi/REUSE.toml==>
src/3rdparty/protocol/ivi/ivi-application.xml==>
src/3rdparty/protocol/ivi/ivi-controller.xml==>
src/3rdparty/protocol/ivi/qt_attribution.json==>

src/3rdparty/protocol/
src/3rdparty/protocol/==>src/3rdparty/wayland/protocols/

src/extensions/qt-shell-unstable-v1.xml==>
src/extensions/
src/extensions/==>src/3rdparty/wayland/extensions/

src/client/
src/client/==>src/plugins/platforms/wayland/

src/global/
src/global/==>src/plugins/platforms/wayland/globalprivate/

src/shared/
src/shared/==>src/plugins/platforms/wayland/shared/

src/plugins/decorations/adwaita/==>
src/plugins/decorations/
src/plugins/decorations/==>src/plugins/platforms/wayland/plugins/decorations/
src/plugins/hardwareintegration/client/
src/plugins/hardwareintegration/client/==>src/plugins/platforms/wayland/plugins/hardwareintegration/
src/plugins/platform/
src/plugins/platform/==>src/plugins/platforms/wayland/plugins/platform/
src/plugins/shellintegration/qt-shell/==>
src/plugins/shellintegration/ivi-shell/==>
src/plugins/shellintegration/
src/plugins/shellintegration/==>src/plugins/platforms/wayland/plugins/shellintegration/
src/plugins/CMakeLists.txt
src/plugins/CMakeLists.txt==>src/plugins/platforms/wayland/plugins/CMakeLists.txt

src/qtwaylandscanner/
src/qtwaylandscanner/==>src/tools/qtwaylandscanner/

tests/auto/client/iviapplication/CMakeLists.txt==>
tests/auto/client/iviapplication/tst_iviapplication.cpp==>
tests/auto/client/shared/iviapplication.h==>
tests/auto/client/shared/iviapplication.cpp==>
tests/auto/client/
tests/auto/client/==>tests/auto/wayland/
tests/auto/cmake/test_waylandclient/
tests/auto/cmake/test_waylandclient/==>tests/auto/cmake/test_waylandclient/

Done-with: Alexandru Croitor <alexandru.croitor@qt.io>
Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Task-number: QTBUG-133223
Change-Id: I46c325724141fdbfcc117d12fb5f92852613e72a
2025-05-13 01:50:43 +02:00
Thiago Macieira
b10c7b1680 qtbase: use qHashMulti & qHashRange instead of QHashCombine
If we have no specific need for the private QHashCombine class, use the
front-end functions. For headers, we do have a need: we prefer
QHashCombine because it compiles faster.

Change-Id: I73578ea802d3b905a53bfffd504c20af0ca96cf8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-09 16:54:13 -07:00
Jacek Poplawski
01961aea8b update tst_QFile::supportsMoveToTrash for VxWorks 25.03
On VxWorks 25.03 AT_FDCWD is defined but the POSIX at* APIs needed for
trash support are still missing. Update tst_QFile::supportsMoveToTrash
to verify that QFile::supportsMoveToTrash() returns false on
Q_OS_VXWORKS, regardless of AT_FDCWD.

Fixes: QTBUG-136693
Change-Id: I33f418984887d87e42ecda494cd5b101c42d55e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-09 22:00:54 +02:00
Juha Vuolle
464e9298e2 Remove unnecessary widgets linking from autotests
Unconditional linking breaks build when widgets are disabled.
tst_localfileapi, tst_qwasmwindowstack, and tst_qwasmwindowtreenode
tests link against Qt::Widgets, but does not use them => remove.

Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: I6d895b5ddd85b3ace98e0e398d034006aee236e0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2025-05-09 10:06:51 +03:00
Frédéric Lefebvre
36d92169f3 Unblacklist tst_qcompleter::QTBUG_14292_fileSystem on openSuSe
tst_qcompleter::QTBUG_14292_fileSystem is no longer flaky on openSuSe.

Pick-to: 6.9 6.8 6.5
Change-Id: Ie2ad7d99ca9afd75a91a0e47c7420cfd470d3a25
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-08 14:23:28 +00:00
Frédéric Lefebvre
d1fea2f70e Unblacklist tst_qwidget_window::paintEventOnSecondShow on openSuSe
tst_qwidget_window::paintEventOnSecondShow is no longer flaky on
openSuSe.

Pick-to: 6.9 6.8 6.5
Change-Id: I4ceae71dc3d8a01b0b421bba2968f35dc66383bd
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-08 14:23:28 +00:00
Frédéric Lefebvre
ab1569f643 Unblacklist tst_qopenglwidget on openSuSE
tst_qopenglwidget is no longer flaky on openSuSe

Pick-to: 6.9 6.8 6.5
Change-Id: I42d31853d50938590e4cb1ba9ca6f009fe612279
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-08 14:23:28 +00:00
Frédéric Lefebvre
c02a02b6ab Unblacklist tst_qudpsocket::readyReadForEmptyDatagram on openSuSe
tst_qudpsocket::readyReadForEmptyDatagram is no longer flaky on
openSuSe

Pick-to: 6.9 6.8 6.5
Change-Id: If0f846d1d7ed4cc094e201cf4ef29579508da0bf
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-08 14:23:28 +00:00
Edward Welbourne
591dccddbb Forward-port a test I've just added to 5.15
Ammends commit 61343b5a3f10f5b9166729176d4b95a4c538c278 (which was too
big a change to back-port to 5.15), checking narrow != short in
Chinese month names.

Pick-to: 6.9 6.8 6.5
Task-number: QTBUG-10506
Task-number: QTBUG-84877
Change-Id: Ib9c26df751c0add517bc94218db04d32d8d135eb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-05-07 10:25:23 +02:00