Commit Graph

669 Commits (152153cb111db1bbd42e94f27712bbc39accf310)

Author SHA1 Message Date
Thiago Macieira c1b13a0c5f moc: add a test for Q_FLAG getter/setter on integers
This is legacy behavior from Qt 3, before we had QFlags and before
QVariant could support user types. I cannot find any instance of a
getter returning an integer in current Qt or Qt Creator code. And note
this only compiles if the flags type with Q_FLAG - not Q_ENUM.

The content is wrapped as Qt 6.x only so it can be removed in Qt
7.0. The deprecation warning will come in a later commit, for 6.9.

Change-Id: Ie3ddd8025e3b4387866efffd8e8d46c3daa0dff2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 939f7f56227e65c9797d17640a7b9c29166efc44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-09-24 20:30:14 +00:00
Jani Heikkinen cbdc0d3d5d Bump version to 6.8.1
Change-Id: Ic8432157af13404391a5314ac2f44ac09abcfca5
Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
2024-09-19 07:20:47 +03:00
Ulf Hermann 833c0040cb moc: Print method index to JSON output
We want to be able to index into the metaobject from code generated by
qmltyperegistrar. And we don't want to rely on some implicit promise
that certain methods are in the "right" order in the output. This is
similar to what we've done with properties.

Change-Id: I8d97b65598338fcff57c6b0866708232066c94cb
Task-number: QTBUG-127442
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 484e72a1074279dca1253ae07515461ad231de3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-20 08:51:01 +00:00
Thiago Macieira 68c9ea8888 tst_moc: check the enum's own metatype, not its underlying metatype
Checking the underlying type's metatype is checking through a QMetaType
feature, not moc's functionality. And QMetaType currently always returns
the metatype for int for all QFlags types.

Change-Id: I8a96935cf6c742259c9dfffd17e9791608e38b6e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 46b73b1ef37e22af23bfce992f41498c6409df3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-12 09:43:38 +00:00
Thiago Macieira 46ef4c8b86 tst_moc: fix the order of arguments in QCOMPARE in checkEnum
QCOMPARE is (actual, expected).

Take the opportunity to test out-of-range returns from QMetaEnum too.

Change-Id: I8a96935cf6c742259c9dfffd17e9575a6d4cf90a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e3e44e2294c06f243838dfa28ec4f350c5e6ffbb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-12 09:43:38 +00:00
Friedemann Kleint dd825ccfff tst_uic: Modernize code
Use modern string literals, initializer lists and fix some clang-tidy
warnings.

Change-Id: I77ea935121995e41211f5342552c0dd37191e35e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 5790d167448eea094439c7520e2fc68aed480e39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-09 15:16:50 +00:00
Fabian Kosmale ac3af71d04 moc: add line number for class definition to JSON output
Amend moc's JSON output with line information for the classes we find.

Task-number: QTBUG-119143
Change-Id: I821f0c30a56ed992cb9c6173f1e28ace1f26e9cf
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
(cherry picked from commit 1d4533bd5fac54cb5555f03ff08e9085fa533c16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-03 07:04:04 +00:00
Tor Arne Vestbø de7a39866c tst_macdeployqt: Only pass -use-debug-libs for debug-and-release builds
When passing -use-debug-libs to macdeployqt it will only consider plugins
that end with _debug.dylib, which is not the case for single-configuration
framework builds as of d3be87ff1d558f05309b1f29f7e71f291498584f.

When not passing -use-debug-libs macdeployqt will use whatever library
it finds, both suffixed and not, so the only case where we need to
explicitly make it choose one is when we have a debug-and-release
build of Qt. Otherwise we can leave macdeployqt to choose the right
one.

Change-Id: Ic438da9f21c3090f0d57ce615bc0c0969b9a600d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 60550f8acc4f9d742f6ef7cb027f0ed3e2d5e42a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-19 13:42:22 +00:00
Tor Arne Vestbø 079b8b16d2 tst_qmakelib: Account for test directory with spaces in system() test
Change-Id: Icb695fe40de9d72524c191c0d593c8f2ab746790
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit da3997af0d87aa8ebe25a195c08130f69c6b19e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-07-03 18:57:34 +00:00
Marc Mutz f3007e8624 tst_moc: fix 'inline function used but never defined' GCC warning
GCC doesn't have a specific warning flag for this warning, so we can't
add a GCC case to the existing Clang suppression in the header.

Hovever, the issue can be fixed by including the moc file into
tst_moc.cpp, so that the compiler sees the definition of the inline
signal provided by the said moc file. This means we can also drop the
Clang warning suppressions.

To prevent duplicate definition linker errors, remove the header file
from JSON_FILES, and the forced separate compilation that entails.

I'm pretty sure that some cmake magic could preserve the JSON test
coverage, but a) the file doesn't emit anything special in its json
(certainly nothing about the inline'ness of the signals) and b) the
presence of mySlot() and mySignal() as slot and signal on these
classes is already tested by singleFunctionKeywordSignalAndSlot().

Amends the start of the public history, but not picking back far,
because a) a prequel commit to this commit wasn't picked further,
either, and b) this has been such a long-standing issue that it's
clear no-one cares and so it's just not worth the risk, however small
that may be, to backport.

On GCC, the only remaining warnings thrown by tst_moc are now
moc-generated ones.

Task-number: QTBUG-119042
Change-Id: Icde1eee6c97bd48d72e15461b6ec80c50c044eaa
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b1b3af02c0fb8084d2eb984b1f7ae68f1861f9a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-18 08:09:09 +00:00
Tor Arne Vestbø f399eff35e tst_qt_cmake_create: Skip test if CMake is not found
Change-Id: Ifd84135c756d5140bea1952e069f82854afe1ecd
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4cb492e14a31b6497b81bfbbcbec09f94595698a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-18 01:34:51 +00:00
Marc Mutz 9d89e28f1c tst_moc: fix -Wvolatile
Suppress the warning. Found that moc doesn't like QT_WARNING macros in
Q_SIGNALS section and filed QTBUG-126395 to track the issue.

Amends the start of the public history, but not picking back far,
since older GCC could reject the suppression, and it's such a
long-standing issue that fixing it in LTS branches is not worth the
risk of breaking compilation.

Task-number: QTBUG-119042
Task-number: QTBUG-126395
Change-Id: I15ba9ed3b83cce0f4c2a1536317e5167d56f3a57
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4111059b2ee3818ab68033198fb1dd057e6d09eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-17 23:17:49 +00:00
Tor Arne Vestbø eb397a2ce9 Skip some build system tests if Xcode is not installed
We rely on a valid Xcode (command line tools) installation to run qmake.

Change-Id: I8d6746942507680dd585a41f32cbe4e4d34822e4
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 06b33134b38ffabdf0c0d80c2c3b9581294ff715)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-16 20:48:34 +00:00
Friedemann Kleint 690c2f2d60 uic: Prevent code injection via invalid property names/values
Fixes: QTBUG-126265
Pick-to: 6.7 6.5 6.2 5.15
Change-Id: Id0d6706b8565b76fcc7b9e73944dc6d3e8232e49
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 53c8d1fe7c59f3462b85193b688d02ff353b51d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-13 20:34:59 +00:00
Joerg Bornemann 3e320e45bf CMake: Build dbus tools when building dbus tests
This adds the build dependencies
tst_qdbuscpp2xml -> qdbuscpp2xml
tst_qdbusxml2cpp -> qdbusxml2cpp

Fixes: QTBUG-126115
Change-Id: I8a52568023743924fac67ce88ea446189b0328c0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0f71a00357234b3cbd30b3d010ae8b10c5a25fec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-12 12:23:45 +00:00
Thiago Macieira 70dd53e3d3 uic: recognize <legal> tag as an alias for <comment>
That is printed at the top of the file and we've used it for the
copyright inside Qt, so just declare an alias.

[ChangeLog][uic] The Qt UI Compiler now accepts a <legal> XML tag to
indicate the copyright of the UI file and other legal terms of use. The
text of this tag will be emitted in the generated code. This tag is an
alias to <comment>.

Change-Id: If3345151ddf84c43a4f1fffd17d15ab77412e289
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-06-01 08:36:42 -03:00
Thiago Macieira d5dd7da3ee rcc: add the ability to output copyrights in the output
According to gnu.org[1]
> When a file is automatically generated from some other file in the
> distribution, it is useful for the automatic procedure to copy the
> copyright notice and permission notice of the file it is generated
> from, if possible.

This commit allows us to add copyright notices to the .qrc files
themselves and additionally have that be output into the generated .rcc
(of which we have a few committed to the repository)

[ChangeLog][rcc] The Qt Resource Compiler now accepts a <legal> XML tag
inside the main <RCC> entry, which can be used to document the copyright
of the resource file itself and other terms of use (even though the file
is probably created by a tool like Qt Creator's resource editor). The
text of this copyright will be emitted in the generated C++ or Python
source code.

[1] https://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html

Change-Id: If05cb740b64f42eba21efffd17d00417433f1ee9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-06-01 08:36:41 -03:00
Lucie Gérard 1e0bc86dc0 Add copyright and licensing to .cpp and .h files missing them
Task-number: QTBUG-124453
Change-Id: I4487791114ce8ee6d2e788cc9a5f2ea5ec162f6b
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-28 09:47:01 +02:00
Lucie Gérard 00a04dddaf Add REUSE ignore comment
For those files, reuse fails to process the copyright and licensing information. The information is written to .reuse/dep5 file and reuse is told to ignore what is in the file.

Task-number: QTBUG-124453
Change-Id: If593c713026d9d349055cb6e8e73500966a05d9b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-08 11:09:28 +00:00
Friedemann Kleint b0325c7992 uic: Write fully qualified enumerations for cursors/icon pixmaps
Fixes: PYSIDE-2492
Pick-to: 6.7
Change-Id: Ic2505628b0550654c109cf239b4f2390f03df623
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
2024-04-23 12:33:54 +02:00
Fabian Kosmale 62d02c1d50 moc: Treat number + characters as Identifier, not Number
While <DIGIT>+<Character> is not a valid identifier by itself in the C++
language, it might become one when using it with the token pasting
operator.

This risks confusing some number literals with suffix as Identifiers,
but those are currently not supported anyway, so this shouldn't break
anything that is currently working.

Fixes: QTBUG-87219
Fixes: QTBUG-124288
Pick-to: 6.7
Change-Id: If73255cc0e6649bc90c52b1d177aac8ff975ae69
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-04-17 04:38:22 +02:00
Giuseppe D'Angelo 9fd895e3c1 tst_moc: handle QFile::open failures from non-test functions
Code that sets a test function up should not be fallible, or should be
designed to log the failure. In tst_moc this is not the case --
QFile::open is called from within a nested lambda. If that fails, print
the error and return an empty optional.

Task-number: QTBUG-123623
Change-Id: I8372a6ac7dc22e68d145fa2215fe04ba682ac81b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-14 08:07:48 +02:00
Axel Spoerl 2ec2c54e05 uic: use qOverload for ambiguous slots
qOverload was used only for ambiguous signals and slots with no
arguments. Connections to ambiguous slots made in widget designer's
signal/slot editor, lead to an unresolved ambiguity when compiling
the generated code in ui_xxx.h. One example is QLabel::setNum(), which
can either take a double or an int.

Always using qOverload is not an alternative, because signatures are
normalised. E.g. const QString & / QString can't be distinguished.

Add a map with all ambiguous signals and slots to customwidgetsinfo.cpp.
Hardcode the map, because uic lives in QtCore and can't access meta
objects of gui/widget classes.

Use this map in isAmbiguousSignal() and add isAmbiguousSlot().

Change OverloadUse enum into an enum class in language.cpp. Change
enum values to reflect the new condition for slots to use qOverload.

Rename existing enum values and remove default argument in
language::formatMemberFnPtr() to improve code readability.
Apply const T& syntax for all types starting with Q, except QSize and
QPoint.

Revert 94c16517b3, which was a hack
forcing for QLCDNumber::display() to a string based connection.

Add a new baseline to tst_uic, to test the above.

Fixes: QTBUG-93413
Task-number: QTBUG-124241
Pick-to: 6.7 6.6 6.5 6.2
Change-Id: I49ccc1688cfc08970cce3e56adf18e5ac49a77e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2024-04-12 12:32:16 +00:00
Friedemann Kleint b79cb3dd65 uic: Write QIcon theme enums
Split out some helpers to write the theme code with path fallback
checking for the enum case (identified by a fully qualified icon) or
the old XDG/filename case.

Task-number: QTBUG-121823
Pick-to: 6.7
Change-Id: If2755483ab899f04e372cf95443f7e03970f6e7f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-04-10 21:01:07 +02:00
Friedemann Kleint fdac1e2205 Add support for using an inline namespaces for -qtnamespace
Inline namespaces serve the purpose for which the original
-qtnamespace option was added and allow for macro simplification (no
need for any using directives). This makes it possible to use
namespaced builds of Qt also for Qt for Python and similar use cases
which have issues with the additional namespace.

[ChangeLog][QtCore] It is now possible to use an inline namespace for
-qtnamespace (option -qtinlinenamespace).

Task-number: PYSIDE-2590
Change-Id: Ia0cecf041321933a2e02d1fd8ae0e9cda699cd1e
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-04-03 17:17:11 +02:00
Giuseppe D'Angelo 32a1151245 Long live QT_TECH_PREVIEW_API
A macro to mark tech preview APIs, in order to make header reviews
easier:

* newly introduced TP APIs are clearly marked as such;
* an API that leaves TP and becomes stable requires to change the
  header, and not just the documentation (and therefore will again
  appear in the header review).

The idea is to use this macro as if it were a C++ attribute.
It can't actually be an attribute, because we want to use it to tag
e.g. macro expansions (like Q_PROPERTY).

Change-Id: I05c5a91a4fa5bedfbd1c6146d4dc00e1d1d28628
Pick-to: 6.7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-02-20 05:01:09 +01:00
hjk 108085ebf9 rcc: Suppress MSVC warning C4711 in generated code
The informational message

    Warning C471 1function 'int __cdecl qInitResources_qrc(void)'
        selected for automatic inline expansion

is triggered by /W4.

Fixes: QTBUG-122176
Change-Id: Ifbd2e969b1bb7d25e1b83a4c5d8b305e7b6883a2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-02-19 19:56:25 +01:00
Lucie Gérard ff1039c217 Change license for tests files
According to QUIP-18 [1], all tests file should be
LicenseRef-Qt-Commercial OR GPL-3.0-only

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2024-02-04 09:56:42 +01:00
Marc Mutz 672a824639 moc: store the FQN in JSON superClass objects
Tooling can then use this information to find the correct base class,
even absent C++ scoping information.

Pick-to: 6.7 6.6 6.5
Task-number: QTBUG-101141
Change-Id: I5350da8d2d9aaf5ec86027357131ebac1eb50372
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-01-26 23:50:57 +01:00
Fabian Kosmale ac001bef79 moc/QMetaProperty: Remove limitation on non-own-class notify signals
The moc generated code does a sanity check that NOTIFY signals actually
exist in the parent class when they cannot be found in the class moc
currently runs on.
The logic there was however too simplistic, and couldn't deal with
signals taking a parameter.
Fix this, and take the opportunity to use a proper static_assert instead
of generating a "normal" compile error.

We do not do any checks for the presence of QPrivateSignal, as the whole
point of QPrivateSignal is that it should be private (and not e.g.
protected).

Moreover, we adjust QMetaProperty::notifySignalIndex to take
single-argument notify methods into consideration as well when
encontering an unresolved notify index.

Fixes: QTBUG-115989
Pick-to: 6.7
Change-Id: I8a056a15777f3132691e207b4b9ab6c2c9b2126d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-01-26 14:51:35 +01:00
Marc Mutz 56ca259552 tst_moc: fix some -Wunused-* warnings on MinGW
Found while inspecting a recent MingWG log file from the CI.

Amends da284ef10e.

Pick-to: 6.7 6.6 6.5 6.2
Change-Id: Ife10118710079e60c581314fa857be42452fe810
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-10 09:45:48 +01:00
Marc Mutz 93af86bad5 tst_moc: DRY QProcess success verification
While the code that checked that exitCode() == 0 was still consistent
between all the callers, when it comes to checking stderr, there were
several competing implementations, incl. checking the exitCode and
dumping stderr to qDebug(), and using QCOMPARE to QByteArray(),
presumably in order to get more detailed output on error. Alas,
QCOMPARE's toString() truncates output pretty early, making it
impossible to see what's going on on failure.

So write a small macro that checks the exitCode _after_ it checked
that stderr was empty (printing it in full if it was not), so we
consistently get the error message instead of a truncated version, or
just "exitCode() != 0" without further details.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: Ic8547fda3b02c645901962887c6ed7aad01f6ea4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-01-10 08:45:48 +00:00
Marc Mutz 37e2aa7698 Dissociate QTypeRevision from QVersionNumber
They have nothing to do with each other, so give QTypeRevision its own
header and implementation file instead of piggy-backing on
QVersionNumber's.

Picking back to current LTS to incur the merge conflict only once, not
per (expected) follow-up change.

Amends ed080c64ae.

Pick-to: 6.7 6.6 6.5
Change-Id: I2fa5d0e68f95864126bc95e3d8154134eee85553
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-01-10 02:25:24 +00:00
Joerg Bornemann e329eff2eb Unblacklist tests/auto/tools/rcc for CMake and Boot2Qt
We don't execute this test at all for Boot2Qt anymore.

Task-number: QTBUG-90545
Change-Id: I2f42a7612f5cd61a72a588b95ca043ac03d03697
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-01-09 18:54:47 +01:00
Ievgenii Meshcheriakov 86cfafcb5a qdbuscpp2xml: Register QtDBus metatypes
Explicitly register QtDBus-specific metatypes before attempting
to generate output. This fixes a bug when types like QDBusObjectPath
are sometimes ignored by this tool. Export QDBusMetaTypeId::init()
for that reason. Add a regression test to tst_qdbuscpp2xml.

Fixes: QTBUG-34550
Change-Id: I16faa79a794d09a26bad45e18730379681a20b50
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-28 13:37:56 +01:00
Fabian Kosmale d39353085e Moc: don't stumple over inline namespace in more places
Ignore the 'inline' in case of nested namespace with another
nested inline namespace.

Amends 5222df2be7

Fixes: QTBUG-117765
Pick-to: 6.6 6.5
Change-Id: I87f2649606f63c818f225f8cc5ec914920763c5f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-11-24 08:48:01 +01:00
Friedemann Kleint cea33d7387 uic: Use fully qualified enum value for remaining cases
Task-number: PYSIDE-2492
Task-number: PYSIDE-1735
Task-number: QTBUG-118473
Change-Id: I4e5e328b0757145df2ceb550e2f90a64be91d5e9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-11-15 23:40:24 +01:00
Friedemann Kleint effe9bd026 uic: Write fully qualified enum values for QMainWindow enumerations
Task-number: PYSIDE-2492
Task-number: PYSIDE-1735
Task-number: QTBUG-118473
Change-Id: Ief50914bae3cc8e55f61113e8c8b6d6d24fe2c0f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-11-15 23:40:24 +01:00
Friedemann Kleint 2e82796022 uic: Prepare for encountering fully qualified enum values in new .ui files
This means checks have to be rewritten using endsWith().

It mainly affects the QSizePolicy handling whose values originate from
different sources, including numbers. To address this, refactor the
code to deal with unqualified enum value names and introduce a helper
function that fully qualifies the enumeration when writing out.

Pick-to: 6.6 6.5
Task-number: PYSIDE-2492
Task-number: PYSIDE-1735
Task-number: QTBUG-118473
Change-Id: Iccbb884777aa9c696fbf48f9d7329353ef945b0f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-11-15 23:40:24 +01:00
Ahmad Samir 6864576577 tst_qmakelib: compile with QT_NO_FOREACH
proEval(), proParser(): the loop was iterating over a temporary so it
couldn't have changed it. Hold the container in a const auto variable
and use ranged-for.

formatValue(): iterating over a const QList& parameter, and the container
isn't changed at the call sites during iterating, so Q_FOREACH wasn't
needed to beging with. Use ranged-for instead.

Task-number: QTBUG-115839
Change-Id: Idabe0bbd84b5bcc86cef275f80497651353a4d9e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-08-19 19:17:17 +03:00
Ahmad Samir 7101dcab7a tst_qmake: compile with QT_NO_FOREACH
systemEnvironment(): the loop was iterating over a temporary; hold the
temporary in a local const auto variable and use ranged-for.

runCommand(): the container is a const&, the loop doesn't change the
container and the containers the method is called on aren't changed
during iteration.

Task-number: QTBUG-115839
Change-Id: I6687e5ff64ff8c2fa26e34abf4044b98718e65d4
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-08-19 19:17:17 +03:00
Ahmad Samir 192e1ed649 tst_moc: compile with QT_NO_FOREACH
specifyMetaTagsFromCmdline(): the loop was iterating over a temporary so
it couldn't have modified it; hold it with a const auto variable and use
ranged-for.

relatedMetaObjectsNameConflict_data(): make the container const and port
to ranged-for.

Task-number: QTBUG-115839
Change-Id: I6a5afdf0e5a3dd47818da0025fbbeacd05335b39
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-19 19:17:17 +03:00
Marc Mutz 11d6932560 Mark all of Qt as free of Q_FOREACH, except where it isn't
The density of Q_FOREACH uses in this and some other modules is still
extremely high, too high for anyone to tackle in a short amount of
time. Even if they're not concentrated in just a few TUs, we need to
make progress on a global QT_NO_FOREACH default, so grab the nettle
and stick to our strategy:

Mark the whole of Qt with QT_NO_FOREACH, to prevent new uses from
creeping in, and whitelist the affected TUs by #undef'ing
QT_NO_FOREACH locally, at the top of each file. For TUs that are part
of a larger executable, this requires these files to be compiled
separately, so add them to NO_PCH_SOURCES (which implies
NO_UNITY_BUILD_SOURCES, too).

In tst_qglobal.cpp and tst_qcollections.cpp change the comment on the
#undef QT_NO_FOREACH to indicate that these actually test the macro.

Task-number: QTBUG-115839
Change-Id: Iecc444eb7d43d7e4d037f6e155abe0e14a00a5d6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-08-19 05:19:42 +00:00
Marc Mutz c0a3806609 tst_macdeplyqt: unbreak runVerifyDeployment()
Amends f2f8820073.

I have no idea how this went through the CI, but assigning to a const
variable cannot possibly compile.

Reported-by: Axel Spoerl <axel.spoerl@qt.io>
Pick-to: 6.6 6.5
Task-nubmber: QTBUG-115839
Change-Id: I0f22dcd5ab691f92880ea3c6446aedca53df0721
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-15 17:40:22 +00:00
Thiago Macieira 56bd5d60c9 Fix registration of QtDBus types' metatypes
By actually registering them.

Commit 850d850c5a changed from
qMetaTypeId<QDBusArgument>() to QMetaType::fromType<QDBusArgument>() and
in Qt 6, fromType() does not register the type with the database. That
means the lines became runtime no-ops at that time or during the
QMetaType updates since 6.0. All they did was instantiate the C++ inline
variable.

The testing also detected we didn't register QList<QDBusVariant> as an
alias for the "av" signature. I'm not entirely sure you're allowed to
use this because QtDBus does not like re-registration of the built-in
types, and "av" is already assigned to QVariantList. This is no trouble
for the parser, anyway.

Minor change to qdbuscpp2xml to allow reading from stdin, so we don't
have to create temporary files.

Pick-to: 6.5 6.6
Fixes: QTBUG-115964
Change-Id: I80612a7d275c41f1baf0fffd177a14925e7d23ac
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-14 20:19:36 -07:00
Thiago Macieira 7a1ffacca0 tests/tools: only run qdbus{cpp2xml,xml2cpp} tests if D-Bus is available
Strictly speaking, we don't need the *bus*, only libdbus-1, but some
machines in our CI appear to be misconfigured somehow. I don't
understand how they can both have and not have this library in the same
run.

Pick-to: 6.5 6.6
Change-Id: I80612a7d275c41f1baf0fffd177a66a04951948c
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-14 20:19:36 -07:00
Marc Mutz f2f8820073 tests: port assorted trivial uses of Q_FOREACH to ranged for loops
All of these fall into the trivial category: loops over (readily made)
const local containers. As such, they cannot possibly depend on the
safety copy that Q_FOREACH performs, so are safe to port as-is to
ranged for loops.

There may be more where these came from, but these were the ones that
stood out as immediately obvious when scanning the 100s of uses in
qtbase, so I preferred to directly fix them over white-listing their
files with QT_NO_FOREACH (which still may be necessary for some files,
as this patch may not port all uses in that file).

Pick-to: 6.6 6.5
Task-nubmber: QTBUG-115839
Change-Id: I7b7893bec8254f902660dac24167113aca855029
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-14 23:11:54 +03:00
Marc Mutz 961717d372 tst_rcc: port away from Q_FOREACH
Most of these are of trivial kind (loops over const locals).

The one that isn't, in cleanupTestCase(), is, however, also simple:
it's a loop over a local, too, but it would be too much churn to
change the initialization to make the container const, and the loop
body clearly doesn't modify the container, so just go with the
std::as_const() pattern here.

Task-number: QTBUG-115839
Pick-to: 6.6 6.5
Change-Id: I188a78ea67a63be2d50a81fea431e5ea9f2783cb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-08 22:03:05 +02:00
Marc Mutz 52ef958429 tst_macdeployqt: fix runVerifyDeployment()
QList rather pointlessly has a startsWith() function, which means this
code compiled. But the code makes no sense: it tests the same
condition over and over again, so I'm assuming that it should be
path.startsWith() and not path_s_.startsWith().

Amends 3f56950862, but that just
imported the code from qttools. I didn't check whether the bug was
present there, already.

Pick-to: 6.6 6.5
Change-Id: I98a4bbfe0400700655a5c2137f7a976a835a8d28
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-08 15:49:26 +02:00
Ievgenii Meshcheriakov 06397cc45f tst_qdbuscpp2xml: Remove unused variables
Change-Id: I131d7336e36d34f60fca0f37f76cd77ef674f405
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 16:09:17 +02:00