The cachedRelaySlotMethodIndex started out as -1, assuming no slot
could have that index.
But 0 is just as good a marker, because we know that method index 0
will be one of QObject's (destroyed() or deleteLater()).
So start out with a zero initial value, which means the variable can
be placed in the BSS segment now and doesn't need to be stored in
DATA.
Pick-to: 6.3 6.2
Change-Id: I40b96d54f11e60348f465cafa15af98d41038c95
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Introduce the qdoc macros \cmakecommandsince, \cmakepropertysince, and
\cmakevariablesince that insert a paragraph akin to the \since context
command.
Example:
\cmakecommandsince 6.3
produces the paragraph
This command was introduced in Qt 6.3
The macro text is wrapped in \n\n to ensure that we always generate a
new paragraph.
Pick-to: 6.2 6.3
Task-number: QTBUG-100212
Change-Id: Id5c8e8812e6b0b915674d108a0e775091e9eacd8
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Create macros that wrap the magic developed in
7d63efc16f and apply it to all
Q_DECLARE_METATYPE invocations that show up in Clang -ftime-trace for
a PCH'ed QtGui build.
Effects on compile times:
Clang 10 -ftme-trace:
$ ClangBuildAnalyzer --analyze qtgui-before.trace | head -n6
Analyzing build trace from 'qtgui-before.trace'...
**** Time summary:
Compilation (523 times):
Parsing (frontend): 628.3 s
Codegen & opts (backend): 304.5 s
$ ClangBuildAnalyzer --analyze qtgui-after.trace | head -n6
Analyzing build trace from 'qtgui-after.trace'...
**** Time summary:
Compilation (523 times):
Parsing (frontend): 546.0 s
Codegen & opts (backend): 304.4 s
GCC 11 time (bash builtin):
before:
$ time for ((i=0; i < 3; ++i)) do touch src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done
real 4m13,539s
user 49m24,416s
sys 3m18,177s
after:
$ time for ((i=0; i < 3; ++i)) do touch src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done
real 3m55,697s
user 45m19,941s
sys 3m7,370s
Task-number: QTBUG-97601
Pick-to: 6.3
Change-Id: Ia8e37a58937568a7ed21cfeb4b27274deca4d53b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Using REQUIRED as a prefix instead of suffix works better with
OPTIONAL_COMPONENTS, and is also the order in the CMake manual.
Task-number: QTBUG-98867
Pick-to: 6.2
Change-Id: I1ab68408b95d8edf06272a3b9fceccd8d8e597fc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
In addition, added the missing warninglimit
entry to a few doc configs.
Change-Id: I51b9d2ad66123a2a9673a3b42870662641375e6b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The macro takes only one parameter, sentences must be wrapped in {}.
Pick-to: 6.2
Fixes: QTBUG-97441
Change-Id: I7177548a32a67d720c2b551d16c09d898b0fda51
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
So far the pages were only 'rooted' in the separate qtcmake
documentation. Let them have a page per module too, so that
it's easy to navigate.
At the same time rename the cmake-macros-qtcore group to
cmake-commands-qtcore. This will require a fixup in qtdoc
repository.
Pick-to: 6.2
Change-Id: Ifc09b27a6c220b5feab64686ca47c60d3342e71a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
For normal \page elements, \brief is just showing in the
\generatelist or \annotatedlist commands. Make sure the description
is also visible in the actual CMake command/variable/property
page by defining a \summary macro.
Pick-to: 6.2
Change-Id: I12bc854d547059a2f6309a5922bb0b2a36d4e41c
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
In Qt 5, QVector::iterator was actually a raw pointer. In Qt 6,
QVector = QList, and QList::iterator isn't a pointer, but converts
to one (for backwards compatibility).
Some code in QtDBus exploits this by mixing iterators and raw
pointers. In preparation for deprecating conversions between them,
adjust this code by "converting" explicitly when needed.
Change-Id: I1efab72b33d27742b339cf848cefd5cc258cd215
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
CMake silently drops empty list items when passing ${someVar} to a
function unquoted. The versionless wrapper functions typically use
${ARGV} or ${ARGN} to pass through arguments from the caller to the
versioned implementation, but this doesn't preserve empty arguments.
For qt_add_dbus_adaptor() in particular, this was problematic because
that meant arguments after the empty arg effectively "moved left" and
were interpreted as the wrong arguments.
Use named arguments and pass through each one explicitly for the
qt_add_dbus_adaptor(). This takes advantage of the implementation of
the versioned function, which also checks each optional positional
argument explicitly. We can only do this because we know the upper
bound on the number of arguments, so it is possible to represent each
argument with its own variable. A more general solution that didn't
need to know the number of arguments would require the
cmake_language(EVAL) command, but that requires CMake 3.18 or later.
Fixes: QTBUG-96594
Pick-to: 6.2
Change-Id: Ibb1de19217191768ca5ead969b20a1d28c466868
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This makes sure that the Qt version is part of the HTML title.
Pick-to: 6.2
Change-Id: I2ad8535a9289616d21c18bd9e92d4a91f6faced0
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This reverts commit 08180e76e6.
Macros add another level of escaping that functions do not. The
conversion of the versionless wrappers to macros may alter the
behavior, so revert that change.
Task-number: QTBUG-96219
Pick-to: 6.2
Change-Id: Ic5dcff3081123d957888584ba1d76ae0580d9083
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Using function instead of macro prevented the wrappers from being able
to pass back any variables set in the wrapped function. In some cases,
these variables were being explicitly passed back to the caller, but
that isn't needed if you just make each wrapper a macro. This also
makes things more future-proof because any newly introduced output
variables will work without having to update the wrappers.
Task-number: QTBUG-96121
Pick-to: 6.2
Change-Id: Ic4486de668694c06b47e466587b2cdcb969ea047
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
qdbuscpp2xml can't know about custom types registered with
qDBusRegisterMetaType<> in the server application whose header file
it's parsing. So add support for custom types using a command line
argument. For example:
qdbuscpp2xml -t 'std::vector<Person>=a{ssss}' peopleserver.h
which generates
<arg name="people" type="a{ssss}" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="std::vector<Person>"/>
[ChangeLog][QtDBus][qdbuscpp2xml] Added a -t option to specify how to
handle custom types.
Change-Id: Ic0cad4f4eec8d5dfa48055c3a46cc772b1a60174
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The "wantedMask" check in the xml generator didn't distinguish slots
from invokables, so exporting an object with just ExportScriptableInvokables
didn't allow calling Q_SCRIPTABLE methods.
Change-Id: I7b408755da5b28e67a9384d9df95e22dc5de2369
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When documenting a CMake command, document the unversioned command
'qt_foo' and use '\versionlessCMakeCommandNote qt6_foo' to refer to the
versioned command. This avoids duplicating the command signature.
Use the new macro where applicable.
Pick-to: 6.2
Task-number: QTBUG-95796
Change-Id: I2e4180fbda0b89acf3d8c036459f591eb2f46475
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Says GCC:
qdbusmarshaller.cpp: In member function ‘QDBusMarshaller* QDBusMarshaller::beginMap(QMetaType, QMetaType)’:
qdbusmarshaller.cpp:286:17: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
286 | qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
| ^
Fix by manual checking. It's a False Positive, because
QString::asprintf() can handle nullptr strings just find, but let's
make GCC happy.
Since the code snippet appears multiple times, even though GCC only
warns about one of them, take this opportunity to factor the code out
into a cold helper function.
Change-Id: I1d642f2465f34b670b179646185cba05cb16e573
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Replace the hardcoded cpp exports with a generated one where it's
applicable.
Task-number: QTBUG-90492
Change-Id: Idc160b594987b2c765e75bd669aae851b4366282
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(I wish these common mappings were centralized though, so that
annotations in the XML file wouldn't be needed)
Pick-to: 6.0 6.1 5.15
Change-Id: Ie3e8731e44b6e0338c8a044408c34160cf0a3a1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Port watchMode in QDBusServiceWatcher to the new property
system. This is the easiest part.
Task-number: QTBUG-85520
Change-Id: I588212af205e77765862b8fecdbdcbf871717142
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This function returns the metatype corresponding to the metaobject, or
an invalid metatype for namespaces.
This works as follows: First we increment the metaobject revision for
new metaobjects. Metaobjects with older revisions are handled by doing a
lookup by name. That fallback is also used for dynamic metaobjects (from
QtDBUS and those created by QMetaObjectBuilder).
For new metaobjects, we store the metatype in its metatype array, behind
the property metatypes. This avoids any changes to the property and
method metatype extraction logic: For properties, the metatype access
does not change, as the new metatype is after their metatypes. For
method metatypes, we already have an indirection layer (using offsets),
so by adjusting those offsets by one, the same logic keeps working.
To distinguish between namespaces and dynamic metaobjects, namespaces
store the metatypeinterface pointer for void in the metatype array,
whereas dynamic metaobjects store a nullptr.
One nice additional benefit is that this simplifies the generator logic
in moc, as the metatype array is now never empty.
Task-number: QTBUG-92077
Change-Id: Id3f920f28553f12032a71a1a87dad29e5374dbe7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Section titles are valid targets for QDoc's autolinker. When
they are identical to other valid link targets, such as for
example a class, these sections may cause invalid links.
Pick-to: 6.0 6.1
Fixes: QTBUG-91141
Change-Id: Ie9a6258d2bf83932335976d8c0b5fc59f2028ae5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Those serve no purpose anymore, now that the .pro files are gone.
Task-number: QTBUG-88742
Change-Id: I39943327b8c9871785b58e9973e4e7602371793e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Per the discussion of QTBUG-88831, we determined that module-wide
imports are unfortunate, especially for compile times. Following this,
all QtDBus includes have been replaced with the headers for the classes
actually used in each file. Additionally, some cleanup of header file
order and format has been performed in the changed files.
Pick-to: 6.0
Change-Id: I62c1b75682a48422f0ba1168dd5d7bd0952808ac
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Remove the qmake project files for most of Qt.
Leave the qmake project files for examples, because we still test those
in the CI to ensure qmake does not regress.
Also leave the qmake project files for utils and other minor parts that
lack CMake project files.
Task-number: QTBUG-88742
Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
The Professional CMake book suggests always using explicit linkage with
target_link_libraries, so let's use that.
Whether to use PUBLIC or PRIVATE depends on the context. But let's
be conservative and advise on using PRIVATE by default.
Task-number: QTBUG-88935
Pick-to: 6.0
Change-Id: I12b80ee85be9f6916f1e4dea6b1c9cb29e03c20f
Reviewed-by: Craig Scott <craig.scott@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
We've decided that QScopedPointer shouldn't be movable,
because it would break the semantics of being "scoped"
(the pointer/pointee won't survive the scope).
Then, QScopedPointer shouldn't allow for take() either.
If you need those semantics, reach for unique_ptr.
[ChangeLog][QtCore][QScopedPointer] The take() function
has been deprecated. This was an API mistake, as it
allowed the pointer/pointee to escape from the scope,
defeating the point of the QScopedPointer class. If you
need such semantics, use std::unique_ptr (and call
release()).
Change-Id: I3236f085f763b04eb98e3242abc06f7c54fb3d8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If more than one signal parameter required conversions (e.g. 2
QVariantMaps), then the auxParameter list would be reallocated on the
second append. This resulted in the reference to the first conversion
(stored in params) to be broken.
Found with valgrind after the QtApplicationManager started crashing
weirdly when built against Qt 6. The same code is in Qt 5, but it
just works fine there: I guess the reallocation strategy in QList is
different there, so we never have to reallocate the list.
Change-Id: I2e0c8906ebc9474c4ec9f53cafc1689003d5c4c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The content in the porting guides are closer to a changelog than
a porting guide. At this point, it is easier for maintainers and
contributors to write in a changelog than a guide. This change
should help with readability and is closer to the usage of
"Changes" in documentation.
Part of a rename in other submodules.
Task-number: QTBUG-87156
Change-Id: Ib59de7976fae19e7b39962e80161df6628e4070b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The non-versioned one's do miss some properties. It's therefore best
to not advocate using them.
Change-Id: I53645e65ed4de4e0100e59905c024cdfe40be0c5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
It's been obsolete for a long time already. Make sure
the compiler now warns about it and remove all remaining
uses in qtbase.
Change-Id: I0ff80311184dba52d2ba5f4e2fabe0d47fdc59d7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Keep this in sync with the changes we have done in QTypeInfo.
Change-Id: Iaacb0f3cc5c46d3486084a1f6eca480a233d5e1a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
And remove the limitation to 8 types from the documentation.
Change-Id: I92c67368e53d69fd851886c621f3f894f638bae9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This time based on grepping to also include documentation, tests and
examples previously missed by the automatic tool.
Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
As a C++ attribute it must be on the beginning of the line or after
the function name however. And for friend declarations can only
be on the definition.
Change-Id: I456884428f36e1f1c621089c7b1addee13ada0fe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
None of this code is even compiled in qt6.
Change-Id: I5891cc9459320083ad3908fcbf646f3ba75b8a4d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Change the implementation of Qt DBus to use QMetaType directly
instead of integer based type ids.
Change-Id: I999023b58fa50dcc3504386467faf09874f7d2cf
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
A QList<int> where int is the metaType id is a bad idea in Qt 6,
as custom types will start at index 65536. Use a QHash instead.
Also fix the API to use QMetaType as arguments and return values.
Change-Id: Ia0b894126271be1f01dc4593b5155fb75d713720
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Modernize the code base, use QMetaType and avoid
reinterpret_casts.
Change-Id: I0bad2ee393a0f850cf40b248cb9439b06ed9f663
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Remove the limitation of max 8 arguments and clean up the
template code.
This required a bit of special work to ensure
QDBusPendingReply<void> works the same way
as QDBusPendingReply<>.
Change-Id: I8e822b2f97f0712746b917056ea8f3d5c219c7f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Modify special case locations to use the new API as well.
Clean up some stale .prev files that are not needed anymore.
Clean up some project files that are not used anymore.
Task-number: QTBUG-86815
Change-Id: I9947da921f98686023c6bb053dfcc101851276b5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Skip AUTOUIC on sources generated by the qt_add_dbus_interface and
qt_add_dbus_adaptor macros. Otherwise CMake will warn due to policy
CMP0071:
```
For compatibility, CMake is excluding the GENERATED source file(s):
(...)
from processing by AUTOMOC and AUTOUIC. (...)
```
Pick-to: 5.15
Change-Id: I7d14b23c9343940964d5bc0d1d18fc19b41b5cd0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Also add existing such docs to the new document group
Task-number: QTBUG-84051
Change-Id: I76f033f0846e09943f249d2beeb1606869eef382
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Better to provide the correct meta type to convert to.
Change-Id: I8e0d46e4ba482186201c157e302c03874bd38e7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
And remove one of the type id to name mapping that still
existed in QMetaType. QMetaTypeInterface can provide that,
so there's no need to have a second copy of the data.
qMetaTypeTypeInternal() can still map all the names of all
builtin types to ids. That functionality is for now still
required by moc and can't be removed yet.
Change-Id: Ib4f8e9c71e1e7d99d52da9e44477c9a1f1805e57
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
And remove the old manual registration code for those operators.
Add some special handling for long/ulong, as these types could be
streamed as a QVariant so far, but are not directly streamable
through QDataStream.
[ChangeLog][QtCore][QMetaType] The QMetaType::registerStreamOperators()
and QMetaType::registerDebugStreamOperator() methods have been
removed. The streaming operators for a type are now automatically
registered together with the type registration. This implies that the
operators should be visible wherever the type is visible and being used.
[ChangeLog][Behavior Incompatible Changes] Because the QDataStream and
QDebug serialization operators are automatically registered with
QMetaType, the declarations of those functions must be present at any
point where the type is used with QMetaType and QVariant.
Change-Id: I4a0732651b20319af4a8397ff90b848ca4580d99
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
While trying to implement instructions for building examples with
qmake in the CI, an issue has surfaced.
When building examples with CMake with -DBUILD_EXAMPLES=ON in the CI,
the examples are built in-source, aka source dir == build dir.
This means that the header files generated by qdbusxml2cpp will be
placed in the qtbase source dir.
The instructions that try to build examples with qmake build the
examples in a separate build dir after building the examples with CMake.
Unfortunately the qtbase/examples/dbus/remotecontrolledcar/car example
includes the generated DBus adaptor header via a statement like
#include "car_adaptor.h"
and the compiler prefers to pick up the header file from the example
source dir (the one generated by CMake), rather than the one generated
by qmake in the example build dir.
Because CMake's DBus integration uses different flags than qmake's
DBus integration, the generated header file code is not compatible
with the qmake generated cpp file, and the example fails to link when
building with qmake, because it can't find an appropriate constructor
symbol.
In an ideal world, we wouldn't do in-source builds with the CMake
build, but that leads to other issues which I currently don't recall.
To circumvent the issue, adapt the CMake DBus qt6_add_dbus_adaptor
function to allow not passing the problematic '-l' flag by making it
optional. This shouldn't break existing code, but allows us to
generate a compatible header that will be used by qmake and succeed in
linking the example.
Task-number: QTBUG-85986
Change-Id: I06759f79aeb66bb32da7f158f55dd4734c4a9887
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
It was marked internal anyway. Use the constructor taking a
QMetaType instead.
Change-Id: I15b9cd0911aac063a0f0fe0352fa2c84b7f7c691
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Passing QDBusUnixFileDescriptors over peer-to-peer connections currently
does not work, because QDBusConnectionPrivate::setPeer() does not set
this->capabilities (unlike QDBusConnectionPrivate::setConnection()
which is executed for bus connections).
Keep track of whether the connection already has been authenticated, and
once the connection does get authenticated, update this->capabilities.
Note that sending a message directly after connecting (before any
message has been received from the peer) might still fail if the message
contains a QDBusUnixFileDescriptor.
Pick-to: 5.15
Fixes: QTBUG-85396
Change-Id: Ib83213ebcd3255fb091c6faefb3618745b8d736c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This removes the fully manual registration of comparison operators in
QMetaType and replaces it with an automatic registration through
Q_DECLARE_METATYPE().
[ChangeLog][QMetaType] The QMetaType::registerComparator() and
QMetaType::registerEqualsComparator() have been removed.
Q_DECLARE_METATYPE() now automatically registers any
operator==() and/or operator<() for a type visible where
it is used on that type, as part of declaring its meta-type.
Change-Id: I3df451b652b735c093533838bf32f3cc785439f8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is required to remove the ; from the macro with Qt 6.
Task-number: QTBUG-82978
Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Also add a ; where it is missing.
Task-number: QTBUG-82978
Change-Id: Ic5d2a07363c25ab641d234baca89bc62238458cb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Omitted type replacement in qDBusParametersForMethod() for now.
Task-number: QTBUG-84469
Change-Id: Ieb9fbb30b431c5e4183ad57acd35640e9556bf6c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
There is no reason for keep using our macro now that we have C++17.
The macro itself is left in for the moment being, as well as its
detection logic, because it's needed for C code (not everything
supports C11 yet). A few more cleanups will arrive in the next few
patches.
Note that this is a mere search/replace; some places were using
double braces to work around the presence of commas in a macro, no
attempt has been done to fix those.
tst_qglobal had just some minor changes to keep testing the macro.
Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This changes the layout of the meta object data, so
also bump the meta object revision.
Original-patch-by: Lars Knoll <lars.knoll@qt.io>
Change-Id: I176fb16c207e8ebe59e358e69554be813406232f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This does the analog of 46f407126e for the
methods we care about (signals, slots, Q_INVOKABLEs). In addition to the
actual QMetaType, we store an array with offsets so that we later can do
a mapping from methodIndex to metatype.
The newly added QMetaMethod::{return,parameter}MetaType methods can then
be used to retrieve the metatypes.
This does however require that all involved types are complete. This is
unfortunately not a feasible requirement. Thus, we only populate the
metatype array on a best effort basis. For any incomplete type, we store
QMetaType::Unknown. Then, when accessing the metatype, we fall back to
the old string based code base if it's Unknown.
Squashes "moc: support incomplete types" and "Fix compile failures
after QMetaMethod change"
Fixes: QTBUG-82932
Change-Id: I6b7a587cc364b7cad0c158d6de54e8a204289ad4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Qt 5.4 is not documented anymore since quite some time.
Change-Id: I6811ead502178f7acbed8cf450e42d7fd33ae29b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is Qt 6, so Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6 is the same as
Q_DECLARE_SHARED.
Let's hope we'll collectively get better at detecting missing
Q_DECLARE_SHARED so we won't need a
Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT7 in the future.
Change-Id: I3da9faff4c66b64a3b257309012a2a10a6c6d027
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The pre-existing overload passes an int, but this can mean the
descriptor gets truncated in compilations where the descriptor
is 64-bit.
The old overload with int is visible when querying the metaobject system
so string-based connects still work as before, and connecting to it will
produce a deprecation warning in the output.
At the same time the PMF-based connect will, on recompile, pick the
QSocketDescriptor overload. As an added improvement it also comes with
the notification type, removing the need for separate slots where the
code would be mostly shared anyway.
The QSocketDescriptor type can be implicitly converted to and from
qintptr to ensure existing code still compiles. It can also be
constructed from Qt::HANDLE on Windows.
In this same patch I also update the existing string-based connects in
this module, which then includes updating the parameters for some slots
as well.
[ChangeLog][QtCore][QSocketNotifier] Added
QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type).
This replaces the activated(int) signal which in 64-bit environments
could truncate the socket descriptor. If you use "activated" with the
string-based connect() then you need to update the parameter type of the
signal and slot if it had one. If you use it with the pointer to member
function based connect() then all you need to do is update your slot's
parameter type if it has one. If you need to compile your source code
with multiple versions of Qt then connect() to this function using
pointer to member function and update the slot's parameter type if
needed.
Task-number: QTBUG-70441
Change-Id: Ic43d6bc4c5bcb4040867b2ffad8d36fb01eed8af
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is required, so that QHash and QSet can hold more
than 2^32 items on 64 bit platforms.
The actual hashing functions for strings are still 32bit, this will
be changed in a follow-up commit.
Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Conflicts:
examples/opengl/doc/src/cube.qdoc
src/corelib/global/qlibraryinfo.cpp
src/corelib/text/qbytearray_p.h
src/corelib/text/qlocale_data_p.h
src/corelib/time/qhijricalendar_data_p.h
src/corelib/time/qjalalicalendar_data_p.h
src/corelib/time/qromancalendar_data_p.h
src/network/ssl/qsslcertificate.h
src/widgets/doc/src/graphicsview.qdoc
src/widgets/widgets/qcombobox.cpp
src/widgets/widgets/qcombobox.h
tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp
tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro
tests/manual/diaglib/debugproxystyle.cpp
tests/manual/diaglib/qwidgetdump.cpp
tests/manual/diaglib/qwindowdump.cpp
tests/manual/diaglib/textdump.cpp
util/locale_database/cldr2qlocalexml.py
util/locale_database/qlocalexml.py
util/locale_database/qlocalexml2cpp.py
Resolution of util/locale_database/ are based on:
https://codereview.qt-project.org/c/qt/qtbase/+/294250
and src/corelib/{text,time}/*_data_p.h were then regenerated by
running those scripts.
Updated CMakeLists.txt in each of
tests/auto/corelib/serialization/qcborstreamreader/
tests/auto/corelib/serialization/qcborvalue/
tests/auto/gui/kernel/
and generated new ones in each of
tests/auto/gui/kernel/qaddpostroutine/
tests/auto/gui/kernel/qhighdpiscaling/
tests/libfuzzer/corelib/text/qregularexpression/optimize/
tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/
tests/libfuzzer/gui/text/qtextdocument/sethtml/
tests/libfuzzer/gui/text/qtextdocument/setmarkdown/
tests/libfuzzer/gui/text/qtextlayout/beginlayout/
by running util/cmake/pro2cmake.py on their changed .pro files.
Changed target name in
tests/auto/gui/kernel/qaction/qaction.pro
tests/auto/gui/kernel/qaction/qactiongroup.pro
tests/auto/gui/kernel/qshortcut/qshortcut.pro
to ensure unique target names for CMake
Changed tst_QComboBox::currentIndex to not test the
currentIndexChanged(QString), as that one does not exist in Qt 6
anymore.
Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
DBus does have dbus-1.13.* releases these days, as well as its stable
1.12.* releases, but there's no change in the fragments we've
extracted from its headers, since the last (1.12.12) release we
checked against. We're thus in sync with 1.12.16 and 1.13.12.
Fixes: QTBUG-82748
Change-Id: Ic550e3cd7486db712643711d010f5b45c347a95b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The command is deprecated and has no effect apart from generating
a documentation warning.
Change-Id: I30871bfd6975f8268930cce99993a8579242fdb8
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
The Qt version was added in 5.14 "for use as eventual replacement for
QString::SplitBehavior." Move another step closer to that goal.
Change-Id: I399b5ea56e9255e775ca1746632f7421519a6616
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
the QMetaType is represented as a pointer to a "vtable" in the form of
a QtPrivate::QMetaTypeInterface*
The recomanded use of QMetaType is to construct an object with
QMetaType::fromType. This does not require any registration.
There is still an id() function which will do some registration
for compatibility with Qt5. Also the patch does not really touch
the other extra things that can be registered (data stream operator,
comparison operator, iteratable, ...) and this still uses the previous
system.
This is only the change in QMetaType, other changes to use it in QVariant
and QMetaObject will follow
Change-Id: Iffad20085cf33f33447f58a68236013a8b60fdbf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
There's no need to specialize the marshalling for QList, QHash and QMap
when we can simply have generic code here that works for all containers
Change-Id: I442ac6009953d2bd8e5a7012262cffeb8e912034
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
If we don't add the executable used by the custom_target and/or
custom_command to list of the command's/target's dependencies
(DEPENDS) the generated file will not update should the executable
change.
Change-Id: Idce30f3dd4f756d9e8f6848c5e16f5dd6c7c8f0a
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Create Qt:: versionless targets for libraries and tools. So
Qt::Core will link to Qt5::Core.
Add additional feature properties to targets, with the same name
they have in Qt6: QT_ENABLED_PUBLIC_FEATURES,
QT_DISABLED_PUBLIC_FEATURES, QT_ENABLED_PRIVATE_FEATURES,
QT_DISABLED_PRIVATE_FEATURES, to be forward-compatible with Qt6.
Prefix properties with INTERFACE_ for interface libraries.
Create functions with no major version in their prefix, so qt_foo
instead of qt5_foo.
The non-versioned functions will call the versioned functions,
depending on the value of QT_DEFAULT_MAJOR_VERSION, which can be
set by an application developer before finding the Qt package.
Set QT_DEFAULT_MAJOR_VERSION to 5 if the value has not been defined
in the current scope.
Application developers can set QT_NO_CREATE_VERSIONLESS_FUNCTIONS to
TRUE before calling find_package(Qt5) to suppress creation of the
non-versioned functions.
Application developers can set QT_NO_CREATE_VERSIONLESS_TARGETS to
TRUE before calling find_package(Qt5) to suppress creation of the
non-versioned targets.
Setting these can be useful when both find_package(Qt5) and
find_package(Qt6) are in the same project.
If none of these are set by the user, then the first find_package(Qt5)
will create versionless targets with the major version being "5",
which means the second find_package(Qt6) will not create versionless
targets.
Handle versionless plugin names in qt_import_plugins, so both
Qt::QCocoaIntegrationPlugin and Qt5/6::QCocoaIntegrationPlugin
are recognized by the function.
Allow specifying multiple types in EXCLUDE_BY_TYPE in
qt_import_plugins, to be consitent with the Qt 6 version.
Make sure to set the QT_PLUGIN_CLASS_NAME property to compatible with
Qt 6.
Task-number: QTBUG-74137
Task-number: QTBUG-80477
Change-Id: Ib89d090ea6f7794d7debd64f03f29da963a17ca7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
I made a clazy automated check that replaced the use of QVariant::Type
by the equivalent in QMetaType.
This has been deprecated since Qt 5.0, but many uses were not yet removed.
In addition, there was some manual changes to fix the compilation errors.
Adapted the Private API of QDateTimeParser and QMimeDataPrivate
and adjust QDateTimeEdit and QSpinBox.
QVariant(QVariant::Invalid) in qstylesheet made no sense.
But note that in QVariant::save, we actually wanted to use the non-user type.
In the SQL module, many changes were actually reverted because the API
still expects QVarient::Type.
Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QDBusReply has an user-specified operator= but no copy constructor.
Change-Id: If7fcec3193af375f1bf2dd913d82548d6e035b48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Conflicts:
src/corelib/tools/qvector.h
Make QVector(DataPointer dd) public to be able to properly merge
5b4b437b30 from 5.15 into dev.
src/widgets/kernel/qapplication.cpp
tests/auto/tools/moc/allmocs_baseline_in.json
Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Change-Id: I929ba7c036d570382d0454c2c75f6f0d96ddbc01
Other code using these maps are not treating them like multi-maps
Change-Id: I3381fde3b3612a29110cfe890f20f96f3c0bd3a2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
By casting it, these are situations where we cannot change the type
itself to QMultiMap. For QVariant it's a public define and for dbus
it's the type of an argument to the function.
Change-Id: I0f385dc857fce5de3e8254d18268fd84a6d7707c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
[ChangeLog][QtCore][QHash] insertMulti(), unite() and
values(const Key &key) are now deprecated. Please use
QMultiHash instead.
Change-Id: Ic14907fd5fd38d585708e2dcf2c0200d221ebb25
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Don't store our string data as QByteArrayLiterals anymore, but revert
back to simply storing them as an array of char* and offsets into that
array.
This is required to be able to inline size and begin into QByteArray
itself. Once that change is done, we can then avoid creating copies of
the string data again.
Change-Id: I362a54581caefdb1b3da4a7ab922d37e2e63dc02
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Move away from using 0 as pointer literal.
Done using clang-tidy. This is not complete as
run-clang-tidy can't handle all of qtbase in one go.
Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
CMake is case-insensitive for macro and function names. Still, it is
"strongly recommended to stay with the case chosen in the function
definition." So let's make the function and macro definition lower-case,
like we also recommend in the documentation.
Change-Id: I1f64b18716f034cb696d2e19a2b380aaadd6cd07
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QtDBus caches well known interface objects when there is a non-emtpy
interface name passed to the QDBusInterface constructor.
This commit amends the constructor documentation to explain this
behavior.
Change-Id: Ic51836be6d833411500ea05fcc895cd4f6e96407
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This was used to support QFlags f = 0 initialization, but with 0 used
as a pointer literal now considered bad form, it had been changed many
places to QFlags f = nullptr, which is meaningless and confusing.
Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is almost 100% source compatible with Qt 5. Exceptions are
* Stability of references for large or non movable types
* taking a PMF for types that are now overloaded with r-value references
in QVector
* The missing prepend optimization in QVector (that is still planned
to come for Qt 6)
Change-Id: I96d44553304dd623def9c70d6fea8fa2fb0373b0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This is currently being used by dbus und our state machine framework,
and supported by hand editing moc generated code.
Get rid of that hack, and instead add support to moc to forward
the raw arguments array to the slot.
Change-Id: I0e36626f91eb01041464e6d931dc1d4660de91d2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
To get less diffs for next merges and pro2cmake changes.
Change-Id: I7fb5ff34bb884072a9964e8e3488c69f4290fca2
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
People implementing D-Bus services *should not* immediately call
QDBusConnection::send() when intending to delay their reply, as this
indeed causes a reply to be sent to the client.
Change-Id: I50817f6b91ac1a02a2a25f6d31e73ad9832f1092
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Brown paper bag for me, don't use a comma to separate parameters when
calling a function.
Change-Id: I21e16142fab4fd1c2714df13cd6a892b036e899a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This fixes the calls to add_qt_docs to include the target.
Change-Id: I2c4c807bca8faa48bb49f4b8710035f21abfca0e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Update all public Qt macros to use qt6/QT6 instead of qt5/QT6.
Change-Id: Ib178f4fa21f37dfb8da7d4d8c097aa0e96c9d9f9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>