`QT_ALLOW_SYMLINK_IN_PATHS` disables the
`qt_internal_check_if_path_has_symlinks` command. This allows people of
Homebrew to get their build working without having to patch the entire
function, as they currently do.
Pick-to: 6.5
Change-Id: I4fed3ca497684364eaabbdbc44f1e148e3f28bd7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The previous check for a non-throwing copy constructor at:
if constexpr (IsFwdIt && noexcept(T(*first)))
is not necessary as std::uninitialized_copy provides strong exception
safety.
Additionally, change the phrasing of the overload-resolution \note,
since we're not requiring C++20 std::input_iterator, but the older
C++17 definition.
Amends 7cbdc8abbd.
Amends 2457dd8bd0.
Change-Id: Ie36c8d70dc61aa8cc2a30c9d4110d1beb0d1c2fe
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Amends 642f799fc6 to avoid unnecessary
copies in between the calls to the QFunctorSlotObject construcotr. We
can't use a univeral reference in the QFunctorSlotObject constructor
as the call is not deduced. So provide two overloads for lvalue and
rvalue references instead.
The compile check in the test now no longer fails as we delay the
storage until one level later, but that's acceptable.
Change-Id: Ide95b4a73c70f6f47698dd1e95138aa5d48ee95d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
CMake doesn't resolve REALPATH for the non-existing files.
This limitation blocks the use of REALPATH when collecting the
generated module header files. The real path should be resolved
by syncqt implicitly and CMake scripts should rely on ABSOLUTE paths
only, which should be consistent for any files including the generated
files.
Task-number: QTBUG-113295
Pick-to: 6.5
Change-Id: I0219c7bf34ef6a6589c6d5fade4c2ed3f8036ef0
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
syncqt_args is initialized with common_syncqt_arguments, so no need
to append the same values one more time.
Pick-to: 6.5
Change-Id: I1588ed438b7df0b0533ad3963ca96960dd5a8dbb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Might fail with invalid enum in core profile contexts. The behavior
is the same regardless.
Pick-to: 6.5 6.2
Fixes: QTBUG-113289
Change-Id: I5e5764494be3c5f37537f5f9b3b5311d9c49def4
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
We need to enable or disabled exception handling for this library explicitly when using clang-cl, otherwise clang-cl will throw an error and stop compiling.
Pick-to: 6.5
Change-Id: I2b2a9e5eb009cb8ce264f2de58f8bb4fdb2339c1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Using O_PATH requires correctly specifying whether the fd is writable or
not. Stating that the fd is writable without it actually being writable
results into rejection on xdg-desktop-portal side. Other implementations
like xdg-open or gtk have also moved away from O_PATH fds so this will
make a matching implementation and avoid possible rejections from xdp.
Fixes: QTBUG-113143
Pick-to: 6.5 5.15
Change-Id: Icc171752d73ee091282b7c655f71da3cb59179b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Remove duplicate test and outdated comment about move-only functors,
and include return value in move-only functor test.
Change-Id: I58dffe0ccf3ec12e7e05e2c9588303da4a7e75ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Implicit capture of *this by [=] is deprecated in C++20, and the
replacement [=,this] is not available in C++17. We also can't use [&],
because of QueuedConnection, so need to bite the bullet and list all
captured variables separately.
Amends 87535e4e43.
Change-Id: I5b3a713bf9220746d10d594d1a248028157ad170
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Making them static constexpr class constants is tidier than
duplicating them in diverse tests.
Change-Id: I5a24c10d6db6f946581fa0523d28bdc80358e95e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The second pass through each test case, going via UTC, applied an
adjustment to the time; however QTime wraps around modulo the day, so
applying a negative adjustment to a time too near the start of the day
could produce a time at the end of the day. I'm preparing to add some
test-case variants for which the transition's UTC date differs from
the date in the zone doing it, which trigger this. Combine the time
with the date before applying the adjustment, so that the date gets
decremented to match the time's wrap-around and conversion from UTC
duly gets back to the correct place, not a day later. The new test
cases (in an imminent commit) thus pass.
Change-Id: I1bd5f191c7673a56ac3fbfc69eab0bc03c9e40b3
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
It seems glibc's extrapolation of existing DST-rules cuts off at some
point in the distant future, where the IANA DB gives no end-time for
such rules, leading QTimeZone to keep applying them. This lead to
tst_QDateTime::fromSecsSinceEpoch() not getting an invalid date in one
of its bounds-probing tests, due to a within-bounds datetime getting
glibc's offset and then the out-of-bounds one falling back to the IANA
rule's offset that put it back within the bounds.
This directly affected Australasian zones (which glibc locks into
daylight-saving time in this distant future) which were fixed by using
the IANA DB's offset; but the relevant date is in August so other
zones, north of the equator, that glibc locks into standard time, then
had the reverse problem, so we have to take the minimum of the two
sources' offsets to get all zones on board.
Change-Id: I0c94af2ba108dea31bee46aafa4a8cca8d373a5c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
In mapLocalTime(), we've constructed tmLocal from localSeconds, so
that's the local time mktime()'s returned utcSecs corresponds to. So
use that, rather than freshly dividing the original local milliseconds
by 1000 (now rounding down, instead of towards zero), which could lead
to an off-by-one error. The intermediate offset miscomputed this way
was only used in overflow cases, before being replaced by a more
reliable result, but this saves some computation as well as getting
those right.
Change-Id: Ie34cf53cd2191e277835388fcd62dcf68eaf39c3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Filters records on having value < 256, or an RFC, previously hacked
into the XSLT to produce the last update, with a bit of hand-editing.
Using a python script makes it easier to control the formatting and
other details; for example, severl entries previously had descriptions
that mentioned their RFC, with specific section, to which the XSLT was
adding a redundant mention of the RFC. It is also possible to exploit
C++ string juxtaposition to get tidily-presented string literals,
without having to resort to raw strings.
Task-number: QTBUG-111228
Change-Id: Ibd1c93dc1c88689e78b2b13a6bcb59a003f4df0f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use e.g. Qt6::Core instead of Qt::Core. This is better matching the
find_package(Qt6 ...) call, and also avoids issues that the versionless
targets have.
Pick-to: 6.5
Task-number: QTBUG-113277
Change-Id: Ib4373036092163518a611bd5c688591d18096d7e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Check that the private pointer is not null before attempting
to dereference it. This can happen, for example, when
a QDBusServer instance was constructed with an empty string
as address. Attempting to destroy an object constructed
this way was causing a segmentation fault on Linux.
Add a test case that attempts to construct a QDBusServer
object with an empty string as address to check that this
does not cause a segmentation fault anymore.
Pick-to: 6.5 6.2
Change-Id: I5fe63134026e2a9f509b61d452285891b1ec624d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The example demonstrates accessing native Android APIs in Qt applications,
tag it with 'Mobile' category.
Pick-to: 6.5
Task-number: QTBUG-112378
Change-Id: I5f936409aafb22175eab59fdb210ecd03fecb1f3
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Propagate the accepted state from the QtGui event to
the QWindowsSystemInterface event. This makes it possible
for the platform plugins to propagate rejected wheel events
to the native OS.
Pick-to: 6.5
Task-number: QTBUG-107441
Change-Id: Ifa90ed2430e56120a1a04b6a5872a153d26aa6bc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The writeOnGadget() function is implemented in terms of write() (UB,
btw, due to the cast to QObject*), which was recently overloaded for
rvalue QVariants.
Add a corresponding writeOnGadget() overload, too.
[ChangeLog][QtCore][QMetaProperty] Added writeOnGadget() overload
taking an rvalue QVariant.
Amends 968250ee14.
Task-number: QTBUG-112762
Change-Id: I7fc686fcab293159f5a0d76dd6c8e23d5779c96c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The writeProperty() function takes the QVariant value by value, so we
can move from it, using the newly-added QMetaProperty::write() rvalue
overload.
As a drive-by, replace a copy-assignment with a move.
Task-number: QTBUG-112762
Change-Id: I6d5361830b4874fa846be513882ede4ab881246b
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
There are two examples for Camera in Multimedia module. One of them is
using widgets, while the second one is QML based.
In such case the QML example is preferred for Android platform. That is
why only QML example should have android tag.
This commit remove android tag from qtMultimedia Widget Camera example.
Fixes: QTBUG-113238
Change-Id: I9d2c072fcc18e8e5a5a44a9a2da887a7b6660b46
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
The native style may not match the program style and it
makes sense to give an option rather than forcing native style.
Before it could only be done with setting AA_DontUseNativeDialogs
on the app, but it is reasonable to use native file dialogs and
Qt styled messageboxes - and it is extremely cumbersome - especially
since messageboxes often can start save dialogs.
It can look a bit strange that these introduced options has just one
option (DontUseNativeDialog) and four functions, but this way it works
similar to QColorDialog, QFileDialog and QFontDialog.
[ChangeLog][QWidgets][QMessageBox] Added options functionality to
QMessagebox. The currently only option available is DontUseNativeDialog.
Change-Id: I70282fcfaa66f245f7e679b8897c607bcaff333f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Now we can use QFunctorSlotObject for any kind of callable - free
function, functor, or PMF. This allows us to fold the various overloads
of QObject::connect together, removing duplicate code and error handling
logic.
Change-Id: I8842f5ddd29e86be07a422647a8fc1678fd534b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The two slot object types are identical as long as we use a universal
reference and perfect forwarding in the respective connect overloads.
Change-Id: I999d71707dd045a17156e3bfecd371da7979beb1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When making asynchronous functions, then the return type is not ever
going to be anything but void, but this makes this helper symmetrical
with QObject::connect logic, where we can then use it to simplify
the code.
Change-Id: I9e1b8bfffb726bb3d6d7282c87e07dc7e9ede5d1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Disable if any of the types used in the old-style connections is
involved.
Change-Id: Ie22c73704370c7f239d7303b555a0b572d2b4f22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use std::declval and remove_reference_t instead of home-baked
alternatives.
Change-Id: Ia1b3ac6c2d9a6cdba1650c3acb249f2d65bcf94d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The meta-programming list can easily know its size, so no need to pass
both a list and its size as template parameters to QFunctorSlotObject,
which simplifies existing code and is a step towards merging
QFunctorSlotObject and QSlotObject.
Also, remove the unused List_Select helper.
Change-Id: I8ec6a0b707eab531ec06aba4e82223f242e53f2f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The testAndSet operation is expensive if the lock is contended:
attempting to CAS that lock will cause the cacheline containing the lock
to be brought to the current CPU's most local cache in exclusive mode,
which in turn causes the CPU that has the lock to stall when it attempts
to release it. That's not desirable if we were just trying an untimed
tryLock*.
In the case of timed, contended tryLocks or unconditional locks, we
still need to perform an atomic operation to indicate we're about to
wait. For that case, this patch reduces the minimum number of atomic
operations from 2 to 1, which is a gain even in the case where no other
thread has changed the lock status at all. In case they have, either by
more threads attempting to lock or by the one that has the lock
unlocking it, this avoids the cacheline bouncing around between the
multiple CPUs between those two atomic operations. For QMutex, that
second atomic is a fetchAndStore, not testAndSet.
The above explanation is valid for architectures with Compare-And-Swap
instructions, such as x86 and ARMv8.1. For architectures using Load
Linked/Store Conditional instructions, the explanation doesn't apply but
the benefits still should because we avoid the expense of the LL.
See similar change to pthread_mutex_lock in
https://sourceware.org/git/?p=glibc.git;a=commit;h=d672a98a1af106bd68deb15576710cd61363f7a6
Change-Id: I3d728c4197df49169066fffd1756dcc26b2cf5f3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Amend 3c6e9dcc623c9d7281a81174bb3a696e030f30a7 by making sure that
we explicitly move move-only functors into the slot object in the
respective tests, and that failing to do so doesn't compile.
Also add test coverage for mutable lambdas, which work as they do
with connected functors: the connection stores a copy, and calls
don't modify the original functor.
Change-Id: I637e6f407133e2f8f72109b3fe5369a11d19da93
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This reverts commit 9958edba41, which
incorrectly tested a move-only functor without actually moving the
functor.
Change-Id: I3707f9f8e5055102f7edfb3e1cb9750978356dd7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use reinterpret_cast instead of C-style cast.
Take by QStringView directly so that we can use QSV::utf16().
Change-Id: I6d30669b0ed4bdf80a63043c364af695fd1d68b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- Add missing includes
- Use std::all_of, that also fixes a narrowing conversion warning
(qsizetype).
Change-Id: I0f7f4b91bda4c187b8f8094e3039079c43fbf478
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The old one kept all the indices in the type name, which was completely
unnecessary. This caused the symbol name to explode for some very large
meta object, notably that of the Qt namespace itself, causing gdb to
produce this warning at every start:
warning: internal error: string "StringData<3, 12, 7, 7, 6, 6, 9, 5, 10,
4, 6, 5, 5, 8, 7, 8, 10, 9, 9, 12, 11, 12, 12, 8, 6, 5, 13, 12, 9,
[many lines suppressed]
33, 6, 6, 5, 6, 17, 12, 17, 13, 8, 7>" failed to be canonicalized
To ensure there's no binary-compatibility problem with a StringData of
two entries, the first parameter is now of type int.
Pick-to: 6.5
Change-Id: I6f518d59e63249ddbf43fffd1759fbb66adc1299
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
When compiling with clang-cl 16.0.2, it gives me some warning like:
warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
Change-Id: I2a1e80fa94b617c0f8fc6561c326c8ae98cada45
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
[ChangeLog][QtCore] Introduced Q_NODISCARD_CTOR which resolves to
[[nodiscard]] attribute for constructors on compilers that support
it, and does nothing on other compilers.
Using [[nodiscard]] attribute on a constructor is a C++20 feature,
however in practice it is supported on most of the compilers that
we use in Qt 6. Clang generates a [-Wunused-value] warning, GCC
and MinGW generate a [-Wunused-result] warnings, and MSVC
generates a C4834 warning.
However, there are some exceptions.
The Integrity compiler provides the following warning:
"tst_qglobal.cpp", line 699: warning #3435-D:
the "nodiscard" attribute doesn't apply to constructors,
destructors, or routines with void return type
[[nodiscard]] explicit Test(int val) : m_val(val) {}
The QNX compiler (QCC 8.3.0) and GCC 9.3.1 on OpenSUSE generate
the [-Wattributes] warning:
tst_qglobal.cpp: In member function
'void tst_QGlobal::nodiscardConstructor()':
tst_qglobal.cpp:699:44: warning: 'nodiscard' attribute applied to
'tst_QGlobal::nodiscardConstructor()::Test::Test(int)' with void
return type [-Wattributes]
[[nodiscard]] explicit Test(int val) : m_val(val) {}
These warnings will lead to build failures when compiled with
-warnings-are-errors flag, so for these compilers the macro
does not do anything.
An attempt to use __attribute__((__warn_unused_result__)) was
also unsuccessful on these compilers, so this patch goes for
an easy solution, and simply checks
__has_cpp_attribute(nodiscard) >= 201907L
to decide if the attribute is supported or not.
This commit also introduces a syntax-only test, and also applies
the new macro to QMutexLocker, because not all platforms in the
CI build and run unit tests.
Fixes: QTBUG-104161
Change-Id: Ib4230661a5ad5e8af0d67b21b034486ebcd67562
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
According to the upstream bug report [1], this bug has been fixed
already. So remove the now useless workaround.
[1] https://bugs.llvm.org/show_bug.cgi?id=41226
Change-Id: I7e17750f9e47fb9a0f8315ca15f89b741b107a35
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QWeakPointer can do the same, so there's no reason to not allow it for
QPointer.
[ChangeLog][QtCore][QPointer] QPointer<T> can now be (move- and
copy-)constructed from QPointer<X>.
Fixes: QTBUG-112464
Change-Id: I77cf5d39974bf2b3ec849b4afc33e286e864821e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
No duplicate paths in any XDG_* env var.
Also borrow some text from the original commit 9deacd7f20 message.
Change-Id: I89f1fe3093dd7fea2d1bb555e36f299a73685f07
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Now the tst_qstring is compiled three times:
- with QT_NO_CAST_FROM_ASCII defined
- with QT_RESTRICTED_CAST_FROM_ASCII defined
- with neither of the above defined
so as to cover more code paths.
Pick-to: 6.5
Task-number: QTBUG-109228
Change-Id: I65eca0f6f6aea66fed6eeda1eb77a50a97210807
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
These warnings slipped in during a time period where documentation
testing in the CI was disabled.
src/network/kernel/qhostinfo.cpp:254: (qdoc) warning: clang couldn't
find function when parsing \fn template<typename Functor>
int QHostInfo::lookupHost(const QString &name, Functor functor)
src/widgets/widgets/qcheckbox.cpp:102: (qdoc) warning: clang couldn't
find function when parsing
\fn void QCheckBox::stateChanged(Qt::CheckState state)
src/corelib/kernel/qcoreapplication.cpp:2769: (qdoc) warning: clang
couldn't find function when parsing
\fn template<typename Functor> void
QCoreApplication::requestPermission(
const QPermission &permission, Functor functor)
src/corelib/serialization/qxmlstream.cpp:3806: (qdoc) warning: clang
couldn't find function when parsing
\fn bool QXmlStreamAttributes::hasAttribute(
const QString &qualifiedName) const
src/corelib/text/qtliterals.qdoc:11: (qdoc) warning: Multiple topic
commands found in comment: \namespace and \headerfile.
Pick-to: 6.5
Change-Id: I38c605f358dbca1ef3e2bfe20a6424f7a4d44b4a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
During QCoreApplication initialization, we create the main thread's event
dispatcher, which for a GUI app happens via QGuiApplicationPrivate's
createEventDispatcher() override. This in turn relies on the platform
integration to create the event dispatcher, but to do that it needs to
create the platform integration first. And this might result in calling
APIs that themselves initialize the main thread event dispatcher, such
as QEventLoop, which non-lazily creates an event dispatcher for the thread.
We already had a check to catch the platform integration setting the
QCoreApplictionPrivate::eventDispatcher member, but not anything for
checking the current thread data.
On macOS this resulted in a leak of QEventDispatcherUNIX because
QCocoaDrag contained a QEventLoop member. We now track the event
loop temproarily via a pointer instead, like we do in other places.
An alternative fix would be to defer the initialization of QCocoaDrag
until QCocoaIntegration::drag() is called, but that would run the
risk of something calling the function during platform initialization
and we'd be back to the same problem.
It's unclear why QEventLoop is not lazily ensuring the event dispatcher,
and this might be a wider fix for similar issues.
Pick-to: 6.5
Change-Id: I643010ddb09945936ce9b0b94de0df96f6fe218f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>