QmlDesigner: Drag and drop is now working with project storage

Type annotaions are now saving the type name and dropInFormEditor is by
default true.

Task-number: QDS-12450
Change-Id: I757f59b296de321c4d0190a36ec581379f646735
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2024-04-29 14:19:16 +02:00
parent cae233f5db
commit 15f05d0bbc
22 changed files with 177 additions and 119 deletions

View File

@@ -350,11 +350,10 @@ void Edit3DView::handleEntriesChanged()
{EK_importedModels, {tr("Imported Models"), contextIcon(DesignerIcons::ImportedModelsIcon)}}}; {EK_importedModels, {tr("Imported Models"), contextIcon(DesignerIcons::ImportedModelsIcon)}}};
#ifdef QDS_USE_PROJECTSTORAGE #ifdef QDS_USE_PROJECTSTORAGE
const auto &projectStorage = *model()->projectStorage();
auto append = [&](const NodeMetaInfo &metaInfo, ItemLibraryEntryKeys key) { auto append = [&](const NodeMetaInfo &metaInfo, ItemLibraryEntryKeys key) {
auto entries = metaInfo.itemLibrariesEntries(); auto entries = metaInfo.itemLibrariesEntries();
if (entries.size()) if (entries.size())
entriesMap[key].entryList.append(toItemLibraryEntries(entries, projectStorage)); entriesMap[key].entryList.append(toItemLibraryEntries(entries));
}; };
append(model()->qtQuick3DModelMetaInfo(), EK_primitives); append(model()->qtQuick3DModelMetaInfo(), EK_primitives);
@@ -386,9 +385,12 @@ void Edit3DView::handleEntriesChanged()
} else if (entry.typeName() == "QtQuick3D.OrthographicCamera" } else if (entry.typeName() == "QtQuick3D.OrthographicCamera"
|| entry.typeName() == "QtQuick3D.PerspectiveCamera") { || entry.typeName() == "QtQuick3D.PerspectiveCamera") {
entryKey = EK_cameras; entryKey = EK_cameras;
} else if (entry.typeName().startsWith(QmlDesignerPlugin::instance()->documentManager() } else if (entry.typeName().startsWith(QmlDesignerPlugin::instance()
.generatedComponentUtils().import3dTypePrefix().toUtf8()) ->documentManager()
&& NodeHints::fromItemLibraryEntry(entry).canBeDroppedInView3D()) { .generatedComponentUtils()
.import3dTypePrefix()
.toUtf8())
&& NodeHints::fromItemLibraryEntry(entry, model()).canBeDroppedInView3D()) {
entryKey = EK_importedModels; entryKey = EK_importedModels;
} else { } else {
continue; continue;

View File

@@ -694,7 +694,7 @@ void Edit3DWidget::dragEnterEvent(QDragEnterEvent *dragEnterEvent)
if (!data.isEmpty()) { if (!data.isEmpty()) {
QDataStream stream(data); QDataStream stream(data);
stream >> m_draggedEntry; stream >> m_draggedEntry;
if (NodeHints::fromItemLibraryEntry(m_draggedEntry).canBeDroppedInView3D()) if (NodeHints::fromItemLibraryEntry(m_draggedEntry, view()->model()).canBeDroppedInView3D())
dragEnterEvent->acceptProposedAction(); dragEnterEvent->acceptProposedAction();
} }
} }
@@ -773,7 +773,7 @@ void Edit3DWidget::dropEvent(QDropEvent *dropEvent)
auto moduleId = model->module(import3dTypePrefix, Storage::ModuleKind::QmlLibrary); auto moduleId = model->module(import3dTypePrefix, Storage::ModuleKind::QmlLibrary);
auto metaInfo = model->metaInfo(moduleId, fileName.toUtf8()); auto metaInfo = model->metaInfo(moduleId, fileName.toUtf8());
if (auto entries = metaInfo.itemLibrariesEntries(); entries.size()) { if (auto entries = metaInfo.itemLibrariesEntries(); entries.size()) {
auto entry = ItemLibraryEntry{entries.front(), *model->projectStorage()}; auto entry = ItemLibraryEntry{entries.front()};
QmlVisualNode::createQml3DNode(view(), entry, m_canvas->activeScene(), {}, false); QmlVisualNode::createQml3DNode(view(), entry, m_canvas->activeScene(), {}, false);
} }
} }

View File

@@ -206,9 +206,16 @@ static ItemLibraryEntry itemLibraryEntryFromMimeData(const QMimeData *mimeData)
return itemLibraryEntry; return itemLibraryEntry;
} }
static bool canBeDropped(const QMimeData *mimeData) static bool canBeDropped(const QMimeData *mimeData, Model *model)
{ {
return NodeHints::fromItemLibraryEntry(itemLibraryEntryFromMimeData(mimeData)).canBeDroppedInFormEditor(); #ifdef QDS_USE_PROJECTSTORAGE
auto itemLibraryEntry = itemLibraryEntryFromMimeData(mimeData);
NodeMetaInfo metaInfo{itemLibraryEntry.typeId(), model->projectStorage()};
return metaInfo.canBeDroppedInFormEditor() == FlagIs::True;
#else
return NodeHints::fromItemLibraryEntry(itemLibraryEntryFromMimeData(mimeData), model)
.canBeDroppedInFormEditor();
#endif
} }
static bool hasItemLibraryInfo(const QMimeData *mimeData) static bool hasItemLibraryInfo(const QMimeData *mimeData)
@@ -218,7 +225,7 @@ static bool hasItemLibraryInfo(const QMimeData *mimeData)
void DragTool::dropEvent(const QList<QGraphicsItem *> &itemList, QGraphicsSceneDragDropEvent *event) void DragTool::dropEvent(const QList<QGraphicsItem *> &itemList, QGraphicsSceneDragDropEvent *event)
{ {
if (canBeDropped(event->mimeData())) { if (canBeDropped(event->mimeData(), view()->model())) {
event->accept(); event->accept();
end(generateUseSnapping(event->modifiers())); end(generateUseSnapping(event->modifiers()));
@@ -290,7 +297,7 @@ void DragTool::dropEvent(const QList<QGraphicsItem *> &itemList, QGraphicsSceneD
void DragTool::dragEnterEvent(const QList<QGraphicsItem *> &/*itemList*/, QGraphicsSceneDragDropEvent *event) void DragTool::dragEnterEvent(const QList<QGraphicsItem *> &/*itemList*/, QGraphicsSceneDragDropEvent *event)
{ {
if (canBeDropped(event->mimeData())) { if (canBeDropped(event->mimeData(), view()->model())) {
m_blockMove = false; m_blockMove = false;
if (hasItemLibraryInfo(event->mimeData())) { if (hasItemLibraryInfo(event->mimeData())) {
@@ -306,7 +313,7 @@ void DragTool::dragEnterEvent(const QList<QGraphicsItem *> &/*itemList*/, QGraph
void DragTool::dragLeaveEvent(const QList<QGraphicsItem *> &/*itemList*/, QGraphicsSceneDragDropEvent *event) void DragTool::dragLeaveEvent(const QList<QGraphicsItem *> &/*itemList*/, QGraphicsSceneDragDropEvent *event)
{ {
if (canBeDropped(event->mimeData())) { if (canBeDropped(event->mimeData(), view()->model())) {
event->accept(); event->accept();
m_moveManipulator.end(); m_moveManipulator.end();
@@ -363,9 +370,7 @@ void DragTool::dragMoveEvent(const QList<QGraphicsItem *> &itemList, QGraphicsSc
->data(Constants::MIME_TYPE_ASSETS)).split(','); ->data(Constants::MIME_TYPE_ASSETS)).split(',');
QString assetType = AssetsLibraryWidget::getAssetTypeAndData(assetPaths[0]).first; QString assetType = AssetsLibraryWidget::getAssetTypeAndData(assetPaths[0]).first;
if (!m_blockMove if (!m_blockMove && !m_isAborted && canBeDropped(event->mimeData(), view()->model())
&& !m_isAborted
&& canBeDropped(event->mimeData())
&& assetType != Constants::MIME_TYPE_ASSET_EFFECT) { && assetType != Constants::MIME_TYPE_ASSET_EFFECT) {
event->accept(); event->accept();
if (!m_dragNodes.isEmpty()) { if (!m_dragNodes.isEmpty()) {

View File

@@ -376,7 +376,7 @@ void ItemLibraryModel::update(Model *model)
NodeMetaInfo metaInfo; NodeMetaInfo metaInfo;
if constexpr (useProjectStorage()) if constexpr (useProjectStorage())
metaInfo = entry.metaInfo(); metaInfo = NodeMetaInfo{entry.typeId(), model->projectStorage()};
else else
metaInfo = model->metaInfo(entry.typeName()); metaInfo = model->metaInfo(entry.typeName());
@@ -388,7 +388,8 @@ void ItemLibraryModel::update(Model *model)
|| metaInfo.majorVersion() < 0); || metaInfo.majorVersion() < 0);
#endif #endif
bool isItem = valid && metaInfo.isQtQuickItem(); bool isItem = valid && metaInfo.isQtQuickItem();
bool forceVisibility = valid && NodeHints::fromItemLibraryEntry(entry).visibleInLibrary(); bool forceVisibility = valid
&& NodeHints::fromItemLibraryEntry(entry, model).visibleInLibrary();
if (m_flowMode) { if (m_flowMode) {
isItem = metaInfo.isFlowViewItem(); isItem = metaInfo.isFlowViewItem();

View File

@@ -716,7 +716,7 @@ void MaterialEditorView::updatePossibleTypes()
auto heirs = model()->qtQuick3DMaterialMetaInfo().heirs(); auto heirs = model()->qtQuick3DMaterialMetaInfo().heirs();
heirs.push_back(model()->qtQuick3DMaterialMetaInfo()); heirs.push_back(model()->qtQuick3DMaterialMetaInfo());
auto entries = Utils::transform<ItemLibraryEntries>(heirs, [&](const auto &heir) { auto entries = Utils::transform<ItemLibraryEntries>(heirs, [&](const auto &heir) {
return toItemLibraryEntries(heir.itemLibrariesEntries(), *model()->projectStorage()); return toItemLibraryEntries(heir.itemLibrariesEntries());
}); });
// I am unsure about the code intention here // I am unsure about the code intention here

View File

@@ -705,7 +705,7 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in
const ItemLibraryEntry itemLibraryEntry = const ItemLibraryEntry itemLibraryEntry =
createItemLibraryEntryFromMimeData(mimeData->data(Constants::MIME_TYPE_ITEM_LIBRARY_INFO)); createItemLibraryEntryFromMimeData(mimeData->data(Constants::MIME_TYPE_ITEM_LIBRARY_INFO));
const NodeHints hints = NodeHints::fromItemLibraryEntry(itemLibraryEntry); const NodeHints hints = NodeHints::fromItemLibraryEntry(itemLibraryEntry, m_view->model());
const QString targetPropertyName = hints.forceNonDefaultProperty(); const QString targetPropertyName = hints.forceNonDefaultProperty();

View File

@@ -42,13 +42,16 @@ class QMLDESIGNERCORE_EXPORT ItemLibraryEntry
public: public:
ItemLibraryEntry(); ItemLibraryEntry();
explicit ItemLibraryEntry(const Storage::Info::ItemLibraryEntry &entry, ItemLibraryEntry(const ItemLibraryEntry &) = default;
const ProjectStorageType &projectStorage); ItemLibraryEntry &operator=(const ItemLibraryEntry &) = default;
~ItemLibraryEntry() = default; ItemLibraryEntry(ItemLibraryEntry &&) = default;
ItemLibraryEntry &operator=(ItemLibraryEntry &&) = default;
explicit ItemLibraryEntry(const Storage::Info::ItemLibraryEntry &entry);
~ItemLibraryEntry();
QString name() const; QString name() const;
TypeName typeName() const; TypeName typeName() const;
const NodeMetaInfo &metaInfo() const; TypeId typeId() const;
QIcon typeIcon() const; QIcon typeIcon() const;
QString libraryEntryIconPath() const; QString libraryEntryIconPath() const;
int majorVersion() const; int majorVersion() const;
@@ -86,7 +89,7 @@ private:
using ItemLibraryEntries = QList<ItemLibraryEntry>; using ItemLibraryEntries = QList<ItemLibraryEntry>;
QMLDESIGNERCORE_EXPORT QList<ItemLibraryEntry> toItemLibraryEntries( QMLDESIGNERCORE_EXPORT QList<ItemLibraryEntry> toItemLibraryEntries(
const Storage::Info::ItemLibraryEntries &entries, const ProjectStorageType &projectStorage); const Storage::Info::ItemLibraryEntries &entries);
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -3,9 +3,11 @@
#pragma once #pragma once
#include "modelnode.h"
#include "nodemetainfo.h"
#include <QList> #include <QList>
#include <QString> #include <QString>
#include "modelnode.h"
#include "qmldesignercorelib_global.h" #include "qmldesignercorelib_global.h"
#include "invalidmetainfoexception.h" #include "invalidmetainfoexception.h"
@@ -54,18 +56,19 @@ public:
QHash<QString, QString> hints() const; QHash<QString, QString> hints() const;
static NodeHints fromModelNode(const ModelNode &modelNode); static NodeHints fromModelNode(const ModelNode &modelNode);
static NodeHints fromItemLibraryEntry(const ItemLibraryEntry &entry); static NodeHints fromItemLibraryEntry(const ItemLibraryEntry &entry, Model *model);
private: private:
explicit NodeHints(const ModelNode &modelNode); explicit NodeHints(const ModelNode &modelNode);
explicit NodeHints(const NodeMetaInfo &metaInfo); explicit NodeHints(const NodeMetaInfo &metaInfo);
explicit NodeHints(const ItemLibraryEntry &entry); explicit NodeHints(const ItemLibraryEntry &entry, Model *model);
const ModelNode &modelNode() const; const ModelNode &modelNode() const;
bool isValid() const; bool isValid() const;
Model *model() const; Model *model() const;
bool evaluateBooleanExpression(const QString &hintName, bool defaultValue, const ModelNode potentialParent = ModelNode()) const; bool evaluateBooleanExpression(const QString &hintName, bool defaultValue, const ModelNode potentialParent = ModelNode()) const;
ModelNode m_modelNode; ModelNode m_modelNode;
NodeMetaInfo m_metaInfo;
QHash<QString, QString> m_hints; QHash<QString, QString> m_hints;
}; };

View File

@@ -22,7 +22,7 @@ class ItemLibraryEntryData
public: public:
QString name; QString name;
TypeName typeName; TypeName typeName;
NodeMetaInfo metaInfo; TypeId typeId;
QString category; QString category;
int majorVersion{-1}; int majorVersion{-1};
int minorVersion{-1}; int minorVersion{-1};
@@ -64,12 +64,12 @@ ItemLibraryEntry::ItemLibraryEntry()
: m_data(std::make_shared<Internal::ItemLibraryEntryData>()) : m_data(std::make_shared<Internal::ItemLibraryEntryData>())
{} {}
ItemLibraryEntry::ItemLibraryEntry(const Storage::Info::ItemLibraryEntry &entry, ItemLibraryEntry::ItemLibraryEntry(const Storage::Info::ItemLibraryEntry &entry)
const ProjectStorageType &projectStorage)
: ItemLibraryEntry{} : ItemLibraryEntry{}
{ {
m_data->name = entry.name.toQString(); m_data->name = entry.name.toQString();
m_data->metaInfo = {entry.typeId, &projectStorage}; m_data->typeId = entry.typeId;
m_data->typeName = entry.typeName.toQByteArray();
m_data->category = entry.category.toQString(); m_data->category = entry.category.toQString();
if (entry.iconPath.size()) if (entry.iconPath.size())
m_data->libraryEntryIconPath = entry.iconPath.toQString(); m_data->libraryEntryIconPath = entry.iconPath.toQString();
@@ -87,6 +87,8 @@ ItemLibraryEntry::ItemLibraryEntry(const Storage::Info::ItemLibraryEntry &entry,
m_data->extraFilePaths.emplace_back(extraFilePath.toQString()); m_data->extraFilePaths.emplace_back(extraFilePath.toQString());
} }
ItemLibraryEntry::~ItemLibraryEntry() = default;
QString ItemLibraryEntry::name() const QString ItemLibraryEntry::name() const
{ {
return m_data->name; return m_data->name;
@@ -97,9 +99,9 @@ TypeName ItemLibraryEntry::typeName() const
return m_data->typeName; return m_data->typeName;
} }
const NodeMetaInfo &ItemLibraryEntry::metaInfo() const TypeId ItemLibraryEntry::typeId() const
{ {
return m_data->metaInfo; return m_data->typeId;
} }
QString ItemLibraryEntry::qmlSource() const QString ItemLibraryEntry::qmlSource() const
@@ -245,6 +247,7 @@ QDataStream &operator<<(QDataStream &stream, const ItemLibraryEntry &itemLibrary
stream << itemLibraryEntry.m_data->qmlSource; stream << itemLibraryEntry.m_data->qmlSource;
stream << itemLibraryEntry.m_data->customComponentSource; stream << itemLibraryEntry.m_data->customComponentSource;
stream << itemLibraryEntry.m_data->extraFilePaths; stream << itemLibraryEntry.m_data->extraFilePaths;
stream << itemLibraryEntry.m_data->typeId.internalId();
return stream; return stream;
} }
@@ -270,6 +273,9 @@ QDataStream &operator>>(QDataStream &stream, ItemLibraryEntry &itemLibraryEntry)
stream >> itemLibraryEntry.m_data->qmlSource; stream >> itemLibraryEntry.m_data->qmlSource;
stream >> itemLibraryEntry.m_data->customComponentSource; stream >> itemLibraryEntry.m_data->customComponentSource;
stream >> itemLibraryEntry.m_data->extraFilePaths; stream >> itemLibraryEntry.m_data->extraFilePaths;
TypeId::DatabaseType internalTypeId;
stream >> internalTypeId;
itemLibraryEntry.m_data->typeId = TypeId::create(internalTypeId);
return stream; return stream;
} }
@@ -295,11 +301,10 @@ QDebug operator<<(QDebug debug, const ItemLibraryEntry &itemLibraryEntry)
return debug.space(); return debug.space();
} }
QList<ItemLibraryEntry> toItemLibraryEntries(const Storage::Info::ItemLibraryEntries &entries, QList<ItemLibraryEntry> toItemLibraryEntries(const Storage::Info::ItemLibraryEntries &entries)
const ProjectStorageType &projectStorage)
{ {
return Utils::transform<QList<ItemLibraryEntry>>(entries, [&](const auto &entry) { return Utils::transform<QList<ItemLibraryEntry>>(entries, [&](const auto &entry) {
return ItemLibraryEntry{entry, projectStorage}; return ItemLibraryEntry{entry};
}); });
} }

View File

@@ -106,14 +106,15 @@ QmlDesigner::NodeHints::NodeHints(const ModelNode &node)
} }
NodeHints::NodeHints(const NodeMetaInfo &metaInfo) NodeHints::NodeHints(const NodeMetaInfo &metaInfo)
: m_metaInfo{metaInfo}
{ {
for (const auto &[name, expression] : metaInfo.typeHints()) for (const auto &[name, expression] : metaInfo.typeHints())
m_hints.insert(name.toQString(), expression.toQString()); m_hints.insert(name.toQString(), expression.toQString());
} }
NodeHints::NodeHints(const ItemLibraryEntry &entry) NodeHints::NodeHints(const ItemLibraryEntry &entry, [[maybe_unused]] Model *model)
#ifdef QDS_USE_PROJECTSTORAGE #ifdef QDS_USE_PROJECTSTORAGE
: NodeHints{entry.metaInfo()} : NodeHints{NodeMetaInfo{entry.typeId(), model->projectStorage()}}
#endif #endif
{ {
if constexpr (!useProjectStorage()) if constexpr (!useProjectStorage())
@@ -135,7 +136,7 @@ bool NodeHints::canBeContainerFor(const ModelNode &potenialChild) const
if (!isValid()) if (!isValid())
return true; return true;
auto flagIs = m_modelNode.metaInfo().canBeContainer(); auto flagIs = m_metaInfo.canBeContainer();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -151,7 +152,7 @@ bool NodeHints::forceClip() const
if (isSwipeView(modelNode())) if (isSwipeView(modelNode()))
return true; return true;
auto flagIs = m_modelNode.metaInfo().forceClip(); auto flagIs = m_metaInfo.forceClip();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -167,7 +168,7 @@ bool NodeHints::doesLayoutChildren() const
if (isSwipeView(modelNode())) if (isSwipeView(modelNode()))
return true; return true;
auto flagIs = m_modelNode.metaInfo().doesLayoutChildren(); auto flagIs = m_metaInfo.doesLayoutChildren();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -177,7 +178,7 @@ bool NodeHints::doesLayoutChildren() const
bool NodeHints::canBeDroppedInFormEditor() const bool NodeHints::canBeDroppedInFormEditor() const
{ {
auto flagIs = m_modelNode.metaInfo().canBeDroppedInFormEditor(); auto flagIs = m_metaInfo.canBeDroppedInFormEditor();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -187,7 +188,7 @@ bool NodeHints::canBeDroppedInFormEditor() const
bool NodeHints::canBeDroppedInNavigator() const bool NodeHints::canBeDroppedInNavigator() const
{ {
auto flagIs = m_modelNode.metaInfo().canBeDroppedInNavigator(); auto flagIs = m_metaInfo.canBeDroppedInNavigator();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -197,7 +198,7 @@ bool NodeHints::canBeDroppedInNavigator() const
bool NodeHints::canBeDroppedInView3D() const bool NodeHints::canBeDroppedInView3D() const
{ {
auto flagIs = m_modelNode.metaInfo().canBeDroppedInView3D(); auto flagIs = m_metaInfo.canBeDroppedInView3D();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -210,7 +211,7 @@ bool NodeHints::isMovable() const
if (!isValid()) if (!isValid())
return true; return true;
auto flagIs = m_modelNode.metaInfo().isMovable(); auto flagIs = m_metaInfo.isMovable();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -223,7 +224,7 @@ bool NodeHints::isResizable() const
if (!isValid()) if (!isValid())
return true; return true;
auto flagIs = m_modelNode.metaInfo().isResizable(); auto flagIs = m_metaInfo.isResizable();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -236,7 +237,7 @@ bool NodeHints::hasFormEditorItem() const
if (!isValid()) if (!isValid())
return true; return true;
auto flagIs = m_modelNode.metaInfo().hasFormEditorItem(); auto flagIs = m_metaInfo.hasFormEditorItem();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -252,7 +253,7 @@ bool NodeHints::isStackedContainer() const
if (isSwipeView(modelNode())) if (isSwipeView(modelNode()))
return true; return true;
auto flagIs = m_modelNode.metaInfo().isStackedContainer(); auto flagIs = m_metaInfo.isStackedContainer();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -299,7 +300,7 @@ bool NodeHints::takesOverRenderingOfChildren() const
if (!isValid()) if (!isValid())
return false; return false;
auto flagIs = m_modelNode.metaInfo().takesOverRenderingOfChildren(); auto flagIs = m_metaInfo.takesOverRenderingOfChildren();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -312,7 +313,7 @@ bool NodeHints::visibleInNavigator() const
if (!isValid()) if (!isValid())
return false; return false;
auto flagIs = m_modelNode.metaInfo().visibleInNavigator(); auto flagIs = m_metaInfo.visibleInNavigator();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -322,7 +323,7 @@ bool NodeHints::visibleInNavigator() const
bool NodeHints::visibleInLibrary() const bool NodeHints::visibleInLibrary() const
{ {
auto flagIs = m_modelNode.metaInfo().visibleInLibrary(); auto flagIs = m_metaInfo.visibleInLibrary();
if (flagIs != FlagIs::Set) if (flagIs != FlagIs::Set)
return convert(flagIs); return convert(flagIs);
@@ -391,9 +392,9 @@ NodeHints NodeHints::fromModelNode(const ModelNode &modelNode)
return NodeHints(modelNode); return NodeHints(modelNode);
} }
NodeHints NodeHints::fromItemLibraryEntry(const ItemLibraryEntry &entry) NodeHints NodeHints::fromItemLibraryEntry(const ItemLibraryEntry &entry, Model *model)
{ {
return NodeHints(entry); return NodeHints(entry, model);
} }
const ModelNode &NodeHints::modelNode() const const ModelNode &NodeHints::modelNode() const

View File

@@ -2560,8 +2560,7 @@ QList<ItemLibraryEntry> Model::itemLibraryEntries() const
{ {
#ifdef QDS_USE_PROJECTSTORAGE #ifdef QDS_USE_PROJECTSTORAGE
using namespace Storage::Info; using namespace Storage::Info;
return toItemLibraryEntries(d->projectStorage->itemLibraryEntries(d->m_sourceId), return toItemLibraryEntries(d->projectStorage->itemLibraryEntries(d->m_sourceId));
*d->projectStorage);
#else #else
return d->metaInfo().itemLibraryInfo()->entries(); return d->metaInfo().itemLibraryInfo()->entries();
#endif #endif

View File

@@ -250,8 +250,7 @@ QmlObjectNode QmlVisualNode::createQmlObjectNode(AbstractView *view,
NodeAbstractProperty parentProperty = parentQmlItemNode.defaultNodeAbstractProperty(); NodeAbstractProperty parentProperty = parentQmlItemNode.defaultNodeAbstractProperty();
NodeHints hints = NodeHints::fromItemLibraryEntry(itemLibraryEntry, view->model());
NodeHints hints = NodeHints::fromItemLibraryEntry(itemLibraryEntry);
const PropertyName forceNonDefaultProperty = hints.forceNonDefaultProperty().toUtf8(); const PropertyName forceNonDefaultProperty = hints.forceNonDefaultProperty().toUtf8();
QmlObjectNode newNode = QmlItemNode::createQmlObjectNode(view, QmlObjectNode newNode = QmlItemNode::createQmlObjectNode(view,
@@ -329,7 +328,7 @@ QmlObjectNode QmlVisualNode::createQmlObjectNode(AbstractView *view,
{ {
QmlObjectNode newQmlObjectNode; QmlObjectNode newQmlObjectNode;
NodeHints hints = NodeHints::fromItemLibraryEntry(itemLibraryEntry); NodeHints hints = NodeHints::fromItemLibraryEntry(itemLibraryEntry, view->model());
auto createNodeFunc = [=, &newQmlObjectNode, &parentProperty]() { auto createNodeFunc = [=, &newQmlObjectNode, &parentProperty]() {
#ifndef QDS_USE_PROJECTSTORAGE #ifndef QDS_USE_PROJECTSTORAGE
@@ -361,13 +360,17 @@ QmlObjectNode QmlVisualNode::createQmlObjectNode(AbstractView *view,
propertyPairList.append(position.propertyPairList()); propertyPairList.append(position.propertyPairList());
ModelNode::NodeSourceType nodeSourceType = ModelNode::NodeWithoutSource; ModelNode::NodeSourceType nodeSourceType = ModelNode::NodeWithoutSource;
if (itemLibraryEntry.typeName() == "QtQml.Component")
nodeSourceType = ModelNode::NodeWithComponentSource;
#ifdef QDS_USE_PROJECTSTORAGE #ifdef QDS_USE_PROJECTSTORAGE
NodeMetaInfo metaInfo{itemLibraryEntry.typeId(), view->model()->projectStorage()};
if (metaInfo.isQmlComponent())
nodeSourceType = ModelNode::NodeWithComponentSource;
newQmlObjectNode = QmlObjectNode(view->createModelNode( newQmlObjectNode = QmlObjectNode(view->createModelNode(
itemLibraryEntry.typeName(), propertyPairList, {}, {}, nodeSourceType)); itemLibraryEntry.typeName(), propertyPairList, {}, {}, nodeSourceType));
#else #else
if (itemLibraryEntry.typeName() == "QtQml.Component")
nodeSourceType = ModelNode::NodeWithComponentSource;
newQmlObjectNode = QmlObjectNode(view->createModelNode(itemLibraryEntry.typeName(), newQmlObjectNode = QmlObjectNode(view->createModelNode(itemLibraryEntry.typeName(),
majorVersion, majorVersion,
minorVersion, minorVersion,

View File

@@ -639,17 +639,21 @@ struct ProjectStorage::Statements
database}; database};
Sqlite::WriteStatement<1> deletePropertyEditorPathStatement{ Sqlite::WriteStatement<1> deletePropertyEditorPathStatement{
"DELETE FROM propertyEditorPaths WHERE typeId=?1", database}; "DELETE FROM propertyEditorPaths WHERE typeId=?1", database};
mutable Sqlite::ReadStatement<4, 1> selectTypeAnnotationsForSourceIdsStatement{ mutable Sqlite::ReadStatement<5, 1> selectTypeAnnotationsForSourceIdsStatement{
"SELECT typeId, iconPath, itemLibrary, hints FROM typeAnnotations WHERE " "SELECT typeId, typeName, iconPath, itemLibrary, hints FROM typeAnnotations WHERE "
"sourceId IN carray(?1) ORDER BY typeId", "sourceId IN carray(?1) ORDER BY typeId",
database}; database};
Sqlite::WriteStatement<6> insertTypeAnnotationStatement{ Sqlite::WriteStatement<7> insertTypeAnnotationStatement{
"INSERT INTO " "INSERT INTO "
" typeAnnotations(typeId, sourceId, directorySourceId, iconPath, itemLibrary, hints) " " typeAnnotations(typeId, sourceId, directorySourceId, typeName, iconPath, itemLibrary, "
"VALUES(?1, ?2, ?3, ?4, ?5, ?6)", " hints) "
"VALUES(?1, ?2, ?3, ?4, ?5, ?6, ?7)",
database};
Sqlite::WriteStatement<5> updateTypeAnnotationStatement{
"UPDATE typeAnnotations "
"SET typeName=?2, iconPath=?3, itemLibrary=?4, hints=?5 "
"WHERE typeId=?1",
database}; database};
Sqlite::WriteStatement<4> updateTypeAnnotationStatement{
"UPDATE typeAnnotations SET iconPath=?2, itemLibrary=?3, hints=?4 WHERE typeId=?1", database};
Sqlite::WriteStatement<1> deleteTypeAnnotationStatement{ Sqlite::WriteStatement<1> deleteTypeAnnotationStatement{
"DELETE FROM typeAnnotations WHERE typeId=?1", database}; "DELETE FROM typeAnnotations WHERE typeId=?1", database};
mutable Sqlite::ReadStatement<1, 1> selectTypeIconPathStatement{ mutable Sqlite::ReadStatement<1, 1> selectTypeIconPathStatement{
@@ -663,22 +667,22 @@ struct ProjectStorage::Statements
"SELECT sourceId FROM typeAnnotations WHERE directorySourceId=?1 ORDER BY sourceId", database}; "SELECT sourceId FROM typeAnnotations WHERE directorySourceId=?1 ORDER BY sourceId", database};
mutable Sqlite::ReadStatement<1, 0> selectTypeAnnotationDirectorySourceIdsStatement{ mutable Sqlite::ReadStatement<1, 0> selectTypeAnnotationDirectorySourceIdsStatement{
"SELECT DISTINCT directorySourceId FROM typeAnnotations ORDER BY directorySourceId", database}; "SELECT DISTINCT directorySourceId FROM typeAnnotations ORDER BY directorySourceId", database};
mutable Sqlite::ReadStatement<9> selectItemLibraryEntriesStatement{ mutable Sqlite::ReadStatement<10> selectItemLibraryEntriesStatement{
"SELECT typeId, i.value->>'$.name', i.value->>'$.iconPath', i.value->>'$.category', " "SELECT typeId, typeName, i.value->>'$.name', i.value->>'$.iconPath', "
" i.value->>'$.import', i.value->>'$.toolTip', i.value->>'$.properties', " " i.value->>'$.category', i.value->>'$.import', i.value->>'$.toolTip', "
" i.value->>'$.extraFilePaths', i.value->>'$.templatePath' " " i.value->>'$.properties', i.value->>'$.extraFilePaths', i.value->>'$.templatePath' "
"FROM typeAnnotations AS ta , json_each(ta.itemLibrary) AS i " "FROM typeAnnotations AS ta , json_each(ta.itemLibrary) AS i "
"WHERE ta.itemLibrary IS NOT NULL", "WHERE ta.itemLibrary IS NOT NULL",
database}; database};
mutable Sqlite::ReadStatement<9, 1> selectItemLibraryEntriesByTypeIdStatement{ mutable Sqlite::ReadStatement<10, 1> selectItemLibraryEntriesByTypeIdStatement{
"SELECT typeId, i.value->>'$.name', i.value->>'$.iconPath', i.value->>'$.category', " "SELECT typeId, typeName, i.value->>'$.name', i.value->>'$.iconPath', "
" i.value->>'$.import', i.value->>'$.toolTip', i.value->>'$.properties', " " i.value->>'$.category', i.value->>'$.import', i.value->>'$.toolTip', "
" i.value->>'$.extraFilePaths', i.value->>'$.templatePath' " " i.value->>'$.properties', i.value->>'$.extraFilePaths', i.value->>'$.templatePath' "
"FROM typeAnnotations AS ta, json_each(ta.itemLibrary) AS i " "FROM typeAnnotations AS ta, json_each(ta.itemLibrary) AS i "
"WHERE typeId=?1 AND ta.itemLibrary IS NOT NULL", "WHERE typeId=?1 AND ta.itemLibrary IS NOT NULL",
database}; database};
mutable Sqlite::ReadStatement<9, 1> selectItemLibraryEntriesBySourceIdStatement{ mutable Sqlite::ReadStatement<10, 1> selectItemLibraryEntriesBySourceIdStatement{
"SELECT typeId, i.value->>'$.name', i.value->>'$.iconPath', " "SELECT typeId, typeName, i.value->>'$.name', i.value->>'$.iconPath', "
"i.value->>'$.category', " "i.value->>'$.category', "
" i.value->>'$.import', i.value->>'$.toolTip', i.value->>'$.properties', " " i.value->>'$.import', i.value->>'$.toolTip', i.value->>'$.properties', "
" i.value->>'$.extraFilePaths', i.value->>'$.templatePath' " " i.value->>'$.extraFilePaths', i.value->>'$.templatePath' "
@@ -1087,7 +1091,7 @@ public:
auto &sourceIdColumn = table.addColumn("sourceId", Sqlite::StrictColumnType::Integer); auto &sourceIdColumn = table.addColumn("sourceId", Sqlite::StrictColumnType::Integer);
auto &directorySourceIdColumn = table.addColumn("directorySourceId", auto &directorySourceIdColumn = table.addColumn("directorySourceId",
Sqlite::StrictColumnType::Integer); Sqlite::StrictColumnType::Integer);
table.addColumn("typeName", Sqlite::StrictColumnType::Text);
table.addColumn("iconPath", Sqlite::StrictColumnType::Text); table.addColumn("iconPath", Sqlite::StrictColumnType::Text);
table.addColumn("itemLibrary", Sqlite::StrictColumnType::Text); table.addColumn("itemLibrary", Sqlite::StrictColumnType::Text);
table.addColumn("hints", Sqlite::StrictColumnType::Text); table.addColumn("hints", Sqlite::StrictColumnType::Text);
@@ -1572,6 +1576,7 @@ Storage::Info::ItemLibraryEntries ProjectStorage::itemLibraryEntries(TypeId type
Storage::Info::ItemLibraryEntries entries; Storage::Info::ItemLibraryEntries entries;
auto callback = [&](TypeId typeId_, auto callback = [&](TypeId typeId_,
Utils::SmallStringView typeName,
Utils::SmallStringView name, Utils::SmallStringView name,
Utils::SmallStringView iconPath, Utils::SmallStringView iconPath,
Utils::SmallStringView category, Utils::SmallStringView category,
@@ -1580,7 +1585,8 @@ Storage::Info::ItemLibraryEntries ProjectStorage::itemLibraryEntries(TypeId type
Utils::SmallStringView properties, Utils::SmallStringView properties,
Utils::SmallStringView extraFilePaths, Utils::SmallStringView extraFilePaths,
Utils::SmallStringView templatePath) { Utils::SmallStringView templatePath) {
auto &last = entries.emplace_back(typeId_, name, iconPath, category, import, toolTip, templatePath); auto &last = entries.emplace_back(
typeId_, typeName, name, iconPath, category, import, toolTip, templatePath);
if (properties.size()) if (properties.size())
s->selectItemLibraryPropertiesStatement.readTo(last.properties, properties); s->selectItemLibraryPropertiesStatement.readTo(last.properties, properties);
if (extraFilePaths.size()) if (extraFilePaths.size())
@@ -1605,6 +1611,7 @@ Storage::Info::ItemLibraryEntries ProjectStorage::itemLibraryEntries(ImportId im
Storage::Info::ItemLibraryEntries entries; Storage::Info::ItemLibraryEntries entries;
auto callback = [&](TypeId typeId_, auto callback = [&](TypeId typeId_,
Utils::SmallStringView typeName,
Utils::SmallStringView name, Utils::SmallStringView name,
Utils::SmallStringView iconPath, Utils::SmallStringView iconPath,
Utils::SmallStringView category, Utils::SmallStringView category,
@@ -1613,7 +1620,8 @@ Storage::Info::ItemLibraryEntries ProjectStorage::itemLibraryEntries(ImportId im
Utils::SmallStringView properties, Utils::SmallStringView properties,
Utils::SmallStringView extraFilePaths, Utils::SmallStringView extraFilePaths,
Utils::SmallStringView templatePath) { Utils::SmallStringView templatePath) {
auto &last = entries.emplace_back(typeId_, name, iconPath, category, import, toolTip, templatePath); auto &last = entries.emplace_back(
typeId_, typeName, name, iconPath, category, import, toolTip, templatePath);
if (properties.size()) if (properties.size())
s->selectItemLibraryPropertiesStatement.readTo(last.properties, properties); s->selectItemLibraryPropertiesStatement.readTo(last.properties, properties);
if (extraFilePaths.size()) if (extraFilePaths.size())
@@ -1638,6 +1646,7 @@ Storage::Info::ItemLibraryEntries ProjectStorage::itemLibraryEntries(SourceId so
Storage::Info::ItemLibraryEntries entries; Storage::Info::ItemLibraryEntries entries;
auto callback = [&](TypeId typeId, auto callback = [&](TypeId typeId,
Utils::SmallStringView typeName,
Utils::SmallStringView name, Utils::SmallStringView name,
Utils::SmallStringView iconPath, Utils::SmallStringView iconPath,
Utils::SmallStringView category, Utils::SmallStringView category,
@@ -1646,7 +1655,8 @@ Storage::Info::ItemLibraryEntries ProjectStorage::itemLibraryEntries(SourceId so
Utils::SmallStringView properties, Utils::SmallStringView properties,
Utils::SmallStringView extraFilePaths, Utils::SmallStringView extraFilePaths,
Utils::SmallStringView templatePath) { Utils::SmallStringView templatePath) {
auto &last = entries.emplace_back(typeId, name, iconPath, category, import, toolTip, templatePath); auto &last = entries.emplace_back(
typeId, typeName, name, iconPath, category, import, toolTip, templatePath);
if (properties.size()) if (properties.size())
s->selectItemLibraryPropertiesStatement.readTo(last.properties, properties); s->selectItemLibraryPropertiesStatement.readTo(last.properties, properties);
if (extraFilePaths.size()) if (extraFilePaths.size())
@@ -1669,6 +1679,7 @@ Storage::Info::ItemLibraryEntries ProjectStorage::allItemLibraryEntries() const
Storage::Info::ItemLibraryEntries entries; Storage::Info::ItemLibraryEntries entries;
auto callback = [&](TypeId typeId, auto callback = [&](TypeId typeId,
Utils::SmallStringView typeName,
Utils::SmallStringView name, Utils::SmallStringView name,
Utils::SmallStringView iconPath, Utils::SmallStringView iconPath,
Utils::SmallStringView category, Utils::SmallStringView category,
@@ -1677,7 +1688,8 @@ Storage::Info::ItemLibraryEntries ProjectStorage::allItemLibraryEntries() const
Utils::SmallStringView properties, Utils::SmallStringView properties,
Utils::SmallStringView extraFilePaths, Utils::SmallStringView extraFilePaths,
Utils::SmallStringView templatePath) { Utils::SmallStringView templatePath) {
auto &last = entries.emplace_back(typeId, name, iconPath, category, import, toolTip, templatePath); auto &last = entries.emplace_back(
typeId, typeName, name, iconPath, category, import, toolTip, templatePath);
if (properties.size()) if (properties.size())
s->selectItemLibraryPropertiesStatement.readTo(last.properties, properties); s->selectItemLibraryPropertiesStatement.readTo(last.properties, properties);
if (extraFilePaths.size()) if (extraFilePaths.size())
@@ -2314,6 +2326,7 @@ void ProjectStorage::synchronizeTypeAnnotations(Storage::Synchronization::TypeAn
s->insertTypeAnnotationStatement.write(annotation.typeId, s->insertTypeAnnotationStatement.write(annotation.typeId,
annotation.sourceId, annotation.sourceId,
annotation.directorySourceId, annotation.directorySourceId,
annotation.typeName,
annotation.iconPath, annotation.iconPath,
createEmptyAsNull(annotation.itemLibraryJson), createEmptyAsNull(annotation.itemLibraryJson),
createEmptyAsNull(annotation.hintsJson)); createEmptyAsNull(annotation.hintsJson));
@@ -2323,7 +2336,8 @@ void ProjectStorage::synchronizeTypeAnnotations(Storage::Synchronization::TypeAn
const TypeAnnotation &annotation) { const TypeAnnotation &annotation) {
synchronizeTypeTraits(annotation.typeId, annotation.traits); synchronizeTypeTraits(annotation.typeId, annotation.traits);
if (annotationFromDatabase.iconPath != annotation.iconPath if (annotationFromDatabase.typeName != annotation.typeName
|| annotationFromDatabase.iconPath != annotation.iconPath
|| annotationFromDatabase.itemLibraryJson != annotation.itemLibraryJson || annotationFromDatabase.itemLibraryJson != annotation.itemLibraryJson
|| annotationFromDatabase.hintsJson != annotation.hintsJson) { || annotationFromDatabase.hintsJson != annotation.hintsJson) {
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
@@ -2334,6 +2348,7 @@ void ProjectStorage::synchronizeTypeAnnotations(Storage::Synchronization::TypeAn
keyValue("type annotation", annotation)}; keyValue("type annotation", annotation)};
s->updateTypeAnnotationStatement.write(annotation.typeId, s->updateTypeAnnotationStatement.write(annotation.typeId,
annotation.typeName,
annotation.iconPath, annotation.iconPath,
createEmptyAsNull(annotation.itemLibraryJson), createEmptyAsNull(annotation.itemLibraryJson),
createEmptyAsNull(annotation.hintsJson)); createEmptyAsNull(annotation.hintsJson));

View File

@@ -501,10 +501,12 @@ private:
{ {
public: public:
TypeAnnotationView(TypeId typeId, TypeAnnotationView(TypeId typeId,
Utils::SmallStringView typeName,
Utils::SmallStringView iconPath, Utils::SmallStringView iconPath,
Utils::SmallStringView itemLibraryJson, Utils::SmallStringView itemLibraryJson,
Utils::SmallStringView hintsJson) Utils::SmallStringView hintsJson)
: typeId{typeId} : typeId{typeId}
, typeName{typeName}
, iconPath{iconPath} , iconPath{iconPath}
, itemLibraryJson{itemLibraryJson} , itemLibraryJson{itemLibraryJson}
, hintsJson{hintsJson} , hintsJson{hintsJson}
@@ -516,6 +518,7 @@ private:
using NanotraceHR::dictonary; using NanotraceHR::dictonary;
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
auto dict = dictonary(keyValue("type id", typeAnnotationView.typeId), auto dict = dictonary(keyValue("type id", typeAnnotationView.typeId),
keyValue("type name", typeAnnotationView.typeName),
keyValue("icon path", typeAnnotationView.iconPath), keyValue("icon path", typeAnnotationView.iconPath),
keyValue("item library json", typeAnnotationView.itemLibraryJson), keyValue("item library json", typeAnnotationView.itemLibraryJson),
keyValue("hints json", typeAnnotationView.hintsJson)); keyValue("hints json", typeAnnotationView.hintsJson));
@@ -525,6 +528,7 @@ private:
public: public:
TypeId typeId; TypeId typeId;
Utils::SmallStringView typeName;
Utils::SmallStringView iconPath; Utils::SmallStringView iconPath;
Utils::SmallStringView itemLibraryJson; Utils::SmallStringView itemLibraryJson;
Utils::PathString hintsJson; Utils::PathString hintsJson;

View File

@@ -380,6 +380,7 @@ using ToolTipString = Utils::BasicSmallString<94>;
struct ItemLibraryEntry struct ItemLibraryEntry
{ {
ItemLibraryEntry(TypeId typeId, ItemLibraryEntry(TypeId typeId,
Utils::SmallStringView typeName,
Utils::SmallStringView name, Utils::SmallStringView name,
Utils::SmallStringView iconPath, Utils::SmallStringView iconPath,
Utils::SmallStringView category, Utils::SmallStringView category,
@@ -387,6 +388,7 @@ struct ItemLibraryEntry
Utils::SmallStringView toolTip, Utils::SmallStringView toolTip,
Utils::SmallStringView templatePath) Utils::SmallStringView templatePath)
: typeId{typeId} : typeId{typeId}
, typeName{typeName}
, name{name} , name{name}
, iconPath{iconPath} , iconPath{iconPath}
, category{category} , category{category}
@@ -396,6 +398,7 @@ struct ItemLibraryEntry
{} {}
ItemLibraryEntry(TypeId typeId, ItemLibraryEntry(TypeId typeId,
Utils::SmallStringView typeName,
Utils::SmallStringView name, Utils::SmallStringView name,
Utils::SmallStringView iconPath, Utils::SmallStringView iconPath,
Utils::SmallStringView category, Utils::SmallStringView category,
@@ -403,6 +406,7 @@ struct ItemLibraryEntry
Utils::SmallStringView toolTip, Utils::SmallStringView toolTip,
ItemLibraryProperties properties) ItemLibraryProperties properties)
: typeId{typeId} : typeId{typeId}
, typeName{typeName}
, name{name} , name{name}
, iconPath{iconPath} , iconPath{iconPath}
, category{category} , category{category}
@@ -417,6 +421,7 @@ struct ItemLibraryEntry
using NanotraceHR::dictonary; using NanotraceHR::dictonary;
using NanotraceHR::keyValue; using NanotraceHR::keyValue;
auto dict = dictonary(keyValue("type id", entry.typeId), auto dict = dictonary(keyValue("type id", entry.typeId),
keyValue("type name", entry.typeName),
keyValue("name", entry.name), keyValue("name", entry.name),
keyValue("icon path", entry.iconPath), keyValue("icon path", entry.iconPath),
keyValue("category", entry.category), keyValue("category", entry.category),
@@ -430,6 +435,7 @@ struct ItemLibraryEntry
} }
TypeId typeId; TypeId typeId;
Utils::SmallString typeName;
Utils::SmallString name; Utils::SmallString name;
Utils::PathString iconPath; Utils::PathString iconPath;
Utils::SmallString category; Utils::SmallString category;

View File

@@ -178,8 +178,10 @@ TypeAnnotationReader::ParserSate TypeAnnotationReader::readDocument(const QStrin
TypeAnnotationReader::ParserSate TypeAnnotationReader::readMetaInfoRootElement(const QString &name) TypeAnnotationReader::ParserSate TypeAnnotationReader::readMetaInfoRootElement(const QString &name)
{ {
if (name == typeElementName) { if (name == typeElementName) {
m_typeAnnotations.emplace_back(m_sourceId, m_directorySourceId); auto &annotation = m_typeAnnotations.emplace_back(m_sourceId, m_directorySourceId);
annotation.traits.canBeDroppedInFormEditor = FlagIs::True;
m_itemLibraryEntries = json::array(); m_itemLibraryEntries = json::array();
return ParsingType; return ParsingType;
} else { } else {
addErrorInvalidType(name); addErrorInvalidType(name);

View File

@@ -20,6 +20,7 @@ MATCHER_P2(IsTypeHint,
template<typename PropertiesMatcher, typename ExtraFilePathsMatcher> template<typename PropertiesMatcher, typename ExtraFilePathsMatcher>
auto IsItemLibraryEntry(QmlDesigner::TypeId typeId, auto IsItemLibraryEntry(QmlDesigner::TypeId typeId,
Utils::SmallStringView typeName,
Utils::SmallStringView name, Utils::SmallStringView name,
Utils::SmallStringView iconPath, Utils::SmallStringView iconPath,
Utils::SmallStringView category, Utils::SmallStringView category,
@@ -31,6 +32,7 @@ auto IsItemLibraryEntry(QmlDesigner::TypeId typeId,
{ {
using QmlDesigner::Storage::Info::ItemLibraryEntry; using QmlDesigner::Storage::Info::ItemLibraryEntry;
return AllOf(Field("typeId", &ItemLibraryEntry::typeId, typeId), return AllOf(Field("typeId", &ItemLibraryEntry::typeId, typeId),
Field("typeName", &ItemLibraryEntry::typeName, typeName),
Field("name", &ItemLibraryEntry::name, name), Field("name", &ItemLibraryEntry::name, name),
Field("iconPath", &ItemLibraryEntry::iconPath, iconPath), Field("iconPath", &ItemLibraryEntry::iconPath, iconPath),
Field("category", &ItemLibraryEntry::category, category), Field("category", &ItemLibraryEntry::category, category),
@@ -66,7 +68,7 @@ auto IsTypeAnnotation(QmlDesigner::SourceId sourceId,
{ {
using QmlDesigner::Storage::Synchronization::TypeAnnotation; using QmlDesigner::Storage::Synchronization::TypeAnnotation;
return AllOf(Field("sourceId", &TypeAnnotation::sourceId, sourceId), return AllOf(Field("sourceId", &TypeAnnotation::sourceId, sourceId),
Field("sourceId", &TypeAnnotation::directorySourceId, directorySourceId), Field("directory sourceId", &TypeAnnotation::directorySourceId, directorySourceId),
Field("typeName", &TypeAnnotation::typeName, typeName), Field("typeName", &TypeAnnotation::typeName, typeName),
Field("moduleId", &TypeAnnotation::moduleId, moduleId), Field("moduleId", &TypeAnnotation::moduleId, moduleId),
Field("iconPath", &TypeAnnotation::iconPath, iconPath), Field("iconPath", &TypeAnnotation::iconPath, iconPath),

View File

@@ -695,10 +695,10 @@ std::ostream &operator<<(std::ostream &out, const ItemLibraryProperty &property)
std::ostream &operator<<(std::ostream &out, const ItemLibraryEntry &entry) std::ostream &operator<<(std::ostream &out, const ItemLibraryEntry &entry)
{ {
return out << R"((")" << entry.name << R"(", ")" << entry.iconPath << R"(", ")" return out << R"((")" << entry.typeName << R"(", ")" << entry.name << R"(", ")"
<< entry.category << R"(", ")" << entry.import << R"(", ")" << entry.toolTip << entry.iconPath << R"(", ")" << entry.category << R"(", ")" << entry.import
<< R"(", ")" << entry.templatePath << R"(", )" << entry.properties << ", " << R"(", ")" << entry.toolTip << R"(", ")" << entry.templatePath << R"(", )"
<< entry.extraFilePaths << ")"; << entry.properties << ", " << entry.extraFilePaths << ")";
} }
} // namespace Storage::Info } // namespace Storage::Info

View File

@@ -3182,6 +3182,7 @@ TEST_F(NodeMetaInfo, item_library_entries)
{ {
projectStorageMock.setItemLibraryEntries(objectMetaInfo.id(), projectStorageMock.setItemLibraryEntries(objectMetaInfo.id(),
{{objectMetaInfo.id(), {{objectMetaInfo.id(),
"QtObject",
"Object", "Object",
"/icon/path", "/icon/path",
"Basic", "Basic",
@@ -3193,6 +3194,7 @@ TEST_F(NodeMetaInfo, item_library_entries)
ASSERT_THAT(entries, ASSERT_THAT(entries,
ElementsAre(IsItemLibraryEntry(objectMetaInfo.id(), ElementsAre(IsItemLibraryEntry(objectMetaInfo.id(),
"QtObject",
"Object", "Object",
"/icon/path", "/icon/path",
"Basic", "Basic",

View File

@@ -36,7 +36,8 @@ MATCHER(IsSorted, std::string(negation ? "isn't sorted" : "is sorted"))
} }
template<typename PropertiesMatcher, typename ExtraFilePathsMatcher> template<typename PropertiesMatcher, typename ExtraFilePathsMatcher>
auto IsItemLibraryEntry(const QmlDesigner::NodeMetaInfo &metaInfo, auto IsItemLibraryEntry(QmlDesigner::TypeId typeId,
QByteArrayView typeName,
QStringView name, QStringView name,
QStringView iconPath, QStringView iconPath,
QStringView category, QStringView category,
@@ -47,7 +48,8 @@ auto IsItemLibraryEntry(const QmlDesigner::NodeMetaInfo &metaInfo,
ExtraFilePathsMatcher extraFilePathsMatcher) ExtraFilePathsMatcher extraFilePathsMatcher)
{ {
using QmlDesigner::ItemLibraryEntry; using QmlDesigner::ItemLibraryEntry;
return AllOf(Property("metaInfo", &ItemLibraryEntry::metaInfo, metaInfo), return AllOf(Property("typeId", &ItemLibraryEntry::typeId, typeId),
Property("typeName", &ItemLibraryEntry::typeName, typeName),
Property("name", &ItemLibraryEntry::name, name), Property("name", &ItemLibraryEntry::name, name),
Property("libraryEntryIconPath", &ItemLibraryEntry::libraryEntryIconPath, iconPath), Property("libraryEntryIconPath", &ItemLibraryEntry::libraryEntryIconPath, iconPath),
Property("category", &ItemLibraryEntry::category, category), Property("category", &ItemLibraryEntry::category, category),
@@ -1001,18 +1003,24 @@ TEST_F(Model, meta_infos_for_mdoule)
TEST_F(Model, item_library_entries) TEST_F(Model, item_library_entries)
{ {
using namespace Qt::StringLiterals; using namespace Qt::StringLiterals;
QmlDesigner::Storage::Info::ItemLibraryEntries storageEntries{ QmlDesigner::Storage::Info::ItemLibraryEntries storageEntries{{itemTypeId,
{itemTypeId, "Item", "/path/to/icon", "basic category", "QtQuick", "It's a item", "/path/to/template"}}; "Item",
"Item",
"/path/to/icon",
"basic category",
"QtQuick",
"It's a item",
"/path/to/template"}};
storageEntries.front().properties.emplace_back("x", "double", Sqlite::ValueView::create(1)); storageEntries.front().properties.emplace_back("x", "double", Sqlite::ValueView::create(1));
storageEntries.front().extraFilePaths.emplace_back("/extra/file/path"); storageEntries.front().extraFilePaths.emplace_back("/extra/file/path");
projectStorageMock.setItemLibraryEntries(pathCacheMock.sourceId, storageEntries); projectStorageMock.setItemLibraryEntries(pathCacheMock.sourceId, storageEntries);
QmlDesigner::NodeMetaInfo metaInfo{itemTypeId, &projectStorageMock};
auto entries = model.itemLibraryEntries(); auto entries = model.itemLibraryEntries();
ASSERT_THAT(entries, ASSERT_THAT(entries,
ElementsAre( ElementsAre(
IsItemLibraryEntry(metaInfo, IsItemLibraryEntry(itemTypeId,
"Item",
u"Item", u"Item",
u"/path/to/icon", u"/path/to/icon",
u"basic category", u"basic category",

View File

@@ -7560,6 +7560,7 @@ TEST_F(ProjectStorage, synchronize_item_library_entries)
storage.allItemLibraryEntries(), storage.allItemLibraryEntries(),
UnorderedElementsAre( UnorderedElementsAre(
IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"), IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"),
"Object",
"Foo", "Foo",
"/path/icon", "/path/icon",
"Basic Items", "Basic Items",
@@ -7571,6 +7572,7 @@ TEST_F(ProjectStorage, synchronize_item_library_entries)
UnorderedElementsAre("/path/templates/frame.png", UnorderedElementsAre("/path/templates/frame.png",
"/path/templates/frame.frag")), "/path/templates/frame.frag")),
IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"), IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"),
"Object",
"Bar", "Bar",
"/path/icon2", "/path/icon2",
"Basic Items", "Basic Items",
@@ -7580,6 +7582,7 @@ TEST_F(ProjectStorage, synchronize_item_library_entries)
UnorderedElementsAre(IsItemLibraryProperty("color", "color", "#blue")), UnorderedElementsAre(IsItemLibraryProperty("color", "color", "#blue")),
IsEmpty()), IsEmpty()),
IsItemLibraryEntry(fetchTypeId(sourceId1, "QQuickItem"), IsItemLibraryEntry(fetchTypeId(sourceId1, "QQuickItem"),
"Item",
"Item", "Item",
"/path/icon3", "/path/icon3",
"Advanced Items", "Advanced Items",
@@ -7620,6 +7623,7 @@ TEST_F(ProjectStorage, synchronize_updates_item_library_entries)
ASSERT_THAT(storage.itemLibraryEntries(fetchTypeId(sourceId2, "QObject")), ASSERT_THAT(storage.itemLibraryEntries(fetchTypeId(sourceId2, "QObject")),
ElementsAre( ElementsAre(
IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"), IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"),
"Object",
"Foo", "Foo",
"/path/icon", "/path/icon",
"Basic Items", "Basic Items",
@@ -7698,6 +7702,7 @@ TEST_F(ProjectStorage, get_all_item_library_entries)
entries, entries,
UnorderedElementsAre( UnorderedElementsAre(
IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"), IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"),
"Object",
"Foo", "Foo",
"/path/icon", "/path/icon",
"Basic Items", "Basic Items",
@@ -7709,6 +7714,7 @@ TEST_F(ProjectStorage, get_all_item_library_entries)
UnorderedElementsAre("/path/templates/frame.png", UnorderedElementsAre("/path/templates/frame.png",
"/path/templates/frame.frag")), "/path/templates/frame.frag")),
IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"), IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"),
"Object",
"Bar", "Bar",
"/path/icon2", "/path/icon2",
"Basic Items", "Basic Items",
@@ -7718,6 +7724,7 @@ TEST_F(ProjectStorage, get_all_item_library_entries)
UnorderedElementsAre(IsItemLibraryProperty("color", "color", "#blue")), UnorderedElementsAre(IsItemLibraryProperty("color", "color", "#blue")),
IsEmpty()), IsEmpty()),
IsItemLibraryEntry(fetchTypeId(sourceId1, "QQuickItem"), IsItemLibraryEntry(fetchTypeId(sourceId1, "QQuickItem"),
"Item",
"Item", "Item",
"/path/icon3", "/path/icon3",
"Advanced Items", "Advanced Items",
@@ -7743,6 +7750,7 @@ TEST_F(ProjectStorage, get_all_item_library_entries_handles_no_entries)
ASSERT_THAT(entries, ASSERT_THAT(entries,
UnorderedElementsAre( UnorderedElementsAre(
IsItemLibraryEntry(fetchTypeId(sourceId1, "QQuickItem"), IsItemLibraryEntry(fetchTypeId(sourceId1, "QQuickItem"),
"Item",
"Item", "Item",
"/path/icon3", "/path/icon3",
"Advanced Items", "Advanced Items",
@@ -7769,6 +7777,7 @@ TEST_F(ProjectStorage, get_item_library_entries_by_type_id)
entries, entries,
UnorderedElementsAre( UnorderedElementsAre(
IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"), IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"),
"Object",
"Foo", "Foo",
"/path/icon", "/path/icon",
"Basic Items", "Basic Items",
@@ -7780,6 +7789,7 @@ TEST_F(ProjectStorage, get_item_library_entries_by_type_id)
UnorderedElementsAre("/path/templates/frame.png", UnorderedElementsAre("/path/templates/frame.png",
"/path/templates/frame.frag")), "/path/templates/frame.frag")),
IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"), IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"),
"Object",
"Bar", "Bar",
"/path/icon2", "/path/icon2",
"Basic Items", "Basic Items",
@@ -7832,6 +7842,7 @@ TEST_F(ProjectStorage, get_item_library_entries_by_source_id)
entries, entries,
UnorderedElementsAre( UnorderedElementsAre(
IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"), IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"),
"Object",
"Foo", "Foo",
"/path/icon", "/path/icon",
"Basic Items", "Basic Items",
@@ -7843,6 +7854,7 @@ TEST_F(ProjectStorage, get_item_library_entries_by_source_id)
UnorderedElementsAre("/path/templates/frame.png", UnorderedElementsAre("/path/templates/frame.png",
"/path/templates/frame.frag")), "/path/templates/frame.frag")),
IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"), IsItemLibraryEntry(fetchTypeId(sourceId2, "QObject"),
"Object",
"Bar", "Bar",
"/path/icon2", "/path/icon2",
"Basic Items", "Basic Items",

View File

@@ -12,10 +12,12 @@
namespace { namespace {
using QmlDesigner::FlagIs;
class TypeAnnotationReader : public testing::Test class TypeAnnotationReader : public testing::Test
{ {
protected: protected:
TypeAnnotationReader() { traits.canBeDroppedInFormEditor = FlagIs::True; }
static void SetUpTestSuite() static void SetUpTestSuite()
{ {
static_database = std::make_unique<Sqlite::Database>(":memory:", Sqlite::JournalMode::Memory); static_database = std::make_unique<Sqlite::Database>(":memory:", Sqlite::JournalMode::Memory);
@@ -43,6 +45,7 @@ protected:
QmlDesigner::Storage::TypeAnnotationReader reader{storage}; QmlDesigner::Storage::TypeAnnotationReader reader{storage};
QmlDesigner::SourceId sourceId = QmlDesigner::SourceId::create(33); QmlDesigner::SourceId sourceId = QmlDesigner::SourceId::create(33);
QmlDesigner::SourceId directorySourceId = QmlDesigner::SourceId::create(77); QmlDesigner::SourceId directorySourceId = QmlDesigner::SourceId::create(77);
QmlDesigner::Storage::TypeTraits traits;
}; };
TEST_F(TypeAnnotationReader, parse_type) TEST_F(TypeAnnotationReader, parse_type)
@@ -58,7 +61,6 @@ TEST_F(TypeAnnotationReader, parse_type)
icon: "images/item-icon16.png" icon: "images/item-icon16.png"
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -95,7 +97,6 @@ TEST_F(TypeAnnotationReader, parse_true_canBeContainer)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.canBeContainer = FlagIs::True; traits.canBeContainer = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -125,7 +126,6 @@ TEST_F(TypeAnnotationReader, parse_true_forceClip)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.forceClip = FlagIs::True; traits.forceClip = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -155,7 +155,6 @@ TEST_F(TypeAnnotationReader, parse_true_doesLayoutChildren)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.doesLayoutChildren = FlagIs::True; traits.doesLayoutChildren = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -181,12 +180,11 @@ TEST_F(TypeAnnotationReader, parse_true_canBeDroppedInFormEditor)
icon: "images/frame-icon16.png" icon: "images/frame-icon16.png"
Hints { Hints {
canBeDroppedInFormEditor: true canBeDroppedInFormEditor: false
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits; traits.canBeDroppedInFormEditor = FlagIs::False;
traits.canBeDroppedInFormEditor = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -215,7 +213,6 @@ TEST_F(TypeAnnotationReader, parse_true_canBeDroppedInNavigator)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.canBeDroppedInNavigator = FlagIs::True; traits.canBeDroppedInNavigator = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -245,7 +242,6 @@ TEST_F(TypeAnnotationReader, parse_true_canBeDroppedInView3D)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.canBeDroppedInView3D = FlagIs::True; traits.canBeDroppedInView3D = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -275,7 +271,6 @@ TEST_F(TypeAnnotationReader, parse_true_isMovable)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.isMovable = FlagIs::True; traits.isMovable = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -305,7 +300,6 @@ TEST_F(TypeAnnotationReader, parse_true_isResizable)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.isResizable = FlagIs::True; traits.isResizable = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -335,7 +329,6 @@ TEST_F(TypeAnnotationReader, parse_true_hasFormEditorItem)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.hasFormEditorItem = FlagIs::True; traits.hasFormEditorItem = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -365,7 +358,6 @@ TEST_F(TypeAnnotationReader, parse_true_isStackedContainer)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.isStackedContainer = FlagIs::True; traits.isStackedContainer = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -395,7 +387,6 @@ TEST_F(TypeAnnotationReader, parse_true_takesOverRenderingOfChildren)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.takesOverRenderingOfChildren = FlagIs::True; traits.takesOverRenderingOfChildren = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -425,7 +416,6 @@ TEST_F(TypeAnnotationReader, parse_true_visibleInNavigator)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.visibleInNavigator = FlagIs::True; traits.visibleInNavigator = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -455,7 +445,6 @@ TEST_F(TypeAnnotationReader, parse_true_visibleInLibrary)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
traits.visibleInLibrary = FlagIs::True; traits.visibleInLibrary = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -485,7 +474,7 @@ TEST_F(TypeAnnotationReader, parse_false)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits; traits.canBeDroppedInFormEditor = FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -524,9 +513,9 @@ TEST_F(TypeAnnotationReader, parse_complex_expression)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits frameTraits; QmlDesigner::Storage::TypeTraits frameTraits = traits;
frameTraits.isMovable = QmlDesigner::FlagIs::Set; frameTraits.isMovable = QmlDesigner::FlagIs::Set;
QmlDesigner::Storage::TypeTraits itemTraits; QmlDesigner::Storage::TypeTraits itemTraits = traits;
itemTraits.canBeContainer = QmlDesigner::FlagIs::True; itemTraits.canBeContainer = QmlDesigner::FlagIs::True;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -576,7 +565,6 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -633,7 +621,6 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_with_properties)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -684,7 +671,6 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_template_path)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
@@ -737,7 +723,6 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_extra_file_paths)
} }
} }
})xy"}; })xy"};
QmlDesigner::Storage::TypeTraits traits;
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);