diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-06-18 13:19:46 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-08-04 12:50:12 -0700 |
commit | c23b595769ba93e9cd7084cf9240d093bfd8a40e (patch) | |
tree | 2e263622e085fd62560f121e2b9fe9dfae675c1e /src/tools | |
parent | a8ebadac593572601adff912ca12047c5a980371 (diff) |
moc: move some of the helpers into a header dedicated to it
Change-Id: Id0fb9ab0089845ee8843fffd16f9d080029f2f7f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/moc/moc.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 5e2ba18a00..979c986a41 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1091,6 +1091,16 @@ void Moc::generate(FILE *out, FILE *jsonOutput) for (const QByteArray &qtContainer : qtContainers) fprintf(out, "#include <QtCore/%s>\n", qtContainer.constData()); + fprintf(out, "\n%s#include <QtCore/qtmochelpers.h>\n%s\n", +#if QT_VERSION <= QT_VERSION_CHECK(6, 9, 0) + "#if __has_include(<QtCore/qtmochelpers.h>)\n", + "#else\n" + "QT_BEGIN_MOC_NAMESPACE\n" + "#endif\n" +#else + "", "" +#endif + ); fprintf(out, "#if !defined(Q_MOC_OUTPUT_REVISION)\n" "#error \"The header file '%s' doesn't include <QObject>.\"\n", fn.constData()); @@ -1107,7 +1117,6 @@ void Moc::generate(FILE *out, FILE *jsonOutput) "#endif\n\n"); #endif - fprintf(out, "QT_BEGIN_MOC_NAMESPACE\n"); fprintf(out, "QT_WARNING_PUSH\n"); fprintf(out, "QT_WARNING_DISABLE_DEPRECATED\n"); fprintf(out, "QT_WARNING_DISABLE_GCC(\"-Wuseless-cast\")\n"); @@ -1120,7 +1129,6 @@ void Moc::generate(FILE *out, FILE *jsonOutput) fputs("", out); fprintf(out, "QT_WARNING_POP\n"); - fprintf(out, "QT_END_MOC_NAMESPACE\n"); if (jsonOutput) { QJsonObject mocData; |