It's perfectly ok to de-inline a function, even an exported one, so
remove the tryLock_impl() middle-man and pull the Qt 7 pre-programming
into the here and now.
Amends 5cea5fc80b.
Pick-to: 6.6
Change-Id: I7e9626a91d8ebd64e02c3784c74621950da669fb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
1. QObject
For ifdef Q_OS_UNIX we inherit from QObject but it's not included
anywhere, only implicitly defined!
This was compiling before because the moc file was compiled together
with _another_ moc file that _did_ include QObject.
2. QWindow
For QT_DECLARE_NATIVE_INTERFACE we need to have QWindow included.
Change-Id: I5fc0c2d52cb23ee0b2a884178e9115b19e77bf41
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The Private class consists of just one quintptr member now, so it fits
into the ex-d_ptr member of the public class.
Since no allocations take place anymore, and we widened the contract
to allow for nullptr arguments, mark the constructors as noexcept.
[ChangeLog][QtCore][QEventLoopLocker] No longer allocates; all
operations are noexcept now.
Fixes: QTBUG-114793
Pick-to: 6.6
Change-Id: I89699e331711f517d0502392dba106a47ccc9a0f
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
a611a9f537 (in Qt 5) added support for
mixed-type comparisons through QCOMPARE. That commit added a new
overload for qCompare taking two types, T1 and T2; but it also left the
same-type qCompare(T, T) overload around, guarded by a Qt 6 version
check.
The mixed-type version is however not a generalization of the same-type
one, because it won't work if one of the arguments doesn't participate
in FTAD. Case in point: braced-init-lists. In Qt 5 this worked:
QCOMPARE(some_container, {42});
but in Qt 6 it does not work any more. The mixed-type overload fails
deduction (can't deduce T2); in Qt 5 the same-type overload deduced
T=SomeContainer, and {42} was used to select a constructor for
SomeContainer.
--
There's a partial, straightforward workaround for this: default T2 to
T1 in the mized-type overload. In that case T2 has a "fallback" if it
cannot be deduced. This is partial because of course doesn't address
the case in which T1 cannot be deduced, but I don't think that is
common at all.
QList is special here, because it has qCompare overloads that makes it
comparable with arrays, initializer lists and more. I don't like that
very much -- we should probably have a qCompare(input_range,
input_range) overload, but that's an exercise for C++20.
Change-Id: I344ba33167829984978cd8d649a1904349a9edab
Pick-to: 6.5 6.6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Interface libraries don't build anything, commands that belong them
might not run if nothing depends on an interface library. We still need
to make sure that we run syncqt for interface libraries.
Add '_sync_headers' for interface libraries to "ALL" explictily.
Amends a8cf976ce6
Fixes: QTBUG-115101
Pick-to: 6.5 6.6
Change-Id: I24b34574fdc3060e3a60886620dbe5c1b526f1a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Replace D-BUS with correct splling D-Bus in the source code,
Keep the old spelling inside XML DTD declarations for compatibility.
Change-Id: Ifa5d43f9fa1417431c81cf1bce0d897a966409b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use this format when reporting diagnostics relating to a source file:
<file name>:<line>:<column>: {error|warning|note}: <message>
This makes it easier to find the source elements that caused
a diagnostics report.
Fixes: QTBUG-2597
Change-Id: I8d8d13f7d71d1ce0c5050a0d08dddd33f9997f27
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For better OOP code structure and to get overview
over functions that need this shared state.
Task-number: QTBUG-2597
Change-Id: Ib3a26a1116362c3c798052b6bce8db2062451bdb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This would allow to emit parser-related diagnostics
from tools like qdbusxml2cpp. Also such tools could
stop processing if there were parse errors.
Task-number: QTBUG-2597
Change-Id: I573296bb57613d5a443b8c4dbe645b7e82f65adc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a structure for annotation data containing
name, value and location information. This is done
to be able to emit diagnostics related to annotations
that include source location.
Task-number: QTBUG-2597
Change-Id: Ie990bcd0a16752b5f44f4314f8d730dd1b1a30b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add an abstract class QDBusIntrospection::DiagnosticsReporter
for reporting errors and warnings. Extend QDBusXmlParser
to accept optional diagnostics reporter and use it when
available.
Report unexpected elements as warnings and the rest of
problems as errors.
This will allow tools like qdbusxml2cpp to show parsing
diagnostics using a custom format.
While at it, s/D-BUS/D-Bus/a
Task-number: QTBUG-2597
Change-Id: Ibec3f5f282cf717d1127eb64c82b4fc695f14a74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add source location to the introspection structs so
that errors and warning produced by qdbusxml2cpp can
be related to the source location.
Task-number: QTBUG-2597
Change-Id: I9a6ada45f9c0357dbfb846f13789c5f261e59d55
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Also make QXmlStreamReader instance and the current interface
members of the class. This reduces amount of arguments that
need to be passed arounds.
Task-number: QTBUG-2597
Change-Id: Iebd2db98a34019923b7a4fe198cc081cd010c8a3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Removing dangling references to the example due to its move to
manual tests.
Pick-to: 6.6 6.5
Change-Id: I13f5fad93763d1ef70ddd8b3dcf430b5df8e28f9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
VCPKG by default does static builds when building for Android.
This is at odds with the bundling-concept, so it should not be done
unconditionally.
Since we don't necessarily have the WrapOpenSSL target on-hand, let's
just do a file-exists test for the one of the paths we would include.
Pick-to: 6.6 6.5
Change-Id: I3693354308d5168d8a9c3d1659bfa51540114b7f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
It's a bit excessive to warn every developer about this, especially if
they are using non-Xcode generators; besides, we are already generating
a bundle identifier if it is missing anyway.
Pick-to: 6.5 6.6
Change-Id: Ib11ad51a0e516e0ea61ad2f7bf499b846bc0b792
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
syncqt uses iostream API that 'excepts'. So enable exceptions flags
when building it.
Amends 49ce711796
Pick-to: 6.6 6.5
Change-Id: Ib0cd581eaec9ae73edc9de423019098304049463
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Much like QT_FATAL_WARNINGS, QT_FATAL_CRITICALS also is
interpreted as a counter. Revamp both function descriptions
to make scope and purpose clearer.
Also, mention logging rules as a way to surpress output,
in addition to a custom message hander.
Pick-to: 6.5 6.6
Change-Id: I44767abb067a6accd81f13dc549c9787ef9a4729
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
CAS failures should result in PAUSE/YIELD, cf. qYieldCpu() docs.
qYieldCpu() is only available since Qt 6.3, though, so adding it as a
follow-up with limited pick-to.
Task-number: QTBUG-115062
Pick-to: 6.6 6.5
Change-Id: Ibcc73881875a47935940015e30b9a27a282054d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The old code first checked for == 0, then, if false, executed a
fetchAndAdd(-1), both with relaxed memory ordering. This can lead to
executions that, counter to what the code comment states, can count
down past 0:
// T1 T2
loadRelaxed() // true
loadRelaxed() // true
fetchAndAddRelaxed(-1) // e.g. 1 → 0
fetchAndAddRelaxed(-1) // 0 → -1
while fatality is detected exactly once, this execution doesn't stop
at 0 and causes further calls to isFatal() to count down further, with
the (very) remote spectre of underflow past INT_MIN.
Fix by using a CAS loop instead, so each count-down uses only one
step, not two, which therefore can no longer interleave.
Fixes: QTBUG-115062
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: If77b906c94cb4b9fa91bfad84fe63bc8d9103b0a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Hiding a button in a QDialogButtonBox doesn't remove its default and
focus behavior. Hiding the button shown in the first position, breaks
the focus chain. Tabbing between the button is no longer possible.
This patch implements listening to the buttons' HideToParent and
ShowToParent events. Hidden buttons are removed from the button box
and kept in a separate hash. That ensures focus chain consistency.
When they are shown again, they are added to the button logic and
their default/focus behavior is restored.
An autotest is added in tst_QDialogButtonBox.
Fixes: QTBUG-114377
Pick-to: 6.6 6.5
Change-Id: Id10c4675f43d6007206e41c694688c4f0a34ee52
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The change in commit 04ee5795cc was
source-incompatible if the function in question was a non-static member.
I could add a new, template constructor to catch those, but this is
simpler.
Fixes: QTBUG-115043
Pick-to: 6.5 6.6
Change-Id: I53335f845a1345299031fffd176f1071afbae7a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Because an unnamed namespace, and variables inside it, have internal
linkage[1]; and the variable is constexpr in this case so static
redundant.
This fixes a clang-tidy warning:
readability-static-definition-in-anonymous-namespace
[1] https://eel.is/c++draft/basic.link#4
Change-Id: I95600214cd51b03872ee22995d93d1b5658d5a18
Task-number: QTBUG-112870
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It looks like a left-over from converting to SPDX-License-Identifier in
05fc3aef53.
Change-Id: Ia925f8443b35f850512627d985d570616c548cd0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
It was changed from ERROR to XML_ERROR to disambiguate static variables
in d3f8d7fd41. Make the change in
qxmlstream.g, so that generating the C++ code doesn't revert it.
Pick-to: 6.6
Change-Id: Ie51955a2b013ce8d9580ce64f708598f9a103754
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
The optional-like FastScanNameResult was used to make some previous
changes backport-able to Qt 5.15 (std::optional is C++17 whereas Qt 5.15
requires C++14).
Amends commit 6326bec46a.
Pick-to: 6.6 6.5
Change-Id: I409e1da83f82927c1eb24c47c1414c0c7ab1bf5b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
When QDebug::quoted(), indicates the encoding using the u/u8 prefixes
or the _L1 suffix. This is information that might come in handy, and
we plan to make it off-switchable (QTBUG-114936). The default should
be true, though, for QAnyStringView, because we should confront users
with this feature so they learn it exists. For concrete view types,
changing the default behavior is probably not a good idea.
[ChangeLog][QtCore][QAnyStringView/QDebug] Can now stream
QAnyStringView into QDebug.
Fixes: QTBUG-114935
Change-Id: Icd5bf700c8b7958e942468b54248487998f262d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
I see this with -unity-build -unity-build-batch-size 32, but I don't
know whether it's unity-build or just Clang 15, so also pick to
6.2. The issue exists in 5.15, too, presumably, but I have no desire
to find a non-C++17 fix.
It appears the generator (glgen) is out-of-sync with the state of its
supposed output as of at least 18aae36a90,
so don't try to update the generator (I failed to find where these
fields originate from, anyway).
Pick-to: 6.6 6.5 6.2
Task-number: QTBUG-115031
Change-Id: Ia27620b8f8034c3e8eff383abb849e6ce93dce8a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
a7deddba51 implemented a warning for
disallowed null parameters. A check, was missing, if the argument is
actually null.
This patch adds the missing check.
Fixes: QTBUG-114683
Pick-to: 6.6 6.5
Change-Id: Iecbd636599a28284a0a9afe2987e48552f3658ff
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
The 3-arg connect is error-prone and makes the lifetime of the
connection unclear.
Change-Id: I1b6b10d814412f02ae534d408723762ba7cd815b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The 3-arg connect is error-prone and makes the lifetime of the
connection unclear.
Change-Id: I51f9bd87caa9baa57d06c8f3fd9ed8b37ef49cae
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This change makes system drag become initiated right after dragging
is detected when drag start distance from
QApplication::startDragDistance is 0. Otherwise the starting distance
is ignored and the value of 1 is implicitly used.
The startDragDistance of 0 is needed on WASM, as the native
dragstart event arrives exactly after the first mousemove event.
With this change, it is possible to set up drag correctly prior to
the native dragstart event arriving.
Fixes: QTBUG-114947
Change-Id: I112d97d251c9e9b1a39196ddcc39a37024b441f6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We shouldn't try to promote tool targets if they were not created
when Qt6FooTools_FOUND is FALSE due to missing dependencies and
Qt6FooToolsTargets.cmake is not included.
Add a check for Qt6FooTools_FOUND to prevent errors like:
CMake Error at lib/cmake/Qt6/QtPublicTargetHelpers.cmake:257
(get_property):
get_property could not find TARGET Qt6::qtprotobufgen. Perhaps it
has not yet been created.
Pick-to: 6.5 6.6
Change-Id: Ie26db637d4d8ef682a0ada5ea36ef0e8ceced008
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Add the boilerplate standalone test prelude to each test, so that they
can be opened with an IDE without the qt-cmake-standalone-test script,
but directly with qt-cmake or cmake.
Boilerplate was added using the following scripts:
https://git.qt.io/alcroito/cmake_refactor
Manual adjustments were made where the code was inserted in the wrong
location.
Task-number: QTBUG-93020
Change-Id: I77299f990692b4fe4721a9bc35071608d0d23982
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Add the boilerplate standalone test prelude to each test, so that they
can be opened with an IDE without the qt-cmake-standalone-test script,
but directly with qt-cmake or cmake.
Boilerplate was added using the following scripts:
https://git.qt.io/alcroito/cmake_refactor
Manual adjustments were made where the code was inserted in the wrong
location.
Task-number: QTBUG-93020
Change-Id: I000cd3b0809b6417c3b1ab520e4de746afee71fc
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add the boilerplate standalone test prelude to each test, so that they
can be opened with an IDE without the qt-cmake-standalone-test script,
but directly with qt-cmake or cmake.
Boilerplate was added using the following scripts:
https://git.qt.io/alcroito/cmake_refactor
Manual adjustments were made where the code was inserted in the wrong
location.
Task-number: QTBUG-93020
Change-Id: I3c0d1a63c474969e5eaee5fdbb1bb0229482fc5b
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add the boilerplate standalone test prelude to each test, so that they
can be opened with an IDE without the qt-cmake-standalone-test script,
but directly with qt-cmake or cmake.
Boilerplate was added using the following scripts:
https://git.qt.io/alcroito/cmake_refactor
Manual adjustments were made where the code was inserted in the wrong
location.
Task-number: QTBUG-93020
Change-Id: I2ef59684cf297a0222a136ce7b5630037294d000
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add the boilerplate standalone test prelude to each test, so that they
can be opened with an IDE without the qt-cmake-standalone-test script,
but directly with qt-cmake or cmake.
Boilerplate was added using the following scripts:
https://git.qt.io/alcroito/cmake_refactor
Manual adjustments were made where the code was inserted in the wrong
location.
Task-number: QTBUG-93020
Change-Id: I28b6d3815c5f43d2c33ea65764f6f3f8f129eaf3
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The 3-arg connect is error-prone and makes the lifetime of the
connection unclear.
Amends dae24df07f
Change-Id: Iec1c2cb266fcaca1a1c407a6158cc8bbb282756b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QGenericUnixServices is an abstract class subclassed by the wayland
backend for wayland specific functionality. This moves to a consistent
pattern where X11 code is also the X11 backend rather than guarded with
if statements.
Change-Id: I1cc7ebac811463451d744fdc034f5ad5fd022bc6
Reviewed-by: Liang Qi <liang.qi@qt.io>