forked from qt-creator/qt-creator
QmlDesigner: More integration cleanup
Instead of a warning we now provide different functions for the project storage. Should give better errors. Change-Id: I48cea16482950c2b3c5eea3e72d4e9c40b9e75b2 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -7,9 +7,10 @@
|
||||
#include <auxiliarydataproperties.h>
|
||||
#include <externaldependenciesinterface.h>
|
||||
#include <plaintexteditmodifier.h>
|
||||
#include <qmldesignerplugin.h>
|
||||
#include <qmldesignerprojectmanager.h>
|
||||
#include <rewriterview.h>
|
||||
#include <signalhandlerproperty.h>
|
||||
#include <qmldesignerplugin.h>
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
@@ -192,7 +193,9 @@ Qt::CheckState checkState(const std::vector<std::string> &a, const std::vector<s
|
||||
|
||||
struct ModelBuilder
|
||||
{
|
||||
ModelBuilder(const QString &filePath, ExternalDependenciesInterface &externalDependencies)
|
||||
ModelBuilder(const QString &filePath,
|
||||
ExternalDependenciesInterface &externalDependencies,
|
||||
[[maybe_unused]] ProjectStorageDependencies projectStorageDependencies)
|
||||
{
|
||||
const QString fileContent = fileToString(filePath);
|
||||
if (fileContent.isEmpty()) {
|
||||
@@ -209,7 +212,14 @@ struct ModelBuilder
|
||||
rewriter->setCheckLinkErrors(false);
|
||||
rewriter->setTextModifier(modifier.get());
|
||||
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
model = QmlDesigner::Model::create(projectStorageDependencies,
|
||||
"Item",
|
||||
{Import::createLibraryImport("QtQuick")},
|
||||
filePath);
|
||||
#else
|
||||
model = QmlDesigner::Model::create("QtQuick.Item", 2, 1);
|
||||
#endif
|
||||
model->setRewriterView(rewriter.get());
|
||||
}
|
||||
|
||||
@@ -221,9 +231,12 @@ struct ModelBuilder
|
||||
|
||||
} // namespace
|
||||
|
||||
InsightModel::InsightModel(InsightView *view, ExternalDependenciesInterface &externalDependencies)
|
||||
InsightModel::InsightModel(InsightView *view,
|
||||
ExternalDependenciesInterface &externalDependencies,
|
||||
QmlDesignerProjectManager &projectManager)
|
||||
: m_insightView(view)
|
||||
, m_externalDependencies(externalDependencies)
|
||||
, m_projectManager(projectManager)
|
||||
, m_fileSystemWatcher(new Utils::FileSystemWatcher(this))
|
||||
{
|
||||
QObject::connect(ProjectExplorer::ProjectManager::instance(),
|
||||
@@ -446,7 +459,9 @@ void InsightModel::setEnabled(bool value)
|
||||
return;
|
||||
}
|
||||
|
||||
ModelBuilder builder(m_mainQmlInfo.absoluteFilePath(), m_externalDependencies);
|
||||
ModelBuilder builder(m_mainQmlInfo.absoluteFilePath(),
|
||||
m_externalDependencies,
|
||||
m_projectManager.projectStorageDependencies());
|
||||
|
||||
if (!builder.model) {
|
||||
qWarning() << "Could not create model" << m_mainQmlInfo.absoluteFilePath();
|
||||
@@ -613,7 +628,9 @@ int InsightModel::devicePixelRatio()
|
||||
|
||||
void InsightModel::parseMainQml()
|
||||
{
|
||||
ModelBuilder builder(m_mainQmlInfo.absoluteFilePath(), m_externalDependencies);
|
||||
ModelBuilder builder(m_mainQmlInfo.absoluteFilePath(),
|
||||
m_externalDependencies,
|
||||
m_projectManager.projectStorageDependencies());
|
||||
|
||||
if (!builder.model)
|
||||
return;
|
||||
|
@@ -39,7 +39,9 @@ class InsightModel : public QAbstractListModel
|
||||
};
|
||||
|
||||
public:
|
||||
InsightModel(InsightView *view, class ExternalDependenciesInterface &externalDependencies);
|
||||
InsightModel(InsightView *view,
|
||||
class ExternalDependenciesInterface &externalDependencies,
|
||||
class QmlDesignerProjectManager &projectManager);
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
@@ -109,6 +111,7 @@ private:
|
||||
private:
|
||||
QPointer<InsightView> m_insightView;
|
||||
ExternalDependenciesInterface &m_externalDependencies;
|
||||
QmlDesignerProjectManager &m_projectManager;
|
||||
|
||||
Utils::FileSystemWatcher *m_fileSystemWatcher;
|
||||
|
||||
|
@@ -20,7 +20,8 @@ class InsightPlugin final : public ExtensionSystem::IPlugin
|
||||
auto *designerPlugin = QmlDesignerPlugin::instance();
|
||||
auto &viewManager = designerPlugin->viewManager();
|
||||
viewManager.registerView(std::make_unique<InsightView>(
|
||||
QmlDesignerPlugin::externalDependenciesForPluginInitializationOnly()));
|
||||
QmlDesignerPlugin::externalDependenciesForPluginInitializationOnly(),
|
||||
QmlDesignerPlugin::projectManagerForPluginInitializationOnly()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -14,9 +14,10 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
InsightView::InsightView(ExternalDependenciesInterface &externalDependencies)
|
||||
InsightView::InsightView(ExternalDependenciesInterface &externalDependencies,
|
||||
QmlDesignerProjectManager &projectManager)
|
||||
: AbstractView(externalDependencies)
|
||||
, m_insightModel(std::make_unique<InsightModel>(this, externalDependencies))
|
||||
, m_insightModel(std::make_unique<InsightModel>(this, externalDependencies, projectManager))
|
||||
{
|
||||
Q_ASSERT(m_insightModel);
|
||||
}
|
||||
|
@@ -15,13 +15,15 @@ namespace QmlDesigner {
|
||||
|
||||
class InsightModel;
|
||||
class InsightWidget;
|
||||
class QmlDesignerProjectManager;
|
||||
|
||||
class InsightView : public AbstractView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InsightView(ExternalDependenciesInterface &externalDependencies);
|
||||
explicit InsightView(ExternalDependenciesInterface &externalDependencies,
|
||||
QmlDesignerProjectManager &projectManager);
|
||||
~InsightView() override;
|
||||
|
||||
// AbstractView
|
||||
|
@@ -56,9 +56,10 @@ add_qtc_plugin(QmlDesigner
|
||||
DEFINES
|
||||
IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\"
|
||||
SHARE_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../../share/qtcreator/qmldesigner"
|
||||
$<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE>
|
||||
$<$<BOOL:${QTC_USE_QML_DESIGNER_LITE}>:QTC_USE_QML_DESIGNER_LITE>
|
||||
$<$<BOOL:${DETACH_DISABLED_VIEWS}>:DETACH_DISABLED_VIEWS>
|
||||
PUBLIC_DEFINES
|
||||
$<$<BOOL:${USE_PROJECTSTORAGE}>:QDS_USE_PROJECTSTORAGE>
|
||||
INCLUDES
|
||||
${CMAKE_CURRENT_LIST_DIR}/libs
|
||||
${CMAKE_CURRENT_LIST_DIR}/components
|
||||
|
@@ -81,13 +81,13 @@ private:
|
||||
std::atomic<bool> m_quitDumper;
|
||||
};
|
||||
|
||||
|
||||
|
||||
AssetExporter::AssetExporter(AssetExporterView *view, ProjectExplorer::Project *project, QObject *parent) :
|
||||
QObject(parent),
|
||||
m_currentState(*this),
|
||||
m_project(project),
|
||||
m_view(view)
|
||||
AssetExporter::AssetExporter(AssetExporterView *view,
|
||||
ProjectExplorer::Project *project,
|
||||
ProjectStorageDependencies projectStorageDependencies)
|
||||
: m_currentState(*this)
|
||||
, m_project(project)
|
||||
, m_view(view)
|
||||
, m_projectStorageDependencies{projectStorageDependencies}
|
||||
{
|
||||
connect(m_view, &AssetExporterView::loadingFinished, this, &AssetExporter::onQmlFileLoaded);
|
||||
connect(m_view, &AssetExporterView::loadingError, this, &AssetExporter::notifyLoadError);
|
||||
@@ -257,7 +257,14 @@ void AssetExporter::preprocessQmlFile(const Utils::FilePath &path)
|
||||
{
|
||||
// Load the QML file and assign UUIDs to items having none.
|
||||
// Meanwhile cache the Component UUIDs as well
|
||||
ModelPointer model(Model::create("Item", 2, 7));
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
ModelPointer model = Model::create(m_projectStorageDependencies,
|
||||
"Item",
|
||||
{Import::createLibraryImport("QtQuick")},
|
||||
path.path());
|
||||
#else
|
||||
ModelPointer model = Model::create("Item", 2, 7);
|
||||
#endif
|
||||
Utils::FileReader reader;
|
||||
if (!reader.fetch(path)) {
|
||||
ExportNotification::addError(tr("Cannot preprocess file: %1. Error %2")
|
||||
|
@@ -39,8 +39,9 @@ public:
|
||||
ExportingDone
|
||||
};
|
||||
|
||||
AssetExporter(AssetExporterView *view, ProjectExplorer::Project *project,
|
||||
QObject *parent = nullptr);
|
||||
AssetExporter(AssetExporterView *view,
|
||||
ProjectExplorer::Project *project,
|
||||
ProjectStorageDependencies projectStorageDependencies);
|
||||
~AssetExporter();
|
||||
|
||||
void exportQml(const Utils::FilePaths &qmlFiles, const Utils::FilePath &exportPath,
|
||||
@@ -96,6 +97,7 @@ private:
|
||||
QHash<QString, QString> m_componentUuidCache;
|
||||
QSet<QByteArray> m_usedHashes;
|
||||
QHash<QString, QPixmap> m_assets;
|
||||
ProjectStorageDependencies m_projectStorageDependencies;
|
||||
std::unique_ptr<AssetDumper> m_assetDumper;
|
||||
bool m_cancelled = false;
|
||||
};
|
||||
|
@@ -3,12 +3,13 @@
|
||||
|
||||
#include "assetexporterplugin.h"
|
||||
|
||||
#include "assetexportpluginconstants.h"
|
||||
#include "assetexportdialog.h"
|
||||
#include "assetexporter.h"
|
||||
#include "assetexporterview.h"
|
||||
#include "filepathmodel.h"
|
||||
#include "assetexportpluginconstants.h"
|
||||
#include "componentexporter.h"
|
||||
#include "filepathmodel.h"
|
||||
#include <qmldesignerprojectmanager.h>
|
||||
|
||||
#include "dumpers/itemnodedumper.h"
|
||||
#include "dumpers/textnodedumper.h"
|
||||
@@ -37,6 +38,7 @@
|
||||
namespace QmlDesigner {
|
||||
|
||||
AssetExporterPlugin::AssetExporterPlugin()
|
||||
: m_projectManager{QmlDesigner::QmlDesignerPlugin::projectManagerForPluginInitializationOnly()}
|
||||
{
|
||||
ProjectExplorer::TaskHub::addCategory({Constants::TASK_CATEGORY_ASSET_EXPORT,
|
||||
tr("Asset Export"),
|
||||
@@ -44,6 +46,7 @@ AssetExporterPlugin::AssetExporterPlugin()
|
||||
false});
|
||||
|
||||
auto *designerPlugin = QmlDesigner::QmlDesignerPlugin::instance();
|
||||
|
||||
auto &viewManager = designerPlugin->viewManager();
|
||||
m_view = viewManager.registerView(std::make_unique<AssetExporterView>(
|
||||
designerPlugin->externalDependenciesForPluginInitializationOnly()));
|
||||
@@ -79,7 +82,7 @@ void AssetExporterPlugin::onExport()
|
||||
if (!exportDir.parentDir().isEmpty())
|
||||
exportDir = exportDir.parentDir();
|
||||
exportDir = exportDir.pathAppended(startupProject->displayName() + "_export");
|
||||
AssetExporter assetExporter(m_view, startupProject);
|
||||
AssetExporter assetExporter(m_view, startupProject, m_projectManager.projectStorageDependencies());
|
||||
AssetExportDialog assetExporterDialog(exportDir, assetExporter, model);
|
||||
assetExporterDialog.exec();
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ private:
|
||||
void updateActions();
|
||||
|
||||
AssetExporterView *m_view = nullptr;
|
||||
class QmlDesignerProjectManager &m_projectManager;
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -21,19 +21,6 @@
|
||||
|
||||
namespace {
|
||||
Q_LOGGING_CATEGORY(loggerInfo, "qtc.designer.assetExportPlugin.modelExporter", QtInfoMsg)
|
||||
|
||||
static QByteArrayList populateLineage(const QmlDesigner::ModelNode &node)
|
||||
{
|
||||
QByteArrayList lineage;
|
||||
if (!node.isValid() || node.type().isEmpty())
|
||||
return {};
|
||||
|
||||
for (auto &info : node.metaInfo().prototypes())
|
||||
lineage.append(info.typeName());
|
||||
|
||||
return lineage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace QmlDesigner {
|
||||
@@ -78,10 +65,9 @@ const QString &Component::name() const
|
||||
|
||||
NodeDumper *Component::createNodeDumper(const ModelNode &node) const
|
||||
{
|
||||
QByteArrayList lineage = populateLineage(node);
|
||||
std::unique_ptr<NodeDumper> reader;
|
||||
for (auto &dumperCreator: m_readers) {
|
||||
std::unique_ptr<NodeDumper> r(dumperCreator->instance(lineage, node));
|
||||
std::unique_ptr<NodeDumper> r(dumperCreator->instance(node));
|
||||
if (r->isExportable()) {
|
||||
if (reader) {
|
||||
if (reader->priority() < r->priority())
|
||||
|
@@ -27,7 +27,7 @@ class NodeDumperCreatorBase
|
||||
public:
|
||||
virtual ~NodeDumperCreatorBase() {}
|
||||
protected:
|
||||
virtual NodeDumper *instance(const QByteArrayList &, const ModelNode &) const = 0;
|
||||
virtual NodeDumper *instance(const ModelNode &) const = 0;
|
||||
friend Component;
|
||||
};
|
||||
|
||||
@@ -39,9 +39,7 @@ public:
|
||||
~NodeDumperCreator() = default;
|
||||
|
||||
protected:
|
||||
NodeDumper *instance(const QByteArrayList &lineage, const ModelNode &node) const {
|
||||
return new T(lineage, node);
|
||||
}
|
||||
NodeDumper *instance(const ModelNode &node) const { return new T(node); }
|
||||
};
|
||||
} //Internal
|
||||
|
||||
|
@@ -14,18 +14,18 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
using namespace Constants;
|
||||
AssetNodeDumper::AssetNodeDumper(const QByteArrayList &lineage, const ModelNode &node) :
|
||||
ItemNodeDumper(lineage, node)
|
||||
|
||||
AssetNodeDumper::AssetNodeDumper(const ModelNode &node)
|
||||
: ItemNodeDumper(node)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool AssetNodeDumper::isExportable() const
|
||||
{
|
||||
auto hasType = [this](const QByteArray &type) {
|
||||
return lineage().contains(type);
|
||||
};
|
||||
return hasType("QtQuick.Image") || hasType("QtQuick.Rectangle");
|
||||
auto qtQuickImageMetaInfo = model()->qtQuickImageMetaInfo();
|
||||
auto qtQuickRectangleMetaInfo = model()->qtQuickRectangleMetaInfo();
|
||||
return metaInfo().isBasedOn(qtQuickImageMetaInfo, qtQuickRectangleMetaInfo);
|
||||
}
|
||||
|
||||
QJsonObject AssetNodeDumper::json(Component &component) const
|
||||
|
@@ -10,7 +10,7 @@ class Component;
|
||||
class AssetNodeDumper : public ItemNodeDumper
|
||||
{
|
||||
public:
|
||||
AssetNodeDumper(const QByteArrayList &lineage, const ModelNode &node);
|
||||
AssetNodeDumper(const ModelNode &node);
|
||||
~AssetNodeDumper() override = default;
|
||||
|
||||
bool isExportable() const override;
|
||||
|
@@ -22,16 +22,16 @@ static QString capitalize(const QString &str)
|
||||
|
||||
namespace QmlDesigner {
|
||||
using namespace Constants;
|
||||
ItemNodeDumper::ItemNodeDumper(const QByteArrayList &lineage,
|
||||
const ModelNode &node) :
|
||||
NodeDumper(lineage, node)
|
||||
|
||||
ItemNodeDumper::ItemNodeDumper(const ModelNode &node)
|
||||
: NodeDumper(node)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool QmlDesigner::ItemNodeDumper::isExportable() const
|
||||
{
|
||||
return lineage().contains("QtQuick.Item");
|
||||
return metaInfo().isQtQuickItem();
|
||||
}
|
||||
|
||||
QJsonObject QmlDesigner::ItemNodeDumper::json([[maybe_unused]] QmlDesigner::Component &component) const
|
||||
|
@@ -11,7 +11,7 @@ class Component;
|
||||
class ItemNodeDumper : public NodeDumper
|
||||
{
|
||||
public:
|
||||
ItemNodeDumper(const QByteArrayList &lineage, const ModelNode &node);
|
||||
ItemNodeDumper(const ModelNode &node);
|
||||
|
||||
~ItemNodeDumper() override = default;
|
||||
|
||||
|
@@ -6,10 +6,11 @@
|
||||
#include <auxiliarydataproperties.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
NodeDumper::NodeDumper(const QByteArrayList &lineage, const ModelNode &node) :
|
||||
m_node(node),
|
||||
m_objectNode(node),
|
||||
m_lineage(lineage)
|
||||
NodeDumper::NodeDumper(const ModelNode &node)
|
||||
: m_node(node)
|
||||
, m_objectNode(node)
|
||||
, m_metaInfo(node.metaInfo())
|
||||
, m_model{node.model()}
|
||||
{
|
||||
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ class ModelNode;
|
||||
class NodeDumper
|
||||
{
|
||||
public:
|
||||
NodeDumper(const QByteArrayList &lineage, const ModelNode &node);
|
||||
NodeDumper(const ModelNode &node);
|
||||
|
||||
virtual ~NodeDumper() = default;
|
||||
|
||||
@@ -22,16 +22,19 @@ public:
|
||||
virtual bool isExportable() const = 0;
|
||||
virtual QJsonObject json(Component& component) const = 0;
|
||||
|
||||
const QByteArrayList& lineage() const { return m_lineage; }
|
||||
const NodeMetaInfo &metaInfo() const { return m_metaInfo; }
|
||||
const QmlObjectNode& objectNode() const { return m_objectNode; }
|
||||
QVariant propertyValue(const PropertyName &name) const;
|
||||
QString uuid() const;
|
||||
|
||||
Model *model() const { return m_model; }
|
||||
|
||||
protected:
|
||||
const ModelNode &m_node;
|
||||
|
||||
private:
|
||||
QmlObjectNode m_objectNode;
|
||||
QByteArrayList m_lineage;
|
||||
NodeMetaInfo m_metaInfo;
|
||||
Model *m_model = nullptr;
|
||||
};
|
||||
}
|
||||
|
@@ -4,6 +4,8 @@
|
||||
#include "textnodedumper.h"
|
||||
#include "assetexportpluginconstants.h"
|
||||
|
||||
#include <model.h>
|
||||
|
||||
#include <QColor>
|
||||
#include <QFontInfo>
|
||||
#include <QFontMetricsF>
|
||||
@@ -35,18 +37,18 @@ QString toJsonAlignEnum(QString value) {
|
||||
|
||||
namespace QmlDesigner {
|
||||
using namespace Constants;
|
||||
TextNodeDumper::TextNodeDumper(const QByteArrayList &lineage, const ModelNode &node) :
|
||||
ItemNodeDumper(lineage, node)
|
||||
|
||||
TextNodeDumper::TextNodeDumper(const ModelNode &node)
|
||||
: ItemNodeDumper(node)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool TextNodeDumper::isExportable() const
|
||||
{
|
||||
const QByteArrayList &baseClasses = lineage();
|
||||
return std::any_of(baseClasses.cbegin(), baseClasses.cend(), [](const QByteArray &type) {
|
||||
return type == "QtQuick.Text" || type == "QtQuick.Controls.Label";
|
||||
});
|
||||
auto qtQuickTextMetaInfo = model()->qtQuickTextMetaInfo();
|
||||
auto qtQuickControlsLabelMetaInfo = model()->qtQuickControlsLabelMetaInfo();
|
||||
return metaInfo().isBasedOn(qtQuickTextMetaInfo, qtQuickControlsLabelMetaInfo);
|
||||
}
|
||||
|
||||
QJsonObject TextNodeDumper::json([[maybe_unused]] Component &component) const
|
||||
|
@@ -10,7 +10,7 @@ class Component;
|
||||
class TextNodeDumper : public ItemNodeDumper
|
||||
{
|
||||
public:
|
||||
TextNodeDumper(const QByteArrayList &lineage, const ModelNode &node);
|
||||
TextNodeDumper(const ModelNode &node);
|
||||
~TextNodeDumper() override = default;
|
||||
|
||||
bool isExportable() const override;
|
||||
|
@@ -376,10 +376,11 @@ void ItemLibraryModel::update(Model *model)
|
||||
for (const ItemLibraryEntry &entry : itemLibEntries) {
|
||||
NodeMetaInfo metaInfo;
|
||||
|
||||
if constexpr (useProjectStorage())
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
metaInfo = NodeMetaInfo{entry.typeId(), model->projectStorage()};
|
||||
else
|
||||
#else
|
||||
metaInfo = model->metaInfo(entry.typeName());
|
||||
#endif
|
||||
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
bool valid = metaInfo.isValid();
|
||||
|
@@ -24,13 +24,6 @@
|
||||
|
||||
#include <variant>
|
||||
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
# define DEPRECATED_OLD_CREATE_MODELNODE \
|
||||
[[deprecated("Use unqualified type names and no versions!")]]
|
||||
#else
|
||||
# define DEPRECATED_OLD_CREATE_MODELNODE
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPixmap;
|
||||
class QUrl;
|
||||
@@ -91,16 +84,17 @@ public:
|
||||
Imports imports,
|
||||
const QUrl &fileUrl,
|
||||
std::unique_ptr<ModelResourceManagementInterface> resourceManagement = {});
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
Model(const TypeName &typeName,
|
||||
int major = 1,
|
||||
int minor = 1,
|
||||
Model *metaInfoProxyModel = nullptr,
|
||||
std::unique_ptr<ModelResourceManagementInterface> resourceManagement = {});
|
||||
|
||||
#endif
|
||||
~Model();
|
||||
|
||||
DEPRECATED_OLD_CREATE_MODELNODE static ModelPointer create(
|
||||
const TypeName &typeName,
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
static ModelPointer create(const TypeName &typeName,
|
||||
int major = 1,
|
||||
int minor = 1,
|
||||
Model *metaInfoProxyModel = nullptr,
|
||||
@@ -109,9 +103,9 @@ public:
|
||||
return ModelPointer(
|
||||
new Model(typeName, major, minor, metaInfoProxyModel, std::move(resourceManagement)));
|
||||
}
|
||||
#endif
|
||||
|
||||
static ModelPointer create(
|
||||
ProjectStorageDependencies projectStorageDependencies,
|
||||
static ModelPointer create(ProjectStorageDependencies projectStorageDependencies,
|
||||
Utils::SmallStringView typeName,
|
||||
Imports imports,
|
||||
const QUrl &fileUrl,
|
||||
@@ -124,8 +118,8 @@ public:
|
||||
std::move(resourceManagement)));
|
||||
}
|
||||
|
||||
DEPRECATED_OLD_CREATE_MODELNODE static ModelPointer create(
|
||||
ProjectStorageDependencies projectStorageDependencies,
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
static ModelPointer create(ProjectStorageDependencies projectStorageDependencies,
|
||||
const TypeName &typeName,
|
||||
int major = 1,
|
||||
int minor = 1,
|
||||
@@ -138,6 +132,7 @@ public:
|
||||
nullptr,
|
||||
std::move(resourceManagement)));
|
||||
}
|
||||
#endif
|
||||
|
||||
ModelPointer createModel(const TypeName &typeName,
|
||||
std::unique_ptr<ModelResourceManagementInterface> resourceManagement = {});
|
||||
@@ -188,6 +183,7 @@ public:
|
||||
NodeMetaInfo qtQuick3DTextureMetaInfo() const;
|
||||
NodeMetaInfo qtQuick3DTextureInputMetaInfo() const;
|
||||
NodeMetaInfo qtQuickBorderImageMetaInfo() const;
|
||||
NodeMetaInfo qtQuickControlsLabelMetaInfo() const;
|
||||
NodeMetaInfo qtQuickControlsTextAreaMetaInfo() const;
|
||||
NodeMetaInfo qtQuickImageMetaInfo() const;
|
||||
NodeMetaInfo qtQuickItemMetaInfo() const;
|
||||
|
@@ -23,22 +23,6 @@ QT_BEGIN_NAMESPACE
|
||||
class QDeclarativeContext;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
# define DEPRECATED_TYPENAME [[deprecated("Don't use string based types anymore!")]]
|
||||
# define DEPRECATED_VERSION_NUMBER \
|
||||
[[deprecated( \
|
||||
"In most cases you don't need them anymore because the import is setting them!")]]
|
||||
# define DEPRECATED_COMPONENT_FILE_NAME [[deprecated("Use sourceId() instead.")]]
|
||||
# define DEPRECATED_IMPORT_DIRECTORY_PATH [[deprecated("Use allExportedTypeNames().")]]
|
||||
# define DEPRECATED_REQUIRED_IMPORT_STRING [[deprecated("Use allExportedTypeNames().")]]
|
||||
#else
|
||||
# define DEPRECATED_TYPENAME
|
||||
# define DEPRECATED_VERSION_NUMBER
|
||||
# define DEPRECATED_COMPONENT_FILE_NAME
|
||||
# define DEPRECATED_IMPORT_DIRECTORY_PATH
|
||||
# define DEPRECATED_REQUIRED_IMPORT_STRING
|
||||
#endif
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
class MetaInfo;
|
||||
@@ -54,7 +38,9 @@ class QMLDESIGNERCORE_EXPORT NodeMetaInfo
|
||||
|
||||
public:
|
||||
NodeMetaInfo();
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
NodeMetaInfo(Model *model, const TypeName &typeName, int majorVersion, int minorVersion);
|
||||
#else
|
||||
NodeMetaInfo(TypeId typeId, NotNullPointer<const ProjectStorageType> projectStorage)
|
||||
: m_typeId{typeId}
|
||||
, m_projectStorage{projectStorage}
|
||||
@@ -62,6 +48,7 @@ public:
|
||||
NodeMetaInfo(NotNullPointer<const ProjectStorageType> projectStorage)
|
||||
: m_projectStorage{projectStorage}
|
||||
{}
|
||||
#endif
|
||||
|
||||
NodeMetaInfo(const NodeMetaInfo &);
|
||||
NodeMetaInfo &operator=(const NodeMetaInfo &);
|
||||
@@ -69,6 +56,7 @@ public:
|
||||
NodeMetaInfo &operator=(NodeMetaInfo &&);
|
||||
~NodeMetaInfo();
|
||||
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
static NodeMetaInfo create(NotNullPointer<const ProjectStorageType> projectStorage, TypeId typeId)
|
||||
{
|
||||
return {typeId, projectStorage};
|
||||
@@ -78,6 +66,7 @@ public:
|
||||
{
|
||||
return std::bind_front(&NodeMetaInfo::create, projectStorage);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool isValid() const;
|
||||
explicit operator bool() const { return isValid(); }
|
||||
@@ -118,11 +107,12 @@ public:
|
||||
bool defaultPropertyIsComponent() const;
|
||||
|
||||
QString displayName() const;
|
||||
DEPRECATED_TYPENAME TypeName typeName() const;
|
||||
DEPRECATED_TYPENAME TypeName simplifiedTypeName() const;
|
||||
DEPRECATED_VERSION_NUMBER int majorVersion() const;
|
||||
DEPRECATED_VERSION_NUMBER int minorVersion() const;
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
TypeName typeName() const;
|
||||
TypeName simplifiedTypeName() const;
|
||||
int majorVersion() const;
|
||||
int minorVersion() const;
|
||||
#endif
|
||||
Storage::Info::ExportedTypeNames allExportedTypeNames() const;
|
||||
Storage::Info::ExportedTypeNames exportedTypeNamesForSourceId(SourceId sourceId) const;
|
||||
|
||||
@@ -131,7 +121,9 @@ public:
|
||||
Storage::Info::ItemLibraryEntries itemLibrariesEntries() const;
|
||||
|
||||
SourceId sourceId() const;
|
||||
DEPRECATED_COMPONENT_FILE_NAME QString componentFileName() const;
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
QString componentFileName() const;
|
||||
#endif
|
||||
|
||||
bool isBasedOn(const NodeMetaInfo &metaInfo) const;
|
||||
bool isBasedOn(const NodeMetaInfo &metaInfo1, const NodeMetaInfo &metaInfo2) const;
|
||||
@@ -214,6 +206,7 @@ public:
|
||||
bool isQtQuick3DCubeMapTexture() const;
|
||||
bool isQtQuick3DView3D() const;
|
||||
bool isQtQuickBorderImage() const;
|
||||
bool isQtQuickControlsLabel() const;
|
||||
bool isQtQuickControlsSwipeView() const;
|
||||
bool isQtQuickControlsTabBar() const;
|
||||
bool isQtQuickExtrasPicture() const;
|
||||
@@ -226,6 +219,7 @@ public:
|
||||
bool isQtQuickPositioner() const;
|
||||
bool isQtQuickPropertyAnimation() const;
|
||||
bool isQtQuickPropertyChanges() const;
|
||||
bool isQtQuickRectangle() const;
|
||||
bool isQtQuickRepeater() const;
|
||||
bool isQtQuickState() const;
|
||||
bool isQtQuickStateOperation() const;
|
||||
@@ -251,9 +245,10 @@ public:
|
||||
bool usesCustomParser() const;
|
||||
|
||||
bool isEnumeration() const;
|
||||
DEPRECATED_IMPORT_DIRECTORY_PATH QString importDirectoryPath() const;
|
||||
DEPRECATED_REQUIRED_IMPORT_STRING QString requiredImportString() const;
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
QString importDirectoryPath() const;
|
||||
QString requiredImportString() const;
|
||||
#endif
|
||||
friend bool operator==(const NodeMetaInfo &first, const NodeMetaInfo &second)
|
||||
{
|
||||
if constexpr (useProjectStorage())
|
||||
|
@@ -614,8 +614,9 @@ public:
|
||||
const TypeName &propertyType(const PropertyName &propertyName) const;
|
||||
|
||||
void setupPrototypes();
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
QList<TypeDescription> prototypes() const;
|
||||
|
||||
#endif
|
||||
bool isPropertyWritable(const PropertyName &propertyName) const;
|
||||
bool isPropertyPointer(const PropertyName &propertyName) const;
|
||||
bool isPropertyList(const PropertyName &propertyName) const;
|
||||
@@ -1429,10 +1430,12 @@ void NodeMetaInfoPrivate::setupPrototypes()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
QList<TypeDescription> NodeMetaInfoPrivate::prototypes() const
|
||||
{
|
||||
return m_prototypes;
|
||||
}
|
||||
#endif
|
||||
|
||||
const CppComponentValue *NodeMetaInfoPrivate::getNearestCppComponentValue() const
|
||||
{
|
||||
@@ -1478,10 +1481,13 @@ NodeMetaInfo &NodeMetaInfo::operator=(const NodeMetaInfo &) = default;
|
||||
NodeMetaInfo::NodeMetaInfo(NodeMetaInfo &&) = default;
|
||||
NodeMetaInfo &NodeMetaInfo::operator=(NodeMetaInfo &&) = default;
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
|
||||
NodeMetaInfo::NodeMetaInfo(Model *model, const TypeName &type, int maj, int min)
|
||||
: m_privateData(NodeMetaInfoPrivate::create(model, type, maj, min))
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
NodeMetaInfo::~NodeMetaInfo() = default;
|
||||
|
||||
@@ -2024,15 +2030,13 @@ std::vector<NodeMetaInfo> NodeMetaInfo::selfAndPrototypes() const
|
||||
if (!isValid())
|
||||
return {};
|
||||
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"get self and prototypes"_t,
|
||||
category(),
|
||||
keyValue("type id", m_typeId)};
|
||||
NanotraceHR::Tracer tracer{"get self and prototypes"_t, category(), keyValue("type id", m_typeId)};
|
||||
|
||||
return Utils::transform<NodeMetaInfos>(m_projectStorage->prototypeAndSelfIds(m_typeId),
|
||||
NodeMetaInfo::bind(m_projectStorage));
|
||||
} else {
|
||||
#else
|
||||
NodeMetaInfos hierarchy = {*this};
|
||||
Model *model = m_privateData->model();
|
||||
for (const TypeDescription &type : m_privateData->prototypes()) {
|
||||
@@ -2045,7 +2049,7 @@ std::vector<NodeMetaInfo> NodeMetaInfo::selfAndPrototypes() const
|
||||
}
|
||||
|
||||
return hierarchy;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NodeMetaInfos NodeMetaInfo::prototypes() const
|
||||
@@ -2053,13 +2057,13 @@ NodeMetaInfos NodeMetaInfo::prototypes() const
|
||||
if (!isValid())
|
||||
return {};
|
||||
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"get prototypes"_t, category(), keyValue("type id", m_typeId)};
|
||||
return Utils::transform<NodeMetaInfos>(m_projectStorage->prototypeIds(m_typeId),
|
||||
NodeMetaInfo::bind(m_projectStorage));
|
||||
|
||||
} else {
|
||||
#else
|
||||
NodeMetaInfos hierarchy;
|
||||
Model *model = m_privateData->model();
|
||||
for (const TypeDescription &type : m_privateData->prototypes()) {
|
||||
@@ -2072,7 +2076,7 @@ NodeMetaInfos NodeMetaInfo::prototypes() const
|
||||
}
|
||||
|
||||
return hierarchy;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -2111,6 +2115,7 @@ QString NodeMetaInfo::displayName() const
|
||||
return {};
|
||||
}
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
TypeName NodeMetaInfo::typeName() const
|
||||
{
|
||||
if (isValid())
|
||||
@@ -2146,6 +2151,7 @@ int NodeMetaInfo::minorVersion() const
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
Storage::Info::ExportedTypeNames NodeMetaInfo::allExportedTypeNames() const
|
||||
{
|
||||
@@ -2260,6 +2266,7 @@ SourceId NodeMetaInfo::sourceId() const
|
||||
return SourceId{};
|
||||
}
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
QString NodeMetaInfo::componentFileName() const
|
||||
{
|
||||
if constexpr (!useProjectStorage()) {
|
||||
@@ -2295,6 +2302,7 @@ QString NodeMetaInfo::requiredImportString() const
|
||||
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
|
||||
SourceId NodeMetaInfo::propertyEditorPathId() const
|
||||
{
|
||||
@@ -2333,13 +2341,17 @@ PropertyDeclarationId NodeMetaInfo::defaultPropertyDeclarationId() const
|
||||
return *m_defaultPropertyId;
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isSubclassOf(const TypeName &type, int majorVersion, int minorVersion) const
|
||||
bool NodeMetaInfo::isSubclassOf([[maybe_unused]] const TypeName &type,
|
||||
[[maybe_unused]] int majorVersion,
|
||||
[[maybe_unused]] int minorVersion) const
|
||||
{
|
||||
if (!isValid()) {
|
||||
qWarning() << "NodeMetaInfo is invalid" << type;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
|
||||
if (typeName().isEmpty())
|
||||
return false;
|
||||
|
||||
@@ -2363,6 +2375,7 @@ bool NodeMetaInfo::isSubclassOf(const TypeName &type, int majorVersion, int mino
|
||||
}
|
||||
}
|
||||
m_privateData->prototypeCacheNegatives().insert(stringIdentifier(type, majorVersion, minorVersion));
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2402,7 +2415,7 @@ bool NodeMetaInfo::isSuitableForMouseAreaFill() const
|
||||
|
||||
bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -2413,18 +2426,18 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo) const
|
||||
keyValue("meta info type id", metaInfo.m_typeId)};
|
||||
|
||||
return m_projectStorage->isBasedOn(m_typeId, metaInfo.m_typeId);
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
if (majorVersion() == -1 && minorVersion() == -1)
|
||||
return isSubclassOf(metaInfo.typeName());
|
||||
return isSubclassOf(metaInfo.typeName(), metaInfo.majorVersion(), metaInfo.minorVersion());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1, const NodeMetaInfo &metaInfo2) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -2432,23 +2445,22 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1, const NodeMetaInfo &
|
||||
NanotraceHR::Tracer tracer{"is based on"_t, category(), keyValue("type id", m_typeId)};
|
||||
|
||||
return m_projectStorage->isBasedOn(m_typeId, metaInfo1.m_typeId, metaInfo2.m_typeId);
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
if (majorVersion() == -1 && minorVersion() == -1)
|
||||
return (isSubclassOf(metaInfo1.typeName()) || isSubclassOf(metaInfo2.typeName()));
|
||||
|
||||
return (
|
||||
isSubclassOf(metaInfo1.typeName(), metaInfo1.majorVersion(), metaInfo1.minorVersion())
|
||||
return (isSubclassOf(metaInfo1.typeName(), metaInfo1.majorVersion(), metaInfo1.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(), metaInfo2.majorVersion(), metaInfo2.minorVersion()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
const NodeMetaInfo &metaInfo2,
|
||||
const NodeMetaInfo &metaInfo3) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -2459,18 +2471,17 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
metaInfo1.m_typeId,
|
||||
metaInfo2.m_typeId,
|
||||
metaInfo3.m_typeId);
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
if (majorVersion() == -1 && minorVersion() == -1)
|
||||
return (isSubclassOf(metaInfo1.typeName()) || isSubclassOf(metaInfo2.typeName())
|
||||
|| isSubclassOf(metaInfo3.typeName()));
|
||||
|
||||
return (
|
||||
isSubclassOf(metaInfo1.typeName(), metaInfo1.majorVersion(), metaInfo1.minorVersion())
|
||||
return (isSubclassOf(metaInfo1.typeName(), metaInfo1.majorVersion(), metaInfo1.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(), metaInfo2.majorVersion(), metaInfo2.minorVersion())
|
||||
|| isSubclassOf(metaInfo3.typeName(), metaInfo3.majorVersion(), metaInfo3.minorVersion()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
@@ -2478,7 +2489,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
const NodeMetaInfo &metaInfo3,
|
||||
const NodeMetaInfo &metaInfo4) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -2490,19 +2501,15 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
metaInfo2.m_typeId,
|
||||
metaInfo3.m_typeId,
|
||||
metaInfo4.m_typeId);
|
||||
} else {
|
||||
#else
|
||||
return isValid()
|
||||
&& (isSubclassOf(metaInfo1.typeName(), metaInfo1.majorVersion(), metaInfo1.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(),
|
||||
metaInfo2.majorVersion(),
|
||||
metaInfo2.minorVersion())
|
||||
|| isSubclassOf(metaInfo3.typeName(),
|
||||
metaInfo3.majorVersion(),
|
||||
metaInfo3.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(), metaInfo2.majorVersion(), metaInfo2.minorVersion())
|
||||
|| isSubclassOf(metaInfo3.typeName(), metaInfo3.majorVersion(), metaInfo3.minorVersion())
|
||||
|| isSubclassOf(metaInfo4.typeName(),
|
||||
metaInfo4.majorVersion(),
|
||||
metaInfo4.minorVersion()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
@@ -2511,7 +2518,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
const NodeMetaInfo &metaInfo4,
|
||||
const NodeMetaInfo &metaInfo5) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -2524,22 +2531,16 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
metaInfo3.m_typeId,
|
||||
metaInfo4.m_typeId,
|
||||
metaInfo5.m_typeId);
|
||||
} else {
|
||||
#else
|
||||
return isValid()
|
||||
&& (isSubclassOf(metaInfo1.typeName(), metaInfo1.majorVersion(), metaInfo1.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(),
|
||||
metaInfo2.majorVersion(),
|
||||
metaInfo2.minorVersion())
|
||||
|| isSubclassOf(metaInfo3.typeName(),
|
||||
metaInfo3.majorVersion(),
|
||||
metaInfo3.minorVersion())
|
||||
|| isSubclassOf(metaInfo4.typeName(),
|
||||
metaInfo4.majorVersion(),
|
||||
metaInfo4.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(), metaInfo2.majorVersion(), metaInfo2.minorVersion())
|
||||
|| isSubclassOf(metaInfo3.typeName(), metaInfo3.majorVersion(), metaInfo3.minorVersion())
|
||||
|| isSubclassOf(metaInfo4.typeName(), metaInfo4.majorVersion(), metaInfo4.minorVersion())
|
||||
|| isSubclassOf(metaInfo5.typeName(),
|
||||
metaInfo5.majorVersion(),
|
||||
metaInfo5.minorVersion()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
@@ -2549,7 +2550,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
const NodeMetaInfo &metaInfo5,
|
||||
const NodeMetaInfo &metaInfo6) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -2563,25 +2564,17 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
metaInfo4.m_typeId,
|
||||
metaInfo5.m_typeId,
|
||||
metaInfo6.m_typeId);
|
||||
} else {
|
||||
#else
|
||||
return isValid()
|
||||
&& (isSubclassOf(metaInfo1.typeName(), metaInfo1.majorVersion(), metaInfo1.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(),
|
||||
metaInfo2.majorVersion(),
|
||||
metaInfo2.minorVersion())
|
||||
|| isSubclassOf(metaInfo3.typeName(),
|
||||
metaInfo3.majorVersion(),
|
||||
metaInfo3.minorVersion())
|
||||
|| isSubclassOf(metaInfo4.typeName(),
|
||||
metaInfo4.majorVersion(),
|
||||
metaInfo4.minorVersion())
|
||||
|| isSubclassOf(metaInfo5.typeName(),
|
||||
metaInfo5.majorVersion(),
|
||||
metaInfo5.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(), metaInfo2.majorVersion(), metaInfo2.minorVersion())
|
||||
|| isSubclassOf(metaInfo3.typeName(), metaInfo3.majorVersion(), metaInfo3.minorVersion())
|
||||
|| isSubclassOf(metaInfo4.typeName(), metaInfo4.majorVersion(), metaInfo4.minorVersion())
|
||||
|| isSubclassOf(metaInfo5.typeName(), metaInfo5.majorVersion(), metaInfo5.minorVersion())
|
||||
|| isSubclassOf(metaInfo6.typeName(),
|
||||
metaInfo6.majorVersion(),
|
||||
metaInfo6.minorVersion()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
@@ -2592,7 +2585,7 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
const NodeMetaInfo &metaInfo6,
|
||||
const NodeMetaInfo &metaInfo7) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -2607,28 +2600,18 @@ bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
metaInfo5.m_typeId,
|
||||
metaInfo6.m_typeId,
|
||||
metaInfo7.m_typeId);
|
||||
} else {
|
||||
#else
|
||||
return isValid()
|
||||
&& (isSubclassOf(metaInfo1.typeName(), metaInfo1.majorVersion(), metaInfo1.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(),
|
||||
metaInfo2.majorVersion(),
|
||||
metaInfo2.minorVersion())
|
||||
|| isSubclassOf(metaInfo3.typeName(),
|
||||
metaInfo3.majorVersion(),
|
||||
metaInfo3.minorVersion())
|
||||
|| isSubclassOf(metaInfo4.typeName(),
|
||||
metaInfo4.majorVersion(),
|
||||
metaInfo4.minorVersion())
|
||||
|| isSubclassOf(metaInfo5.typeName(),
|
||||
metaInfo5.majorVersion(),
|
||||
metaInfo5.minorVersion())
|
||||
|| isSubclassOf(metaInfo6.typeName(),
|
||||
metaInfo6.majorVersion(),
|
||||
metaInfo6.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(), metaInfo2.majorVersion(), metaInfo2.minorVersion())
|
||||
|| isSubclassOf(metaInfo3.typeName(), metaInfo3.majorVersion(), metaInfo3.minorVersion())
|
||||
|| isSubclassOf(metaInfo4.typeName(), metaInfo4.majorVersion(), metaInfo4.minorVersion())
|
||||
|| isSubclassOf(metaInfo5.typeName(), metaInfo5.majorVersion(), metaInfo5.minorVersion())
|
||||
|| isSubclassOf(metaInfo6.typeName(), metaInfo6.majorVersion(), metaInfo6.minorVersion())
|
||||
|| isSubclassOf(metaInfo7.typeName(),
|
||||
metaInfo7.majorVersion(),
|
||||
metaInfo7.minorVersion()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isGraphicalItem() const
|
||||
@@ -2673,20 +2656,18 @@ bool NodeMetaInfo::isQtObject() const
|
||||
|
||||
bool NodeMetaInfo::isQtQmlConnections() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"is Qt Qml connections"_t,
|
||||
category(),
|
||||
keyValue("type id", m_typeId)};
|
||||
NanotraceHR::Tracer tracer{"is Qt Qml connections"_t, category(), keyValue("type id", m_typeId)};
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQml, Connections>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
#else
|
||||
return isValid() && simplifiedTypeName() == "Connections";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isLayoutable() const
|
||||
@@ -2753,7 +2734,7 @@ bool NodeMetaInfo::isView() const
|
||||
|
||||
bool NodeMetaInfo::usesCustomParser() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -2761,14 +2742,14 @@ bool NodeMetaInfo::usesCustomParser() const
|
||||
NanotraceHR::Tracer tracer{"uses custom parser"_t, category(), keyValue("type id", m_typeId)};
|
||||
|
||||
return typeData().traits.usesCustomParser;
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
auto type = simplifiedTypeName();
|
||||
return type == "VisualItemModel" || type == "VisualDataModel" || type == "ListModel"
|
||||
|| type == "XmlListModel";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -3123,6 +3104,23 @@ bool NodeMetaInfo::isQtQuickPropertyAnimation() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickRectangle() const
|
||||
{
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"is QtQuick.Rectange"_t, category(), keyValue("type id", m_typeId)};
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, Rectangle>(m_projectStorage, m_typeId);
|
||||
#else
|
||||
return isValid() && isSubclassOf("QtQuick.Rectangle");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickRepeater() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
@@ -3157,6 +3155,24 @@ bool NodeMetaInfo::isQtQuickControlsTabBar() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickControlsLabel() const
|
||||
{
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
using NanotraceHR::keyValue;
|
||||
NanotraceHR::Tracer tracer{"is QtQuick.Controls.SwipeView"_t,
|
||||
category(),
|
||||
keyValue("type id", m_typeId)};
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Controls, Label>(m_projectStorage, m_typeId);
|
||||
#else
|
||||
return isValid() && isSubclassOf("QtQuick.Controls.Label");
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickControlsSwipeView() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
@@ -3744,7 +3760,7 @@ bool NodeMetaInfo::isQtQuickStudioUtilsJsonListModel() const
|
||||
|
||||
bool NodeMetaInfo::isQmlComponent() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -3753,19 +3769,19 @@ bool NodeMetaInfo::isQmlComponent() const
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QML, Component>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
auto type = simplifiedTypeName();
|
||||
|
||||
return type == "Component" || type == "QQmlComponent";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isFont() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -3774,14 +3790,14 @@ bool NodeMetaInfo::isFont() const
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isValid() && isTypeId(m_typeId, m_projectStorage->commonTypeId<QtQuick, font>());
|
||||
} else {
|
||||
#else
|
||||
return isValid() && simplifiedTypeName() == "font";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isColor() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -3790,19 +3806,19 @@ bool NodeMetaInfo::isColor() const
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isValid() && isTypeId(m_typeId, m_projectStorage->builtinTypeId<QColor>());
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
auto type = simplifiedTypeName();
|
||||
|
||||
return type == "QColor" || type == "color" || type == "color";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isBool() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -3811,19 +3827,19 @@ bool NodeMetaInfo::isBool() const
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isValid() && isTypeId(m_typeId, m_projectStorage->builtinTypeId<bool>());
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
auto type = simplifiedTypeName();
|
||||
|
||||
return type == "bool" || type == "boolean";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isInteger() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -3832,19 +3848,19 @@ bool NodeMetaInfo::isInteger() const
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isValid() && isTypeId(m_typeId, m_projectStorage->builtinTypeId<int>());
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
auto type = simplifiedTypeName();
|
||||
|
||||
return type == "int" || type == "integer" || type == "uint";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isFloat() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -3856,19 +3872,19 @@ bool NodeMetaInfo::isFloat() const
|
||||
auto doubleId = m_projectStorage->builtinTypeId<double>();
|
||||
|
||||
return isTypeId(m_typeId, floatId, doubleId);
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
auto type = simplifiedTypeName();
|
||||
|
||||
return type == "qreal" || type == "double" || type == "float" || type == "real";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isVariant() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -3877,19 +3893,19 @@ bool NodeMetaInfo::isVariant() const
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isValid() && isTypeId(m_typeId, m_projectStorage->builtinTypeId<QVariant>());
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
const auto type = simplifiedTypeName();
|
||||
|
||||
return type == "QVariant" || type == "var" || type == "variant";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isString() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -3898,19 +3914,19 @@ bool NodeMetaInfo::isString() const
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isValid() && isTypeId(m_typeId, m_projectStorage->builtinTypeId<QString>());
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
auto type = simplifiedTypeName();
|
||||
|
||||
return type == "string" || type == "QString";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isUrl() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
@@ -3919,14 +3935,14 @@ bool NodeMetaInfo::isUrl() const
|
||||
|
||||
using namespace Storage::Info;
|
||||
return isValid() && isTypeId(m_typeId, m_projectStorage->builtinTypeId<QUrl>());
|
||||
} else {
|
||||
#else
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
auto type = simplifiedTypeName();
|
||||
|
||||
return type == "url" || type == "QUrl";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DTexture() const
|
||||
@@ -4249,7 +4265,7 @@ PropertyMetaInfo::~PropertyMetaInfo() = default;
|
||||
|
||||
NodeMetaInfo PropertyMetaInfo::propertyType() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return {};
|
||||
|
||||
@@ -4259,20 +4275,20 @@ NodeMetaInfo PropertyMetaInfo::propertyType() const
|
||||
keyValue("property declaration id", m_id)};
|
||||
|
||||
return {propertyData().propertyTypeId, m_projectStorage};
|
||||
} else {
|
||||
#else
|
||||
if (isValid())
|
||||
return NodeMetaInfo{nodeMetaInfoPrivateData()->model(),
|
||||
nodeMetaInfoPrivateData()->propertyType(propertyName()),
|
||||
-1,
|
||||
-1};
|
||||
}
|
||||
#endif
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
NodeMetaInfo PropertyMetaInfo::type() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (!isValid())
|
||||
return {};
|
||||
|
||||
@@ -4282,7 +4298,7 @@ NodeMetaInfo PropertyMetaInfo::type() const
|
||||
keyValue("property declaration id", m_id)};
|
||||
|
||||
return NodeMetaInfo(propertyData().typeId, m_projectStorage);
|
||||
}
|
||||
#endif
|
||||
|
||||
return {};
|
||||
}
|
||||
@@ -4530,7 +4546,11 @@ const Storage::Info::PropertyDeclaration &PropertyMetaInfo::propertyData() const
|
||||
|
||||
TypeName PropertyMetaInfo::propertyTypeName() const
|
||||
{
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
return propertyType().typeName();
|
||||
#else
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
const NodeMetaInfoPrivate *PropertyMetaInfo::nodeMetaInfoPrivateData() const
|
||||
@@ -4554,7 +4574,7 @@ const PropertyName &PropertyMetaInfo::propertyName() const
|
||||
|
||||
NodeMetaInfo NodeMetaInfo::commonBase(const NodeMetaInfo &metaInfo) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (isValid() && metaInfo) {
|
||||
const auto firstTypeIds = m_projectStorage->prototypeAndSelfIds(m_typeId);
|
||||
const auto secondTypeIds = m_projectStorage->prototypeAndSelfIds(metaInfo.m_typeId);
|
||||
@@ -4562,29 +4582,28 @@ NodeMetaInfo NodeMetaInfo::commonBase(const NodeMetaInfo &metaInfo) const
|
||||
return std::ranges::find(secondTypeIds, firstTypeId) != secondTypeIds.end();
|
||||
});
|
||||
|
||||
if (found != firstTypeIds.end()) {
|
||||
if (found != firstTypeIds.end())
|
||||
return NodeMetaInfo{*found, m_projectStorage};
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#else
|
||||
for (const NodeMetaInfo &info : metaInfo.selfAndPrototypes()) {
|
||||
if (isBasedOn(info)) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
NodeMetaInfo::NodeMetaInfos NodeMetaInfo::heirs() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
if (isValid()) {
|
||||
return Utils::transform<NodeMetaInfos>(m_projectStorage->heirIds(m_typeId),
|
||||
NodeMetaInfo::bind(m_projectStorage));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@@ -1788,6 +1788,7 @@ Model::Model(ProjectStorageDependencies projectStorageDependencies,
|
||||
std::move(resourceManagement)))
|
||||
{}
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
Model::Model(const TypeName &typeName,
|
||||
int major,
|
||||
int minor,
|
||||
@@ -1796,6 +1797,7 @@ Model::Model(const TypeName &typeName,
|
||||
: d(std::make_unique<Internal::ModelPrivate>(
|
||||
this, typeName, major, minor, metaInfoProxyModel, std::move(resourceManagement)))
|
||||
{}
|
||||
#endif
|
||||
|
||||
ModelPointer Model::createModel(const TypeName &typeName,
|
||||
std::unique_ptr<ModelResourceManagementInterface> resourceManagement)
|
||||
@@ -2480,6 +2482,16 @@ NodeMetaInfo Model::qtQuickTextEditMetaInfo() const
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickControlsLabelMetaInfo() const
|
||||
{
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick_Controls, Label>();
|
||||
#else
|
||||
return metaInfo("QtQuick.Controls.Label");
|
||||
#endif
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickControlsTextAreaMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
@@ -2773,24 +2785,26 @@ namespace {
|
||||
}
|
||||
} // namespace
|
||||
|
||||
NodeMetaInfo Model::metaInfo(const TypeName &typeName, int majorVersion, int minorVersion) const
|
||||
NodeMetaInfo Model::metaInfo(const TypeName &typeName,
|
||||
[[maybe_unused]] int majorVersion,
|
||||
[[maybe_unused]] int minorVersion) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
return NodeMetaInfo(d->projectStorage->typeId(d->importedTypeNameId(typeName)),
|
||||
d->projectStorage);
|
||||
} else {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
return NodeMetaInfo(d->projectStorage->typeId(d->importedTypeNameId(typeName)), d->projectStorage);
|
||||
#else
|
||||
return NodeMetaInfo(metaInfoProxyModel(), typeName, majorVersion, minorVersion);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::metaInfo(Module module, Utils::SmallStringView typeName, Storage::Version version) const
|
||||
NodeMetaInfo Model::metaInfo([[maybe_unused]] Module module,
|
||||
[[maybe_unused]] Utils::SmallStringView typeName,
|
||||
[[maybe_unused]] Storage::Version version) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
return NodeMetaInfo(d->projectStorage->typeId(module.id(), typeName, version),
|
||||
d->projectStorage);
|
||||
} else {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
return NodeMetaInfo(d->projectStorage->typeId(module.id(), typeName, version), d->projectStorage);
|
||||
#else
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
|
@@ -687,14 +687,14 @@ NodeMetaInfo ModelNode::metaInfo() const
|
||||
if (!isValid())
|
||||
return {};
|
||||
|
||||
if constexpr (useProjectStorage()) {
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
return NodeMetaInfo(m_internalNode->typeId, m_model->projectStorage());
|
||||
} else {
|
||||
#else
|
||||
return NodeMetaInfo(m_model->metaInfoProxyModel(),
|
||||
m_internalNode->typeName,
|
||||
m_internalNode->majorVersion,
|
||||
m_internalNode->minorVersion);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ModelNode::hasMetaInfo() const
|
||||
|
@@ -58,6 +58,7 @@ inline constexpr char Item[] = "Item";
|
||||
inline constexpr char JsonListModel[] = "JsonListModel";
|
||||
inline constexpr char KeyframeGroup[] = "KeyframeGroup";
|
||||
inline constexpr char Keyframe[] = "Keyframe";
|
||||
inline constexpr char Label[] = "Label";
|
||||
inline constexpr char Layout[] = "Layout";
|
||||
inline constexpr char Light[] = "Light";
|
||||
inline constexpr char ListElement[] = "ListElement";
|
||||
@@ -236,6 +237,7 @@ class CommonTypeCache
|
||||
CacheType<QtQuick3D_Particles3D, ModuleKind::QmlLibrary, SpriteParticle3D>,
|
||||
CacheType<QtQuick3D_Particles3D, ModuleKind::CppLibrary, QQuick3DParticleAbstractShape>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, Control>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, Label>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, Popup>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, SplitView>,
|
||||
CacheType<QtQuick_Controls, ModuleKind::QmlLibrary, SwipeView>,
|
||||
|
@@ -705,6 +705,11 @@ Internal::DesignModeWidget *QmlDesignerPlugin::mainWidget() const
|
||||
return d ? &d->mainWidget : nullptr;
|
||||
}
|
||||
|
||||
QmlDesignerProjectManager &QmlDesignerPlugin::projectManagerForPluginInitializationOnly()
|
||||
{
|
||||
return m_instance->d->projectManager;
|
||||
}
|
||||
|
||||
QWidget *QmlDesignerPlugin::createProjectExplorerWidget(QWidget *parent) const
|
||||
{
|
||||
return Internal::DesignModeWidget::createProjectExplorerWidget(parent);
|
||||
|
@@ -60,6 +60,8 @@ public:
|
||||
DesignDocument *currentDesignDocument() const;
|
||||
Internal::DesignModeWidget *mainWidget() const;
|
||||
|
||||
static QmlDesignerProjectManager &projectManagerForPluginInitializationOnly();
|
||||
|
||||
QWidget *createProjectExplorerWidget(QWidget *parent) const;
|
||||
|
||||
void switchToTextModeDeferred();
|
||||
|
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "modelfwd.h"
|
||||
#include <projectstoragefwd.h>
|
||||
#include <qmldesigner_global.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
@@ -28,7 +29,7 @@ namespace QmlDesigner {
|
||||
|
||||
class ExternalDependenciesInterface;
|
||||
|
||||
class QmlDesignerProjectManager
|
||||
class QMLDESIGNER_EXPORT QmlDesignerProjectManager
|
||||
{
|
||||
class QmlDesignerProjectManagerProjectData;
|
||||
class PreviewImageCacheData;
|
||||
|
Reference in New Issue
Block a user