The use of unqualified fromValue(arg) in the visitor implementation
invites non-QVariant fromValue(T) overloads to be found using ADL,
which just happen to compile because their return value implicitly
converts to QVariant (like most stuff does).
To rule this out, use FQN QVariant::fromValue() to switch off ADL.
[ChangeLog][QtCore][QVariant] The fromStdVariant() function used an
unqualifed fromValue() call to convert each alternative type in the
std::variant. It now uses qualified QVariant::fromValue() to avoid
picking up unrelated fromValue() overloads whose return value just
happens to implicitly convert to QVariant.
Amends 5927acaf65.
Pick-to: 6.5 6.2
Change-Id: Ica21b08c919459d0a740af03f451e4ffe224b641
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Refactor the 'CHECK' macro to eliminate the capacity check and
explicitly verify that no reallocation occurred. The previous
implementation had to pass constants to suppress the issue arising
from differing growth rates between implementations.
Additionally, improve the 'std::stringstream' versions of the test
by incorporating the correct values. In the previous implementation,
the usage of:
auto tData = V(9);
~~~
std::stringstream ss("9 9 ");
had several issues. Firstly, it used the wrong test data since the
container's value_type of '(char) 9' resulted in a tab character '\t',
which was not accurately reflected in the stringstream assignment.
Secondly, this value caused problems in how stringstreams interprets it.
To address these issues, let's make the following improvements:
1. Use a default test value of 65 instead of (char) 9. This value, which
represents the character 'A', is less likely to cause errors and is more
intuitive.
2. Use the tData variable for the assignments in the stringstream. This
ensures that the correct data from the container is used.
3. Change the test value between the assign() calls to verify that the
container's contents are successfully overwritten.
These changes ensure, that the test cases are more accurate and
reliable.
Amends: 3b0536bbe8.
Change-Id: I9441c4818106bf93e93a1a5d2d2d54c89d80e7b0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Previously, we were not setting the CMAKE_<LANG>_FLAGS, instead we were
only processing the CMAKE_<LANG>_FLAGS_<CONFIG>. This patch amends that
so we also update the default flags list as well.
Pick-to: 6.5
Change-Id: I7ceb87850a806fe8ad4eac6f8147b312eba01bc6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
... and remove all previous function-level occurrences.
Pick-to: 6.5
Change-Id: I90df40922e3aed15efc04e885d9f54c577a948b6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
findNode and findBucket are virtually the same
Change-Id: I9ba8534d66f0feaa2dea7c2b9beacf8d5faddb52
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is done, in part, by swapping the dependency between the wait() overloads.
Furthermore, since QDeadlineTimer is 64-bit and the Win32 API is 32-bit
we have to wait more than once to actually wait until the deadline
is reached.
The unsigned int overload has no documented concept of waiting
'forever'. Though, internally we turn u32::max into 'forever'.
Change-Id: I47d719c0c29bcd6fa0c0043d168a456f2c05774e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since the `SKIP_LINTING` source property was added to upstream cmake
here https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8467,
that source property should also be set for source files generated by
qt's cmake public api
Change-Id: Ic9d6c119abbc7c51b146176970c1d0bafb097abf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Unifies the approach between iOS and macOS. By copying the Info.plist
to the build directory, we also open up the possibility to modify it,
which we can't do when CMake does the copy during its generator step.
Change-Id: I59f9f69ac368166bb26d8a5c57bf4ea3f503d51b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The AccentColor role, added in Qt 6.6, is currently populated with a
default value.
This patch implements populating the brush with OS values for Windows
and macOS.
Change-Id: Ic243c3b8664d50db3a2096a034de6ba672d9e2d2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
To make sure that Qt essential tools can be executed after a successful
build, we can now pass the TRY_RUN argument to `qt_internal_add_tool`.
On Windows, this option creates a custom command and a custom target
(${target}_try_run) for the tool, and tries to run the tool from a batch
script. If the program fails to run because of missing libraries, an
error will be shown, and build halts; otherwise,
`${target_name}_try_run_passed` file will be generated and the build
continues.
Pick-to: 6.5
Task-number: QTBUG-113273
Task-number: QTBUG-112747
Change-Id: I760588714bcf9db69505abe3df717733352a8284
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The x86-64 architecture mandates support for MMX and SSE2, so we don't
need to tell that the compiler generates them. They're implied.
This could serve to determine that the user specified no -march= or -m
flags that affect the architecture on the CMAKE_CXX_FLAGS, but fails if
the compiler does that on its own for this particular target. For
example, both for Android and macOS, the minimum feature set is SSSE3
for 32-bit and SSE4.1 for 64-bit.
Change-Id: I76216ced393445a4ae2dfffd172a94b17e8a9a37
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The QSemaphore acquire & release functions, plus the constructor and
destructor, can be made noexcept on platforms that use futexes
(currently, Linux and Windows; likely macOS by the time we make 7.0). I
didn't make the change right now because the acquire and release
functions have narrow contracts on the int n values. I didn't make that
change now because it make a mess of the code, for little gain as this
class isn't used that often.
Plus, we may want to investigate whether we want to keep the multi-token
semaphore functionality around (something neither POSIX sem_t nor
std::counting_semaphore have), or split that off into a separate class
like QBasicMutex / QMutex / QRecursiveMutex was done.
Change-Id: Ieab617d69f3b4b54ab30fffd175b27813728f2ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
In function ‘int qt_safe_connect(int, const sockaddr*, socklen_t)’,
inlined from ‘bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress&, quint16)
qnet_unix_p.h:111:38: error: ‘sockAddrSize’ may be used uninitialized [-Werror=maybe-uninitialized]
qnativesocketengine_unix.cpp:396:18: note: ‘sockAddrSize’ was declared here
qnativesocketengine_unix.cpp:476:14: error: ‘aa.qt_sockaddr::a.sockaddr::sa_family’ may be used uninitialized [-Werror=maybe-uninitialized]
qnativesocketengine_unix.cpp:471:17: note: ‘aa’ declared here
Introduced by commit 45a03fc506.
Change-Id: I5f7f427ded124479baa6fffd175fbf006c098854
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
If a platform builds up a list of QPlatformScreens, and then adds
them incrementally, while at the same time implementing virtualSiblings
in QPlatformScreen to return the full list of screens, the virtual
sibling QScreens will contain nullptrs for each non-added screen.
It could be argued that this is the fault of the platform plugin,
since it's reporting a virtual sibling that it hasn't added yet,
but we can easily work around it in QScreen as well.
Fixes: QTBUG-113977
Pick-to: 6.5
Change-Id: I4b9472646a5cc10b6fd35c606e3ae15941da1587
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
In cases where we allow symlink, we need to use ABSOLUTE path, and don't
resolve the symlink. This function returns ABSOLUTE only if we are on
Apple platform, and have QT_ALLOW_SYMLINK_IN_PATHS enabled. While this
is mainly to resolve the issue report by Homebrew, it might be useful if
a user really want to build with symlink.
Pick-to: 6.5
Task-number: QTBUG-113463
Change-Id: Ided141ed8de66cc1d3717ec2719eb703fa7fc589
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Add an empty line between the two.
Pick-to: 6.5
Change-Id: If1c50ebb0b825acc53364cce2e083332367e757c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Will be re-used in the upcoming emplace() function.
No attempt is made to re-write the expression to be more
readable. That's left for another commit.
Task-number: QTBUG-112187
Change-Id: Id391b78f1477c5225beda8a32c4f6c1393dd51bb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
By not explicitly disabling min/max macros of `windows.h`, we may see
some unintended substitutions. This is especially important now that we
are moving toward enabling Unity Build, and some of the constructs for
manually dealing with this issue, eg., `#ifdef max`, `#undef max`, might
not make it to the pool, and as a result we get build failure.
Pick-to: 6.5
Change-Id: Ie3c31aebe00300126a2ac3a6044876ab92d5d99c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Will be re-used in the upcoming emplace() function.
Task-number: QTBUG-112187
Change-Id: Ie2b4570b7ba6c9d0ce938203933758a0d0d59f5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Due to short-cut evaluation of the built-in op||, we can do the
following transformation:
- (X && Y) || !X
+ !X || Y
Pick-to: 6.5
Change-Id: Ia5ae1dd60bdb663aa4648c09372be1598591110d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
QVariant::clear() hasn't been virtual since at least Qt 4...
Pick-to: 6.5 6.2 5.15
Change-Id: If6b5669d91f8d9c7ed2d152d18852a8d6f8e491a
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When a custom projection is used in the assign() function, there is a
problem with the optimization step at:
dst = std::uninitialized_copy(first, last, dst);
The issue arises because this copy doesn't respect the custom
projection. To address this problem, we need to ensure that the
optimization is only applied when using the identity projection.
Amends: 7ca633d9a8.
Change-Id: I912525c716333ee2c22c419f2bf70201086c5635
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
They were made redundant at Qt 6, so now they're just defined and undefined.
Don't even do that any more.
Change-Id: Ic4a4a4c39c50c9af417ea6c52be5f69a2d4856c6
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If module doesn't contain headers we should skip adding install
rule of the geneated by syncqt module headers, since the staging
directory will not be created in this case.
Change-Id: I89db5f1447d60cae48cd6ae4b9ef080dcf50e34c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
CMake not necessarly sets MSVC or MINGW when detecting Clang compiler.
We should rely on CMAKE_CXX_COMPILER_FRONTEND_VARIANT instead when
detecting Clang platform.
Fixes: QTBUG-113630
Pick-to: 6.5 6.2
Change-Id: I8c14939ddc0839ddf2b3419392aa843deeef4bb5
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The if statements were originally broken to fit 80-column width
but didn't have the braces we typically require.
It anyway fits inside our new 100-column width, so just do that.
Task-number: QTBUG-108873
Change-Id: Ib632f35607e6b716141c4c5d8211de7a0745c6ab
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Using only the key means all clients with that IP address are removed.
But there could be multiple clients running on the same multi-user
system.
So, use the value as well to remove just the specific one.
This also fixes a bug where, when a client disconnects, all of the
connections are removed from the client's map, but only _one_ is removed
from the GUI.
Task-number: QTBUG-108873
Change-Id: I87da862e8f337fd9c246ff5a2d243e514076fa5f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
It is a best practice after all
Task-number: QTBUG-108873
Change-Id: I11c23c080f6fe7f124e461affa88279d5def93f9
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Where possible
Task-number: QTBUG-108873
Change-Id: I8125ffd63cd0ad1970575fb1a6b85021c03c38d5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Prefer own headers, avoid full-module includes
Task-number: QTBUG-108873
Change-Id: I4282d4aab5fd66c64fc27cd130b223d33069d80f
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Instead of duplicating the long-ish implementation, simply pass the
variant as pointers to const and mutable, and implement a runtime
version of std::forward.
[ChangeLog][QtCore][QObject] Added setProperty() overload taking an
rvalue QVariant.
Fixes: QTBUG-113281
Task-number: QTBUG-112762
Change-Id: Ifdc8f626ad5db138073474c3bd95ec7308c4396b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Some users wish to make layouts with uniform column widths or
uniform row heights, ignoring the sizeHints of individual items.
This patch enables this mode in the QGridLayoutEngine, used
by the QuickLayout.
The sizeHints are aggregated and their average preferred size
and extreme minimum and maximum sizes are respected in the
layout.
Change-Id: Ibb9409eb0a11a1ce8bb305f44a4cb0071c871ec9
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Remove commas at the end of the lines.
Pick-to: 6.5
Change-Id: Idf731ac5de64787276c1fdf798eb429b8f73213b
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Fix reading ranges from metadata when there are multiple RANGE
elements in the metadata.
Pick-to: 6.5
Change-Id: I1d176ded539c55ce72664c9c7c3f65d694be898c
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Don't stop searching enums if the enum partially matches.
Pick-to: 6.5
Change-Id: Idc2b45cee5a32994d55fe90c038938f0ad8b4a59
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Currently some libraries created by Qt are lacking some compile
definitions and compile options, and this issue is causing us
troubles when building Qt statically. This patch tries to reduce
the parameter difference when compiling Qt's own libraries.
Change-Id: I3842943a874fab32ef90980e8aa29f5beb01feeb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The desktop file name should not contain ".desktop" suffix, but some
applications still specify it anyway because of the ambiguity in the
documentation that was fixed in
0c5135a9df.
This change makes setDesktopFileName remove ".desktop" suffix so
desktopFileName always returns a desktop file name with correct format
and its users don't need to chop ".desktop".
Pick-to: 6.5
Change-Id: If5abccaf3bf976449cada8891fff887870e45b5f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
1. Don't reassign different versions to same symbol
2. Define symbols used
This fixes warnings with LLD linker (or errors if -Wl,--fatal-warnings is added by toolchain e.g. with Android NDK)
3. Add -Wl,--version-script to CMAKE_REQUIRED_LINK_OPTIONS instead of CMAKE_REQUIRED_FLAGS to prevent unused argument warning in compilation phase
(there is no need for _SAVE variable because we are inside a function and our CMAKE_REQUIRED_LINK_OPTIONS won't escase its scope)
4. Fix removal of version script file (incorrect file name was used)
Pick-to: 6.2 6.5
Task-number: QTBUG-111514
Change-Id: I0a1548c4268ad511760a0d4aa69ba7a0bdcbb0bc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This patch relaxes the requirements on the context object of
continuations. Instead of having to stay alive during execution of the
whole chain, it now only has to stay alive during setup of the chain.
If the context object is destroyed before the chain finishes, the
respective future is canceled.
This patch works by using QFutureCallOutInterface and signals instead
of direct invocation of the continuation by the parent future, similar
to how QFutureWatcher is implemented.
If a continuation is used with a context object, a QBasicFutureWatcher
is connected to the QFuture via a QFutureCallOutInterface. When the
future finishes, QBasicFutureWatcher::finished() triggers the
continuation with a signal/slot connection.
This way, we require the context object to stay alive only during setup;
the required synchronization is guaranteed by the existing event and
signal-slot mechanisms. The continuation itself does not need to know
about the context object anymore.
[ChangeLog][QtCore][QFuture] Added support for context objects of
continuations being destroyed before the continuation finishes. In
these cases the future is cancelled immediately.
Fixes: QTBUG-112958
Change-Id: Ie0ef3470b2a0ccfa789d2ae7604b92e509c14591
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Create tests to check that the continuations attached to ready futures
are immediately executed, and that the proper handlers are selected.
These checks were missing from the overall test set, which was detected
while working on the linked issue.
Task-number: QTBUG-112958
Change-Id: Iae97e4b9dfb1e016869693a5162f72e027ca7f5e
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This should be better than returning unknown if xdg-desktop-portal
is not running or its backend doesn't know color scheme
This also matches the pratice of all other
QXdgDesktopPortalTheme methods
Pick-to: 6.5
Change-Id: I352e091a019bc5b683c3f1dad223e55717888d02
Reviewed-by: Jan Grulich <jgrulich@redhat.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
To ensure the correct invocation of the projection function, this patch
introduces the usage of std::invoke for all accesses to it. This
modification expands the coverage to include cases where the callable
object is a pointer to a member function.
Amends: 7ca633d9a8.
Change-Id: If666012d785ac74c8e856ea9be2a46b3307c8a06
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>