QmlDesigner: Fix QmlTypesParser

Change-Id: I826e1a37747a51602f3f7a8ea675320787080272
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
(cherry picked from commit b929cbfd64)
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2023-04-25 18:57:07 +02:00
parent cadca7212e
commit 5223a90977
4 changed files with 13 additions and 15 deletions

View File

@@ -4,11 +4,10 @@
#include "qmltypesparser.h"
#include "projectstorage.h"
#include "sourcepathcache.h"
#include <sqlitedatabase.h>
#ifdef QDS_HAS_QMLPRIVATE
#ifdef HasQQmlJSTypeDescriptionReader
#include <private/qqmldomtop_p.h>
#include <private/qqmljstypedescriptionreader_p.h>
#endif
@@ -20,7 +19,7 @@
namespace QmlDesigner {
#if defined(QDS_HAS_QMLPRIVATE) && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
#ifdef HasQQmlJSTypeDescriptionReader
namespace QmlDom = QQmlJS::Dom;

View File

@@ -10,6 +10,10 @@ namespace Sqlite {
class Database;
}
#if defined(QDS_HAS_QMLPRIVATE) && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
#define HasQQmlJSTypeDescriptionReader
#endif
namespace QmlDesigner {
template<typename Database>
@@ -22,16 +26,13 @@ class QmlTypesParser : public QmlTypesParserInterface
{
public:
using ProjectStorage = QmlDesigner::ProjectStorage<Sqlite::Database>;
using PathCache = QmlDesigner::SourcePathCache<ProjectStorage, NonLockingMutex>;
#ifdef QDS_HAS_QMLPRIVATE
QmlTypesParser(PathCache &pathCache, ProjectStorage &storage)
: m_pathCache{pathCache}
, m_storage{storage}
#ifdef HasQQmlJSTypeDescriptionReader
QmlTypesParser(ProjectStorage &storage)
: m_storage{storage}
{}
#else
QmlTypesParser(PathCache &, ProjectStorage &)
{}
QmlTypesParser(ProjectStorage &) {}
#endif
void parse(const QString &sourceContent,
@@ -40,9 +41,7 @@ public:
const Storage::Synchronization::ProjectData &projectData) override;
private:
// m_pathCache and m_storage are only used when compiled for QDS
#ifdef QDS_HAS_QMLPRIVATE
PathCache &m_pathCache;
#ifdef HasQQmlJSTypeDescriptionReader
ProjectStorage &m_storage;
#endif
};

View File

@@ -185,7 +185,7 @@ public:
FileSystem fileSystem{pathCache};
FileStatusCache fileStatusCache{fileSystem};
QmlDocumentParser qmlDocumentParser{storage, pathCache};
QmlTypesParser qmlTypesParser{pathCache, storage};
QmlTypesParser qmlTypesParser{storage};
ProjectStoragePathWatcher<QFileSystemWatcher, QTimer, ProjectStorageUpdater::PathCache>
pathWatcher{pathCache, fileSystem, &updater};
ProjectPartId projectPartId;

View File

@@ -149,7 +149,7 @@ protected:
QmlDesigner::ProjectStorage<Sqlite::Database> storage{database, database.isInitialized()};
QmlDesigner::SourcePathCache<QmlDesigner::ProjectStorage<Sqlite::Database>> sourcePathCache{
storage};
QmlDesigner::QmlTypesParser parser{sourcePathCache, storage};
QmlDesigner::QmlTypesParser parser{storage};
Storage::Imports imports;
Storage::Types types;
SourceId qmltypesFileSourceId{sourcePathCache.sourceId("path/to/types.qmltypes")};