When passing an rvalue-reference to QVariant, there is no reason to make
a copy if the type is moveable. Moreover, we know that the pointer which
we construct from the object passed to fromValue non-null. We make use
of both facts by parametrizing custom_construct on
non-nullness and availability of a move-ctor, and then dispatching to
the suitable template.
We need to keep the const T& overload, as otherwise code which
explicitly specializes fromValue and passes a const lvalue to it would
stop to compile.
[ChangeLog][QtCore][QVariant] Added fromValue() overload taking rvalues.
Change-Id: I44fb757d516ef364fe7967bc103b3f98278b4919
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
On Wayland we can't know where windows are in relation to
each other so the whole mechanism was broken, toolbars
were unmovable once undocked and could be blindly redocked.
Dockwidgets had native toolbars to move them around but could
not be redocked.
This introduces an alternative code path that uses a platform
drag with a special mimetype that enables the platform to
issue a combined drag and window move using the relevant protocol.
Should the protocol not be available this doesn't make things
actively worse as it will be similar broken as before.
Fixes: QTBUG-87332
Change-Id: I3b8bdc0b1bc22569a64cb8bf7ca7d37d223936a6
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
When using Ninja generator on macOS, we now do a bit of extra work to
make sure that bundle identifier is always set.
- In the case where no identifier was provided, the warning message has
been updated indicating that the user can set either of the
properties.
- If both `MACOSX_BUNDLE_GUI_IDENTIFIER` and
`XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER` were set but have
different values, a warning will be shown to encourage the user to set
only one of them.
- In addition `_qt_internal_get_ios_bundle_identifier_prefix` is renamed
to `_qt_internal_get_apple_bundle_identifier_prefix` to be more
platform specific.
Note:
In general, if Ninja is the generator, we set the value of
`MACOSX_BUNDLE_GUI_IDENTIFIER` and don't touch the
`XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER`. If Xcode is the
generator, we set the value of
`XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER`, and in addition, to
silence a Xcode warning, we set the `MACOSX_BUNDLE_GUI_IDENTIFIER`
to `${PRODUCT_BUNDLE_IDENTIFIER}`, ie., let Xcode figures it out if
needed.
[ChangeLog][CMake][macOS] When using Ninja generator, if neither
`XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER` nor
`MACOSX_BUNDLE_GUI_IDENTIFIER` is provided for a target, a bundle
identifier, i.e., `com.yourcompany.<teamid>.<target>` will be generated
and set as CFBundleIdentifier.
Pick-to: 6.5
Fixes: QTBUG-110889
Change-Id: Ie071085bbaf465afcb022b760423eb6b3c921f6d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Also fix coding style in the operator.
Pick-to: 6.5
Change-Id: Ia8f85a7bb7aa2d6f55923c80f72b734fc8dbd693
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Pick-to: 6.5
Change-Id: Iabb2621364b5256ac89ec8cb7fafb0a9d346515d
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Pick-to: 6.5
Change-Id: Ic4b184e1ed51d8e30c2305a5ead619117a505518
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Use the internal target property to store the module_sync_header target
name. The property then is used to collect module_sync_header targets
and build the dependency tree between them. This mechanism only works
for Qt dependencies that are added using qt_internal_extend_target call
that works well at least for out CI builds. The mechanism allows to
omit the race in sync_header runs that might lead to unexpected results
since internal targets like automoc or headersclean_check only depend
directly on module_sync_header target that belong to the module.
Change-Id: I564f3ea0f3c1703e70c4c300fd1307c3214d39d8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Introduce QT_ALLOW_DOWNLOAD option that should be used the downloading
of the resources from web in Qt builds. Calls like file(DOWNLOAD or
FetchContent_* should be wrapped with this option, so users that build
Qt could control this and disable functionality that requires
resources from web.
Change-Id: Ie0494265c0c5fe93a7ef0d1cbcee1af919d57fa5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The Test module uses Gui header files implictily without explicit Gui
linking. We need the dependency chain at least between the
module_sync_headers targets to make sure that all header files required
for successful module build are present "in time".
Change-Id: I40fd81cceeb0e0e8271db4ba33fd914eb484d001
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
For untranslated applications we set CFBundleAllowMixedLocalizations to
true, so that the application's locale will not be limited to the
development region "en".
But once we have a set of known translations, added by qt_add_translations,
we can turn these into CFBundleLocalizations, which lets macOS/iOS
choose a best match between what the app supports and what the user
preferences are.
[ChangeLog][Internationalization] Translations added via
qt_add_translations are now reflected as CFBundleLocalizations
entries in the application's Info.plist file on Apple platforms.
to disable this behavior, set QT_NO_SET_PLIST_LOCALIZATIONS.
Change-Id: I3f7ae1a1884eaf269038fa8ee49dbe6cac855706
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Allows us to modify this file in place, before CMake copies it into
the application bundle during its generator step.
Change-Id: I73325c66b5b8919f57dbaa1cc76a7edbc145609c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QDoc mis-interprets the Type and List template arguments as referring
to the QVariant::Type enum and its List enumerator, resp.
To fix, rename the template parameters from Type to T and from List
to U.
Task-number: QTBUG-112187
Change-Id: Ib4093acdd84cc86a0f85dcc5046b6e7da7885a44
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
[ChangeLog][QtCore][QVariant] Implemented in-place construction for
QVariant. The constructor taking std::in_place_type<Type> constructs
an object of type Type directly inside QVariant's storage, without any
further copy or move operations. QVariant::emplace() does the same
when replacing the content of an existing QVariant and tries to reuse
previously-allocated memory.
Fixes: QTBUG-112187
Change-Id: I16614ad701fa3bb583976ed2001bb312f119a51f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Implemented assign() methods for QByteArray to align with the
criteria of std::basic_string, addressing the previously missing
functionality. This is a subset of the overloads provided by the
standard.
Reference:
https://en.cppreference.com/w/cpp/string/basic_string/assign
[ChangeLog][QtCore][QByteArray] Added assign().
Fixes: QTBUG-106199
Change-Id: I899b14d74e8f774face8690303efb8610ead95b5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Exit with an error code when -c option is specified by the command
is not processing a single interface. Mention this in the option
description.
Fixes: QTBUG-36405
Change-Id: I7ea217c780d37332278c634f030d20040b7459e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We were not accounting for `x86_64h` arch, and as a result
cross-compiling with `-DCMAKE_OSX_ARCHITECTURES="x86_64h;arm64`
was failing.
Pick-to: 6.5
Fixes: QTBUG-113694
Change-Id: Ieb50a7a62aabcca76b09f9c853b3faf915eab1a3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
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>