Amends efe41182fda94c0e4805c24b3305577e5da81880.
The code already tests for QT_NO_WIDGETS before including and using
Widgets APIs, and we will want to extend the corelib_snippets target
with more of the existing snippets code to make sure that they build.
To not break -no-widgets builds, don't link against Qt::Widgets unless
the feature is set.
Pick-to: 6.10
Fixes: QTBUG-137556
Change-Id: Ic30fd519416068c275c3fffd0e1df10a76ce8fad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Amends 7d0017cda8fde28a1130feaeecf41010b40e3cb3 which added the APIs,
and ef7e5ea616a3f04ff0ba5f6fe34487a332152b01 which only added the guard
for QListWidget.
Address header review comment.
Pick-to: 6.10
Task-number: QTBUG-137478
Change-Id: I405190190f4d64dd810d7d35e9ef616ab0147b19
Reviewed-by: David Faure <david.faure@kdab.com>
Clang informs that ITERATIONS_PER_THREAD need not be captured:
tst_qpointer.cpp:548:66: warning: lambda capture 'ITERATIONS_PER_THREAD' is not required to be captured for this use [-Wunused-lambda-capture]
548 | QThread::create([&startSemaphore, &targetObject, ITERATIONS_PER_THREAD]() {
| ~~^~~~~~~~~~~~~~~~~~~~~
Make ITERATIONS_PER_THREAD (and NUM_THREADS, while at it) constexpr,
indicating even to non-language-lawyers that these variables, indeed,
need not be captured, then drop the capture.
Amends 253f34082f526ff1ffd9eaefac73cc9aa616ab2a.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I27d94763058e1dcea3a65d4ff2c859b40336446f
Reviewed-by: David Faure <david.faure@kdab.com>
The old code used the same type of container for both target and
source in the range-assign() test. This limits our test coverage.
Fork the test to explicitly test with random-access (std::vector), as
well as forward-only (std::forward_list) iterators. This ensures we
have coverage of random-access, forward as well as the existing input
iterator types.
Amends 426d975cee9c783aec0832f376b836cdabee983f.
Pick-to: 6.10 6.9 6.8
Change-Id: I59c7a322ecbcc564baa1263e02b234bc53563fac
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
A container is not an iterator, so don't call a container
'iter'. Since we're copying from it, call it 'src'.
Amends 7cbdc8abbda12488f51317313347bbc220b42fe0.
Pick-to: 6.10 6.9 6.8
Change-Id: I7732465f222032b2833396576873fed370f71d11
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Those weren't caught for the Qt 6.0 release.
Pick-to: 6.10
Change-Id: I5831d4ad80b7f60d8782fffd6c64ef552f82ad6e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The function append the unique entries to the CMAKE_CONFIGURE_DEPENDS
property. This suppress the ninja recompat issue, which complains
about the duplicated entries in that come from the
CMAKE_CONFIGURE_DEPENDS property. It's likely the CMake issue, but
we may work around it.
Pick-to: 6.8 6.9 6.10
Change-Id: I2f10834b0dca3d2aa08fe13fba69849e97fa77d0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Because we were consulting GetLocalTime we didn't get disambiguated
times for repeated hours. Drop that code-path and simple rely on
GetSystemTime instead.
Done-with: Mate Barany <mate.barany@qt.io>
Done-with: Edward Welbourne <edward.welbourne@qt.io>
Fixes: QTBUG-133656
Pick-to: 6.10 6.9 6.8
Change-Id: I3f1f09edfd9fb3135ccc12bf98e06254327e76fe
Reviewed-by: Mate Barany <mate.barany@qt.io>
We previously asserted that the reply was not nullptr, except in some
special circumstance. But then we proceeded to dereference it anyway.
This was then recently changed to be an if-check, but that just
highlighted the logic-flaw (and made static analyzers warn about it...)
What we want to assert is that the stream object is valid and
conditionally return early if the reply is nullptr, which it is for
promised streams, since no request has been made yet so no reply is
created.
At the same time, update the logic in the QHttp2Stream to not store or
emit header-related signals for a stream that has been reset.
Pick-to: 6.10 6.9
Change-Id: I55d69bbedc027893f6ad125c29468a34e7fb406f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
We already have the alias for it, we just never updated the stored
member to use it.
Pick-to: 6.10 6.9 6.8
Change-Id: I850c9f0b899a15603b4c5ac83693019b856effb2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Now that argumentTypesFromString() actually doesn't normalize types
anymore, all type names are substrings of the signature, and so
QByteArrayView suffices (was: QByteArray) to hold the result.
QArgumentType in only used transitively, during QMetaObject member
function or QObject::connect() calls, so the source string will also
never go out of scope before the QArgumentType object that references
it.
As a drive-by, make the QArgumentType ctor explicit and port from
QVLA::op+=() to emplace_back().
No discernable impact on tst_bench_qobject's connect_disconnect.
Task-number: QTBUG-135572
Change-Id: If6544917b9df8191a256dc2a67e31c6b7e5a38cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The argumentTypesFromString() function is clearly documented not to
perform any normalization, yet in typical Qt 6.0 porting rush, it did,
and this kludge was never removed.
Do it now; it's in the way of porting QArgumentType from QBA to QBAV,
and it's causing correct code to incorrectly fail.
This, however, changes the behavior of QMetaObject::indexOf*(), because
they don't fall back to normalization (indeed, these functions are used
as isNormalized checks, e.g. in connect()). So we can't remove the
kludge just yet, but we can drag it out of the fast path and re-try
with QVector replaced by QList when nothing was found using the
original signature. This way, we only pessimize unported users (and
calls that would have failed for other reasons, by scanning for
"QVector<" in the signature).
Add a qWarning() that we'll remove this behavior going forward.
It does, however, fix the bug that signals and slots that contain
types that match, but are not, "QVector<", fail to be found by the
machinery:
[ChangeLog][QtCore][QMetaObject/QObject] Fixed a bug that caused
signals and slots with argument types matching "QVector<"
(e.g. "MyQVector<int>" or "NotQt::QVector<int>") to not be found in
QObject::connect() or QMetaObject::indexOfMethod().
[ChangeLog][Deprecation Notices][QMetaObject] The
indexOf{Constructor,Slot,Signal,Method}() functions are documented to
require input according to QMetaObject::normalizedSignature(), but
accepted a QList declared as QVector. This was an internal porting aid
and is being deprecated now. Watch out for runtime warnings about this.
QObject::connect() and QMetaObject::invokeMethod() are unaffected, as
they fall back to normalizeSignature() automatically.
No change in tst_bench_qobject connect performance, which is
unsurprising, as the benchmark doesn't use a QVector alias.
Amends 03326a2fec416405b437089874f6439e937bbada.
Task-number: QTBUG-135572
Pick-to: 6.10
Change-Id: I7fd9293bba5d2b57b4452e55499ffbf360bc6123
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Before this patch, we did not set the view item positions in the views.
This was fine as they were ignored until
b780eaf6a063a7efe03417cf6b7008a188e222a4 added a condition to early exit
on invalid positions. This then broke all qss background styling using
QStyleOptionViewItem::ViewItemPosition as they were always invalid.
Set the position when trying to draw a cell of the view before
reaching the code handling the qss rules for backgrounds.
Fixes: QTBUG-137346
Pick-to: 6.10 6.9 6.8
Change-Id: I83d7a3ea7b9bab98889791bb807988a74e355b93
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
For AndroidBackendRegister::callInterface, it would be more convenient
to call simple functions without parameters, without being forced to
specify the void return type. Added a default void type argument for
the return type.
Change-Id: Ib7f631c172955cdf0b2e853155fd57c06bef9843
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
A quick blurb to explain the usecase and limitations of
AndroidBackendRegister, meant for future developers.
Also documents the two public-facing functions, getInterface()
and callInterface().
Change-Id: I79f07d4a19fdb1f4a53529ab42a8663999759f85
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The native WebGL context is tied to a single canvas,
and can only be used with that canvas. (Qt creates
one canvas per QPlatformWindow).
This means that we need new native contexts in cases
where a QWindow is repeatedly created and destroyed.
It can be tempting to just create a new WebGL context
"behind the scenes" on the makeCurrent() call in this
case, but this does not work since GL resources created
by user code with the original WebGL context in place
are now invalid.
Inform user code that this has happened by signaling
a context loss. This is done by returning false from
makeCurrent(), and then making sure isValid() returns
false as well.
The context becomes invalid whenever the owning platform
window is destroyed; add a call from ~QWasmWindow() which
handles that bookkeeping.
Pick-to: 6.10
Task-number: QTBUG-120138
Change-Id: I929b9bb51153007c16630b1a991399f01ebffa62
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
FreeBSD may return a single POLLHUP revent not coupled with any of POLLOUT nor
POLLERR. This causes a busy-loop, so put POLLHUP into write_flags.
Change-Id: Ief62138eeb6de8e2caf1d6937507bfd828adfb81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
On FreeBSD when asked for POLLOUT the poll() syscall returns only POLLHUP to
signify the fact that the other side closed the connection. It never sends
POLLERR for EOF cases, which results in a busy-loop inside the Glib dispatcher:
- poll() returns immediately with POLLHUP for a closed socket
- socketNotifierSourceCheck() does not detect it, because .events = POLLOUT | POLLERR
and we get .revents = POLLHUP. The (events & revents != 0) condition evaluates to false
- the code decides there is nothing to do and a new iteration starts
A similar issue in dbus code: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/526
Change-Id: I2660a5179031da8eb9fe2562abe7fb283c77f64a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
MSVC exports inline functions, so we're not allowed to remove them. This
is an unlikely problem, though, since it was only called from other
inline functions: if the compiler was inlining content into user code
(as it should), then it would likely have inlined this one too; if
instead the inliner was disabled, then it wouldn't have inlined the
caller either.
Amends commit 1957597aa6bc6ebd8bd1f903389800897411ac5d. Seen in API
review.
Pick-to: 6.10
Task-number: QTBUG-137478
Change-Id: Idd01170c3396c5b6fefefffd748f3335fc42fd79
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The getAndRef(const QObject*) function failed to initialize
ExternalRefCountData's destroyer field: the Qt::Uninitialized ctor
doesn't init anything and there are no following assignments to the
field, either.
This probably a) caused some Coverty complaint (but I didn't check,
because the Coverity UI is so clumsy) and b) was harmless, seeing as
the -1 in strongref indicated that the destroyer is never to be fired.
Fix it nevertheless by initializing it to nullptr.
Amends the start of the public history.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ib76b4bc00b08289bb8d6d58096b43501b47814d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It's unclear¹ whether static zero-initialization of a static
QBasicAtomic actually initializes the object with a zero value, or
whether it remains default-constructed (without a value until a
following call to std::atomic_init gives it one).
Play it safe and use Q_BASIC_ATOMIC_INITIALIZER(0) to dodge any issues
the old code may have had.
¹ see ongoing discussion on the Jira ticket
Amends 04d6495bf773a6bb0d4fa6980df22d3b81a605b0.
Task-number: QTBUG-137465
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Iee0d75ce10a589390afdd9069b7040a1c9c608e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Until C++17 (inclusive), a default-constructed std::atomic object can,
officially, only be initialized with a call to std::atomic_init, for
which QBasicAtomic doesn't have API. It is even unclear whether
zero-initialization of static and thread-local objects will cause the
object to be initialized.
QRegion is using QtPrivate::RefCount, but that's just another wrapper
around QBasicAtomic, so it has the same problems: it must always be
initialized.
So don't default-construct and then storeRelaxed() (via
initializeOwned()), use NSDMI with (newly-added)
Q_REFCOUNT_INITIALIZE_OWNED to avoid this dark language corner.
Task-number: QTBUG-137465
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I4b765aed329211984c35c40fbc5648bf104990ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When project's Android package source directory is set to the
project level (instead of project/android) androiddeployqt keeps
copying the build directory under itself infinitely.
Add check to copyFiles:
-If android source dir is the same as project source dir
-And if current directory copied is in build directory path
Pick-to: 6.5 6.8 6.9 6.10
Fixes: QTBUG-126743
Change-Id: If45766152c6cbf9e2ee916baa5a15282d3fedaf2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
The comment in the QTRY_IMPL macro definition pertains to the
following using namespace std::chrono_literals, which has nothing to
do with the default timeout of QTRY_ macros, because that is
determined somewhere else. Further, "5 seconds" is not a valid chrono
literal, as "5s" was.
Partially reverts 55f163382d36ddf908fc2884f2020a1b92340c10.
Found in API-review.
Pick-to: 6.10
Change-Id: Ic1242436bf87d7067e3c5240eb2687505e24800f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
We were always checking 'client' or 'server' usage depending on our own type,
which breaks for any intermediate certificate with the 'ca' usage set.
We assume that any non-leaf certificate should be a CA (if anything),
and leaf certificates must be for client or server usage.
Pick-to: 6.10 6.9 6.8 6.5
Fixes: QTBUG-137041
Change-Id: I268f3bad669df77351fc458f56e318db75ecac7b
Reviewed-by: Mate Barany <mate.barany@qt.io>
QVERIFY that the file could be opened, fail the test if it couldn't.
Pick-to: 6.10 6.9
Change-Id: Iab9b819e70b71fade6a58286edff8e022748d9f6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Since 9d8663c18e88cb0b5a65f86cfd7726f3d31e04d6, we print a warning when
endResetModel is called without beginResetModel.
This however triggers false positives with a QSFPM if we set a source
model which is resetting at this point in time:
The QSFPM reacts to the endResetModel signal in _q_sourceReset by
calling its own endResetModel, but it does not have the resetting flag
set.
Fix this by deferring the endResetModel work that we are doing in
setSourceModel if the source is undergoing reset.
Task-number: QTBUG-132775
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I363f2f34a06cc5de031fa87c6274322bf03bd77f
Reviewed-by: David Faure <david.faure@kdab.com>
Recent changes in QDoc's output for QML type reference pages included
rearranging the `extra synopsis` element, i.e, read-only, since, and
deprecation information for properties.
As a result, the existing CSS for the offline documentation caused some
elements to be rendered on top of each other when using the qlitehtml-
based backend in Qt Assistant and Qt Creator.
To fix the layout, set a fixed width for the table elements that
are used to display the properties, property groups, and methods.
This change brings the style of QML reference pages closer to that
of C++ reference, where signatures also have a fixed width.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-136990
Change-Id: I72adbeaca46cd9dd99c54368257268dc8db6bfdc
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: David Boddie <david.boddie@qt.io>
The tika mimetype database contains multiple rules that would fit to a
valid file (e.g. svg file that is svg and xml) with the same priority
(50 in case of svg and xml). The choice is thus ambiguous which leads to
regressions in the reported mimetype.
In order to break ambiguity, we look now also at the sub-class-of
element and we prefer sub-classes as they are more narrow and detailed
than the super-class.
The recommended checking order of freedesktop.org suggests that this is
the correct thing to do: "If any of the mimetypes resulting from a glob
match is equal to or a subclass of the result from the magic sniffing,
use this as the result." However, this does not fit perfectly to the
case of the bug report because both results come from magic sniffing.
If two rules match and have the same priority, without one being a
sub-class of the other, there is still an ambiguity. In that case we
now print a warning about the ambiguity.
The patch adds a test for the previously ambiguous case. There is no
test for the warning on ambiguity, because such a test file would be
difficult to generate and is probably not worth the effort.
Fixes: QTBUG-133221
Pick-to: 6.10 6.9 6.8
Change-Id: I1817ec4da947cd91729d0ce35defc9f63cd784d9
Reviewed-by: Mate Barany <mate.barany@qt.io>
This isn't needed, and actually counter-productive, because this mix
used to be ambiguous in Qt 6.5.
Amends 5c563a98a5ffe2a72a641bfa9ed30e17ecffd893.
Not picking to 6.5, because the 6.5 cherry-pick of the amended commit
doesn't compile, so the _L1's were already removed as part of manual
conflict resolution.
Pick-to: 6.10 6.9 6.8
Change-Id: I1810f90c7cf6e3760f1d99e026b291311501c3aa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The existing tests were taken from tst_QLatin1StringView. This patch
adds the simple tests from tst_QStringView.
The tests fromLiteral(), fromRange() and fromContainer() are not
included in this patch.
Pick-to: 6.10 6.9 6.8 6.5
Task-number: QTBUG-132097
Change-Id: I1efc0c2d2f474f6644261575a745aa8f7e5ac4b2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If T is a C-array, like it is in some of our tests, then an instance of
that can never be nullptr, which recent gcc versions think warrants a
compile time warning -Waddress.
As a C array is a valid data structure to instantiate a QRangeModel
from, silence that warning by handling the case explicitly.
Pick-to: 6.10
Change-Id: I63090891988e677cf3ae2d871418b1abd4d1dc71
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
The application provided overrides of the Android files were not being
used in aux mode. In aux mode androiddeployqt was only copying the
Android files from the Qt sources and updating them.
With this change androiddeployqt also copies the Android files from the
application source, allowing overrides prior to template processing.
Change-Id: Idf790f1c270691dab8fe093c20e84bed79bf481d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Propagate the `_Qt6CTestMacros` variable so that
`_qt_internal_get_cmake_test_configure_options` can be used
inside the RunCMake tests
Pick-to: 6.8 6.9 6.10
Change-Id: I2b7f3996315169d840bab3dff011927288c9782d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It's no longer available on macOS 26, and we don't use it anymore
anyways.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: Ia1d0e37dda177f333646e598e517f4af20215dad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QSortFilterProxyModel does this exactly, it was missing in
QIdentityProxyModel.
Pick-to: 6.10
Change-Id: If14bc7a377c1ad9235dd70222e3bfbf88eef11c0
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
In the macOS 26 SDK the NSUserActivityTypeBrowsingWeb is claimed to come
from both Foundation (as in earlier SDKS), as well as CoreServices.
However the latter is not the case on macOS 15, resulting into load
errors with missing symbol.
By explicitly linking to Foundation, and putting it first in the
framework list, we trigger the linker to use the right reference
for the symbol.
Reported upstream as FB17876148.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I0c3203f92851ad9fa862aed237823f0e1e28f6ff
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Amend 7c0a96785fee4fea8ef1452166b1dde88957445c and add needed
defines to fix EGL build without x11. Otherwise eglplatform.h
will try to include X11 headers.
See 4cc5428548cb8ab973e4b0281dd123d59bfaf6a0 for more details.
Pick-to: 6.10
Change-Id: I2c284219e83fecf862520a2f667d561adf4d4357
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Builds with DBus but without XCB/Wayland, failed with:
qgnometheme.cpp:(.text+0x3ec): undefined reference to `vtable for QGnomePortalInterface'
/usr/bin/ld: src/gui/CMakeFiles/Gui.dir/platform/unix/qgnometheme.cpp.o: in function `QGnomeThemePrivate::QGnomeThemePrivate()':
Change CMake configuration and build QGnomePortalInterface always with DBus,
except on Apple platforms, where it is not needed.
Pick-to: 6.10
Change-Id: I3fb6400d87ba08f03c30e33924c8c7d483486c3b
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Still causing an internal compiler error with the currently latest VC++
version.
Amends 4e3a1675793995e44f5c84f28bfdc0fd02aa27cc.
Pick-to: 6.10
Change-Id: Ia4290c9b21eb8163180d725ed200629e36e85f1f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Particularly for the no-parameter case, which fails on any warning, it
makes no sense to not also fail on a critical.
Pick-to: 6.10 6.9
Change-Id: I36f02a7dfb195616ce68babedbccc61480935fb9
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
In tst_QDate the test previously had a hard-coded list of versions by
name. This, however, needed updates on each new release (or at least
new version of QDS), which have been neglected since Qt 5.0. The
tst_QDateTime version, meanwhile, only identified versions by their
numeric value, not their symbolic names.
So borrow the way tst_QCalendar enumerates QCalendar::System, making
QDataStream a Q_GADGET and its Version a Q_ENUM to support this, to
iterate over all versions algorithmically. Apply to both data stream
tests to get a more consistent form for their data tags.
Change-Id: I04d1060cfec822cfcdc0bce6d15b636fc165fe36
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The old way relied on the order of enums within the type; using
fromType() makes the enum specific.
Change-Id: I418473a6983861ca105ccc5eb249f441dbbb28cf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>