aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2022-01-31 17:19:23 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-02 11:10:48 +0000
commit76c4767716e3f3225ac433fe41c23891f51bebcf (patch)
tree8cfaade4acf169f302fcb384c0162a3ec1d0310c
parentb69234a7fffa7bbce357b1be92fdbacd8090e92c (diff)
Avoid including self in the generated qmltc code
Somehow this works (?) but is meaningless. In the (special) case of QT_QMLTC_FILE_BASENAME it even works by accident due to the test binary having a suitable include: for the NameConflict.qml, which is renamed to ResolvedNameConflict{.h,.cpp} we still have hand-written nameconflict.h Let's ignore this mess for now (it needs to just be deleted eventually) and just provide minimal changes for the stuff to (continue to) work Change-Id: Ic18f17463d0c60d9b02e3d3824d99605a161ae14 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 9a30895128728f9f1720ab7cb53e90e5e823a568) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tools/qmltc/prototype/qml2cppdefaultpasses.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/qmltc/prototype/qml2cppdefaultpasses.cpp b/tools/qmltc/prototype/qml2cppdefaultpasses.cpp
index 870f94359a..586cc85754 100644
--- a/tools/qmltc/prototype/qml2cppdefaultpasses.cpp
+++ b/tools/qmltc/prototype/qml2cppdefaultpasses.cpp
@@ -527,7 +527,7 @@ QHash<QString, qsizetype> makeUniqueCppNames(const Qml2CppContext &context,
}
static void setupQmlCppType(const Qml2CppContext &context, const QQmlJSScope::Ptr &type,
- QString filePath)
+ const QString &filePath)
{
Q_ASSERT(type);
if (filePath.isEmpty()) {
@@ -543,8 +543,10 @@ static void setupQmlCppType(const Qml2CppContext &context, const QQmlJSScope::Pt
}
// TODO: this does not cover QT_QMLTC_FILE_BASENAME renaming
- filePath = QFileInfo(filePath).baseName().toLower() + u".h"_qs;
- type->setFileName(filePath); // this file name will be discovered during findCppIncludes
+ if (filePath != context.documentUrl) {
+ // this file name will be discovered during findCppIncludes
+ type->setFileName(QFileInfo(filePath).baseName().toLower() + u".h"_qs);
+ }
const auto properties = type->ownProperties();
for (auto it = properties.cbegin(); it != properties.cend(); ++it) {