From d5ff6cfb1226f73a27c413bc95aebc5752b14cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Han=C3=A7erli?= <burak.hancerli@qt.io> Date: Tue, 14 Jan 2025 10:48:52 +0000 Subject: [PATCH] QDS-14390 Ignore comment lines in the qmlproject file --- qtquickdesigner-components | 2 +- src/designviewer.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/qtquickdesigner-components b/qtquickdesigner-components index 20397e2..04a5f67 160000 --- a/qtquickdesigner-components +++ b/qtquickdesigner-components @@ -1 +1 @@ -Subproject commit 20397e26370ff073125fd19f77c7ad013276b5bd +Subproject commit 04a5f670d3e7ae28e54bf194a3dd70e13d05ffc4 diff --git a/src/designviewer.cpp b/src/designviewer.cpp index 4c1a9e8..c15a6d1 100644 --- a/src/designviewer.cpp +++ b/src/designviewer.cpp @@ -112,7 +112,9 @@ void DesignViewer::parseQmlprojectFile(const QString &fileName, return; } - const QString text = QString::fromUtf8(file.readAll()); + // Regular expression to remove lines starting with // + QRegularExpression commentRegExp("^\\s*//.*$", QRegularExpression::MultilineOption); + const QString text = QString::fromUtf8(file.readAll()).remove(commentRegExp); const QRegularExpression mainFileRegExp("mainFile:\\s*\"(.*)\""); const QRegularExpressionMatch mainFileMatch = mainFileRegExp.match(text); @@ -133,7 +135,7 @@ void DesignViewer::parseQmlprojectFile(const QString &fileName, const QRegularExpressionMatch qt6ProjectMatch = qt6ProjectRegExp.match(text); if (!qt6ProjectMatch.hasMatch()) { - qWarning() << "This is not a Qt6 project.\nQt5 projects might work, but they are not " + qWarning() << "This is not a Qt6 project.Qt5 projects might work, but they are not " "officially supported."; } -- GitLab