summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
Commit message (Collapse)AuthorAgeFilesLines
* uic: Write fully qualified enumerations for cursors/icon pixmapsFriedemann Kleint14 days3-11/+11
| | | | | | | Fixes: PYSIDE-2492 Pick-to: 6.7 Change-Id: Ic2505628b0550654c109cf239b4f2390f03df623 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* moc: Treat number + characters as Identifier, not NumberFabian Kosmale2024-04-171-0/+30
| | | | | | | | | | | | | | | | | 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>
* tst_moc: handle QFile::open failures from non-test functionsGiuseppe D'Angelo2024-04-141-5/+11
| | | | | | | | | | | 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>
* uic: use qOverload for ambiguous slotsAxel Spoerl2024-04-122-0/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 94c16517b3f8f01309a89598e698931ef77d60db, 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>
* uic: Write QIcon theme enumsFriedemann Kleint2024-04-102-13/+49
| | | | | | | | | | | 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>
* Add support for using an inline namespaces for -qtnamespaceFriedemann Kleint2024-04-036-6/+18
| | | | | | | | | | | | | | | 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>
* Long live QT_TECH_PREVIEW_APIGiuseppe D'Angelo2024-02-202-0/+45
| | | | | | | | | | | | | | | | | | 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>
* rcc: Suppress MSVC warning C4711 in generated codehjk2024-02-196-0/+30
| | | | | | | | | | | | | 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>
* Change license for tests filesLucie Gérard2024-02-04190-190/+190
| | | | | | | | | | | | 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>
* moc: store the FQN in JSON superClass objectsMarc Mutz2024-01-263-0/+50
| | | | | | | | | | | 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>
* moc/QMetaProperty: Remove limitation on non-own-class notify signalsFabian Kosmale2024-01-261-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* tst_moc: fix some -Wunused-* warnings on MinGWMarc Mutz2024-01-101-0/+2
| | | | | | | | | | | Found while inspecting a recent MingWG log file from the CI. Amends da284ef10e0ef80776b9fc9b7bb0e6dc8d71ba63. 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>
* tst_moc: DRY QProcess success verificationMarc Mutz2024-01-101-36/+23
| | | | | | | | | | | | | | | | | | | | 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>
* Dissociate QTypeRevision from QVersionNumberMarc Mutz2024-01-101-1/+1
| | | | | | | | | | | | | | | | 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 ed080c64ae21d22115d16780a5903d7cc4fd1546. 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>
* Unblacklist tests/auto/tools/rcc for CMake and Boot2QtJoerg Bornemann2024-01-091-2/+0
| | | | | | | | | 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>
* qdbuscpp2xml: Register QtDBus metatypesIevgenii Meshcheriakov2023-11-283-9/+38
| | | | | | | | | | | | 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>
* Moc: don't stumple over inline namespace in more placesFabian Kosmale2023-11-241-0/+3
| | | | | | | | | | | | | Ignore the 'inline' in case of nested namespace with another nested inline namespace. Amends 5222df2be7d10bf44dfc2971774eadcb526b7a13 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>
* uic: Use fully qualified enum value for remaining casesFriedemann Kleint2023-11-159-20/+20
| | | | | | | | Task-number: PYSIDE-2492 Task-number: PYSIDE-1735 Task-number: QTBUG-118473 Change-Id: I4e5e328b0757145df2ceb550e2f90a64be91d5e9 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* uic: Write fully qualified enum values for QMainWindow enumerationsFriedemann Kleint2023-11-151-2/+2
| | | | | | | | Task-number: PYSIDE-2492 Task-number: PYSIDE-1735 Task-number: QTBUG-118473 Change-Id: Ief50914bae3cc8e55f61113e8c8b6d6d24fe2c0f Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* uic: Prepare for encountering fully qualified enum values in new .ui filesFriedemann Kleint2023-11-1598-268/+268
| | | | | | | | | | | | | | | | 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>
* tst_qmakelib: compile with QT_NO_FOREACHAhmad Samir2023-08-193-12/+5
| | | | | | | | | | | | | | 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>
* tst_qmake: compile with QT_NO_FOREACHAhmad Samir2023-08-192-6/+3
| | | | | | | | | | | | | 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>
* tst_moc: compile with QT_NO_FOREACHAhmad Samir2023-08-192-7/+4
| | | | | | | | | | | | | 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>
* Mark all of Qt as free of Q_FOREACH, except where it isn'tMarc Mutz2023-08-197-0/+15
| | | | | | | | | | | | | | | | | | | | | | 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>
* tst_macdeplyqt: unbreak runVerifyDeployment()Marc Mutz2023-08-151-3/+3
| | | | | | | | | | | | | Amends f2f8820073488c89fb71e3eb2d2e87bb582c3995. 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>
* Fix registration of QtDBus types' metatypesThiago Macieira2023-08-142-2/+77
| | | | | | | | | | | | | | | | | | | | | | | | | By actually registering them. Commit 850d850c5af8ff77a4b9d53457ec6b1ba6c20cb3 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>
* tests/tools: only run qdbus{cpp2xml,xml2cpp} tests if D-Bus is availableThiago Macieira2023-08-141-1/+1
| | | | | | | | | | | 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>
* tests: port assorted trivial uses of Q_FOREACH to ranged for loopsMarc Mutz2023-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
* tst_rcc: port away from Q_FOREACHMarc Mutz2023-08-081-5/+5
| | | | | | | | | | | | | | | | 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>
* tst_macdeployqt: fix runVerifyDeployment()Marc Mutz2023-08-081-1/+1
| | | | | | | | | | | | | | | | 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 3f56950862181f4d50f30d66f577c933795522c3, 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>
* tst_qdbuscpp2xml: Remove unused variablesIevgenii Meshcheriakov2023-08-031-3/+0
| | | | | Change-Id: I131d7336e36d34f60fca0f37f76cd77ef674f405 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qdbuscpp2xml: Support MEMBER field of Q_PROPERTYIevgenii Meshcheriakov2023-08-031-0/+4
| | | | | | | | | | | | | Emit properties with MEMBER field specified with 'readwrite' access. Previously only READ and WRITE filed where used for deriving the access value. Add a property using MEMBER to the test class used by tst_qdbuscpp2xml. Fixes: QTBUG-115631 Change-Id: I12351985a9fafd934ccc5e0b805077a9e44b6608 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QObject: replace _q_reregisterTimers with a lambdaAhmad Samir2023-07-311-14/+16
| | | | | | | | | | | | | | | - Pass the QList by value, no heap allocation and no plain new/delete - A lambda means that there isn't runtime string-based lookup to find the member method in QObjectPrivate The code is only a couple of lines and used in a single place, so might as well move the code from _q_reregisterTimers to the local lambda. Modify tst_moc to account for the numer of methods in QObjectPrivate changing. The test had hardcoded numbers. Change-Id: I07906fc7138b8e601e4695f8d2de1b5fdd88449c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* moc: handle "L" integer suffixFabian Kosmale2023-07-281-0/+5
| | | | | | | | | | | | | | | | This commit adds some initial support for handling the 'L' suffix after numbers. This one is especially important given that the __cplusplus define is using it. Other suffixes will be handled in some later commit, which should also unify the already divergent parse behavior between DIGIT and PP_DIGIT parsing (e.g. when it comes to byte prefixes). Task-number: QTBUG-83160 Task-number: QTBUG-115558 Pick-to: 6.6 6.5 6.2 Change-Id: Ie61eae49c468abfaee80e7e4f7097917a254dc0e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qdbusxml2cpp: Improve error reportingIevgenii Meshcheriakov2023-07-061-8/+15
| | | | | | | | | | | | | 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>
* CMake: Make qtbase tests standalone projectsAlexandru Croitor2023-07-0510-0/+59
| | | | | | | | | | | | | | | | | 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>
* Moc: fix generated code for nested enum class corner caseAhmad Samir2023-06-181-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes an issue with generated code where the name of an enclosing namespace is identical to an enum class type, when Q_ENUM_NS is used. Consider: namespace a { Q_NAMESPACE namespace b { enum class b { Key, Key2 }; Q_ENUM_NS(b); } } moc generated code such as: Q_CONSTINIT const QMetaObject a::b::staticMetaObject = { { ... qt_incomplete_metaTypeArray<qt_meta_stringdata_CLASSaSCOPEbENDCLASS_t, // enum 'TestEnum' QtPrivate::TypeAndForceComplete<b::b, std::true_type>, // Q_OBJECT / Q_GADGET QtPrivate::TypeAndForceComplete<void, std::true_type> >, nullptr } }; which confused the compiler: error: ‘b’ is not a member of ‘a::b::b 83 | QtPrivate::TypeAndForceComplete<b::b, std::true_type>, Fixes: QTBUG-112996 Pick-to: 6.6 Change-Id: I37aee83c32efe96cc9d6c2bd0bdb9ba80bb7b8a7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* moc: Handle attributes after meta-method tagFabian Kosmale2023-06-161-0/+28
| | | | | | | | | | | | | | We so far only handled them if they came at the very start of the method declaration. This patch ensures that we also handle them after the meta-method tag (but before the actual type). Unifying parseFunction and parseMaybeFunction to avoid the need to munally keep them in sync is left for another day. Fixes: QTBUG-111330 Pick-to: 6.6 6.5 6.5.2 6.2 Change-Id: Ic94edb69f04b9150aea2c8e6d004a8b9e5cf12ec Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Moc: streamline how diagnostic messages are printedAhmad Samir2023-06-051-2/+2
| | | | | | | | | | | | | | | | | | | If we don't have a valid Symbol to get a line number from, or if the symbol.lineNum is -1, print a shorter message containing only the file path. Printing: '/path/to/file:-1:1' isn't useful (and looks wrong). Change error/defaultErrorMsg/warning/note() to delegate to one central method, so that they all behave the same; e.g. previously warning() and note(), guarded against printing "-1" for the line number, whereas error() didn't. This also makes it possible to use error() for reporting other issues (e.g. the size of generator.strings list exceeding INT_MAX, which will happen in a later commit). Pick-to: 6.6 Change-Id: Iddc96e08315fae415be6a84928f845d7bceb4c5f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Replace AUTO_RESOURCE_PREFIX with RESOURCE_PREFIX in qt-cmake-projectAmir Masoud Abdol2023-05-301-1/+1
| | | | | | | Pick-to: 6.5 Change-Id: I53b9e8887e8e79c1c1e836c514171aece8cf35aa Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Moc: silence a GCC warningAhmad Samir2023-05-181-0/+1
| | | | | | | It's already silenced for Clang, extend it to cover GCC too. Change-Id: I212ca78d7a203d69d490c46e7ef4b78a60cabd80 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* MOC: pass the erroneous Symbol as an arg to Parser::error() overloadAhmad Samir2023-05-151-0/+9
| | | | | | | | | | | | | | | | | | | | We already know the Symbol while parsing, passing a reference to it to error() makes it simpler to construct the error message. This fixes an issue where reporting an error about "NONSENSE" in e.g.: Q_PROPERTY(Foo* foo NONSENSE foo) would be off-by-one and the error message would say: path/to/file.h:11:1: error: Parse error at "foo" instead of 'at "NONSENSE"', which is where the parser actually found an unexpected attribute. Fixes: QTBUG-36367 Pick-to: 6.5 Change-Id: Ief70e544af41f7575fbeea9b936fa8197c3ef43d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* test: Don't remove macdeployqt test directory when debugging testTor Arne Vestbø2023-05-051-3/+1
| | | | | | Pick-to: 6.5 Change-Id: If0e6f836638d8ddb6b0d6c2be6ae4dd09b76eb7a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* test: Pass -use-debug-libs for macdeploy test when built as debugTor Arne Vestbø2023-05-051-0/+3
| | | | | | | | | As this is a strong indication that Qt was also built in debug. Otherwise the test will fail locally for a debug build. Pick-to: 6.5 Change-Id: I5f494017f1d89f4076ccaca89aaa67738ef405a9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add debug logging to macdeployqt testTor Arne Vestbø2023-05-051-21/+23
| | | | | | | | | Preparation for debugging failures in the 6.2 branch Pick-to: 6.5 6.2 Task-number: QTBUG-112892 Change-Id: Ib6428fb86be834c84be361a848c0f1306bfc2637 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Fix another warning when comparing size_t and qsizetypeVolker Hilsheimer2023-04-181-1/+1
| | | | | | | Amends 07f7ed2badf0cc1972bf6ba15f4c0cde4a773f19. Change-Id: I0644e47e8e9ccd0bcaf074adf99e7481c692b5c1 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix warning when comparing size_t with qsizetypeVolker Hilsheimer2023-04-031-1/+1
| | | | | Change-Id: Id8e7ae20aea99f2acb03b665484615bf7f932873 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* moc: Record types of enumerationsUlf Hermann2023-03-313-29/+161
| | | | | | | | | | | This will be helpful in a number of places, in particular in order to support enums of different sizes in QML. We record the type as string in the JSON output and as QMetaTypeInterface in the generated C++. Task-number: QTBUG-112180 Change-Id: I943fac67f8b25b013d3860301416cdd293c0c69e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* moc: Allow anonymous propertiesUlf Hermann2023-03-161-0/+51
| | | | | | | | | | | | This is private for now. It's very handy to have anonymous properties for the QML model/delegate adaptors. There are models with only "singular" model data that doesn't have any sub-properties. Such model data should be available from the model object via an empty string as role. This way we can get rid of a lot of special casing. Task-number: QTBUG-104752 Change-Id: I229e355a7cab064ee1c9f89557bc0244a5d0c90a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Silence warning about deliberately using deprecated APIVolker Hilsheimer2023-03-061-0/+2
| | | | | | | | We test moc's support for [[deprecated]], so don't warn about it. Pick-to: 6.5 Change-Id: Ifda2b81c14cb9802db4bb1d0a1eb17d978ad492a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>