From 73d899801edb3b741fa2978ae08aba2b6930cd23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20K=C3=B6hne?= Date: Wed, 6 Apr 2022 09:17:35 +0200 Subject: qdoc: Do not split module names in different tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This did more harm than good, e.g. for ActiveQt->active,qt QtWebView->web,view. Change-Id: Ia08bc12ef7496fccb1a5d9bbd45c285448417adb Reviewed-by: Topi Reiniƶ (cherry picked from commit 255b9699f6957282200546705ad493ab16631883) Reviewed-by: Qt Cherry-pick Bot --- src/qdoc/manifestwriter.cpp | 22 +++++++++------------- src/qdoc/manifestwriter.h | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/qdoc/manifestwriter.cpp b/src/qdoc/manifestwriter.cpp index 571128c71..820942431 100644 --- a/src/qdoc/manifestwriter.cpp +++ b/src/qdoc/manifestwriter.cpp @@ -265,7 +265,7 @@ void ManifestWriter::generateManifestFile(const QString &manifest, const QString warnAboutUnusedAttributes(usedAttributes.keys(), example); writeDescription(&writer, example); - addWordsFromModuleNamesAsTags(); + addModuleNameAsTag(); writeTagsElement(&writer); const QString exampleName = example->name().mid(example->name().lastIndexOf('/') + 1); @@ -304,20 +304,16 @@ void ManifestWriter::writeTagsElement(QXmlStreamWriter *writer) \internal Add words from module name as tags - QtQuickControls -> qt,quick,controls - QtOpenGL -> qt,opengl - QtQuick3D -> qt,quick3d + QtQuickControls -> quickcontrols + QtOpenGL -> opengl + QtQuick3D -> quick3d */ -void ManifestWriter::addWordsFromModuleNamesAsTags() +void ManifestWriter::addModuleNameAsTag() { - // '?<=': positive lookbehind - QRegularExpression re("([A-Z]+[a-z0-9]*((?<=3)D|GL)?)"); - qsizetype pos = 0; - QRegularExpressionMatch match; - while ((match = re.match(m_project, pos)).hasMatch()) { - m_tags << match.captured(1).toLower(); - pos = match.capturedEnd(); - } + QString moduleName = m_project; + if (moduleName.startsWith("Qt")) + moduleName = moduleName.mid(2); + m_tags << moduleName.toLower(); } /*! diff --git a/src/qdoc/manifestwriter.h b/src/qdoc/manifestwriter.h index fc6392afd..5d17d6de9 100644 --- a/src/qdoc/manifestwriter.h +++ b/src/qdoc/manifestwriter.h @@ -62,7 +62,7 @@ private: QDocDatabase *m_qdb { nullptr }; QList m_manifestMetaContent {}; - void addWordsFromModuleNamesAsTags(); + void addModuleNameAsTag(); void includeTagsAddedWithMetaCommand(const ExampleNode *example); void writeTagsElement(QXmlStreamWriter *writer); template -- cgit v1.2.3