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

View File

@@ -694,7 +694,7 @@ void Edit3DWidget::dragEnterEvent(QDragEnterEvent *dragEnterEvent)
if (!data.isEmpty()) {
QDataStream stream(data);
stream >> m_draggedEntry;
if (NodeHints::fromItemLibraryEntry(m_draggedEntry).canBeDroppedInView3D())
if (NodeHints::fromItemLibraryEntry(m_draggedEntry, view()->model()).canBeDroppedInView3D())
dragEnterEvent->acceptProposedAction();
}
}
@@ -773,7 +773,7 @@ void Edit3DWidget::dropEvent(QDropEvent *dropEvent)
auto moduleId = model->module(import3dTypePrefix, Storage::ModuleKind::QmlLibrary);
auto metaInfo = model->metaInfo(moduleId, fileName.toUtf8());
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);
}
}

View File

@@ -206,9 +206,16 @@ static ItemLibraryEntry itemLibraryEntryFromMimeData(const QMimeData *mimeData)
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)
@@ -218,7 +225,7 @@ static bool hasItemLibraryInfo(const QMimeData *mimeData)
void DragTool::dropEvent(const QList<QGraphicsItem *> &itemList, QGraphicsSceneDragDropEvent *event)
{
if (canBeDropped(event->mimeData())) {
if (canBeDropped(event->mimeData(), view()->model())) {
event->accept();
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)
{
if (canBeDropped(event->mimeData())) {
if (canBeDropped(event->mimeData(), view()->model())) {
m_blockMove = false;
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)
{
if (canBeDropped(event->mimeData())) {
if (canBeDropped(event->mimeData(), view()->model())) {
event->accept();
m_moveManipulator.end();
@@ -363,10 +370,8 @@ void DragTool::dragMoveEvent(const QList<QGraphicsItem *> &itemList, QGraphicsSc
->data(Constants::MIME_TYPE_ASSETS)).split(',');
QString assetType = AssetsLibraryWidget::getAssetTypeAndData(assetPaths[0]).first;
if (!m_blockMove
&& !m_isAborted
&& canBeDropped(event->mimeData())
&& assetType != Constants::MIME_TYPE_ASSET_EFFECT) {
if (!m_blockMove && !m_isAborted && canBeDropped(event->mimeData(), view()->model())
&& assetType != Constants::MIME_TYPE_ASSET_EFFECT) {
event->accept();
if (!m_dragNodes.isEmpty()) {
if (targetContainerItem) {

View File

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

View File

@@ -716,7 +716,7 @@ void MaterialEditorView::updatePossibleTypes()
auto heirs = model()->qtQuick3DMaterialMetaInfo().heirs();
heirs.push_back(model()->qtQuick3DMaterialMetaInfo());
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

View File

@@ -705,7 +705,7 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in
const ItemLibraryEntry itemLibraryEntry =
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();

View File

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

View File

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

View File

@@ -22,7 +22,7 @@ class ItemLibraryEntryData
public:
QString name;
TypeName typeName;
NodeMetaInfo metaInfo;
TypeId typeId;
QString category;
int majorVersion{-1};
int minorVersion{-1};
@@ -64,12 +64,12 @@ ItemLibraryEntry::ItemLibraryEntry()
: m_data(std::make_shared<Internal::ItemLibraryEntryData>())
{}
ItemLibraryEntry::ItemLibraryEntry(const Storage::Info::ItemLibraryEntry &entry,
const ProjectStorageType &projectStorage)
ItemLibraryEntry::ItemLibraryEntry(const Storage::Info::ItemLibraryEntry &entry)
: ItemLibraryEntry{}
{
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();
if (entry.iconPath.size())
m_data->libraryEntryIconPath = entry.iconPath.toQString();
@@ -87,6 +87,8 @@ ItemLibraryEntry::ItemLibraryEntry(const Storage::Info::ItemLibraryEntry &entry,
m_data->extraFilePaths.emplace_back(extraFilePath.toQString());
}
ItemLibraryEntry::~ItemLibraryEntry() = default;
QString ItemLibraryEntry::name() const
{
return m_data->name;
@@ -97,9 +99,9 @@ TypeName ItemLibraryEntry::typeName() const
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
@@ -245,6 +247,7 @@ QDataStream &operator<<(QDataStream &stream, const ItemLibraryEntry &itemLibrary
stream << itemLibraryEntry.m_data->qmlSource;
stream << itemLibraryEntry.m_data->customComponentSource;
stream << itemLibraryEntry.m_data->extraFilePaths;
stream << itemLibraryEntry.m_data->typeId.internalId();
return stream;
}
@@ -270,6 +273,9 @@ QDataStream &operator>>(QDataStream &stream, ItemLibraryEntry &itemLibraryEntry)
stream >> itemLibraryEntry.m_data->qmlSource;
stream >> itemLibraryEntry.m_data->customComponentSource;
stream >> itemLibraryEntry.m_data->extraFilePaths;
TypeId::DatabaseType internalTypeId;
stream >> internalTypeId;
itemLibraryEntry.m_data->typeId = TypeId::create(internalTypeId);
return stream;
}
@@ -295,11 +301,10 @@ QDebug operator<<(QDebug debug, const ItemLibraryEntry &itemLibraryEntry)
return debug.space();
}
QList<ItemLibraryEntry> toItemLibraryEntries(const Storage::Info::ItemLibraryEntries &entries,
const ProjectStorageType &projectStorage)
QList<ItemLibraryEntry> toItemLibraryEntries(const Storage::Info::ItemLibraryEntries &entries)
{
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)
: m_metaInfo{metaInfo}
{
for (const auto &[name, expression] : metaInfo.typeHints())
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
: NodeHints{entry.metaInfo()}
: NodeHints{NodeMetaInfo{entry.typeId(), model->projectStorage()}}
#endif
{
if constexpr (!useProjectStorage())
@@ -135,7 +136,7 @@ bool NodeHints::canBeContainerFor(const ModelNode &potenialChild) const
if (!isValid())
return true;
auto flagIs = m_modelNode.metaInfo().canBeContainer();
auto flagIs = m_metaInfo.canBeContainer();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -151,7 +152,7 @@ bool NodeHints::forceClip() const
if (isSwipeView(modelNode()))
return true;
auto flagIs = m_modelNode.metaInfo().forceClip();
auto flagIs = m_metaInfo.forceClip();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -167,7 +168,7 @@ bool NodeHints::doesLayoutChildren() const
if (isSwipeView(modelNode()))
return true;
auto flagIs = m_modelNode.metaInfo().doesLayoutChildren();
auto flagIs = m_metaInfo.doesLayoutChildren();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -177,7 +178,7 @@ bool NodeHints::doesLayoutChildren() const
bool NodeHints::canBeDroppedInFormEditor() const
{
auto flagIs = m_modelNode.metaInfo().canBeDroppedInFormEditor();
auto flagIs = m_metaInfo.canBeDroppedInFormEditor();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -187,7 +188,7 @@ bool NodeHints::canBeDroppedInFormEditor() const
bool NodeHints::canBeDroppedInNavigator() const
{
auto flagIs = m_modelNode.metaInfo().canBeDroppedInNavigator();
auto flagIs = m_metaInfo.canBeDroppedInNavigator();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -197,7 +198,7 @@ bool NodeHints::canBeDroppedInNavigator() const
bool NodeHints::canBeDroppedInView3D() const
{
auto flagIs = m_modelNode.metaInfo().canBeDroppedInView3D();
auto flagIs = m_metaInfo.canBeDroppedInView3D();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -210,7 +211,7 @@ bool NodeHints::isMovable() const
if (!isValid())
return true;
auto flagIs = m_modelNode.metaInfo().isMovable();
auto flagIs = m_metaInfo.isMovable();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -223,7 +224,7 @@ bool NodeHints::isResizable() const
if (!isValid())
return true;
auto flagIs = m_modelNode.metaInfo().isResizable();
auto flagIs = m_metaInfo.isResizable();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -236,7 +237,7 @@ bool NodeHints::hasFormEditorItem() const
if (!isValid())
return true;
auto flagIs = m_modelNode.metaInfo().hasFormEditorItem();
auto flagIs = m_metaInfo.hasFormEditorItem();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -252,7 +253,7 @@ bool NodeHints::isStackedContainer() const
if (isSwipeView(modelNode()))
return true;
auto flagIs = m_modelNode.metaInfo().isStackedContainer();
auto flagIs = m_metaInfo.isStackedContainer();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -299,7 +300,7 @@ bool NodeHints::takesOverRenderingOfChildren() const
if (!isValid())
return false;
auto flagIs = m_modelNode.metaInfo().takesOverRenderingOfChildren();
auto flagIs = m_metaInfo.takesOverRenderingOfChildren();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -312,7 +313,7 @@ bool NodeHints::visibleInNavigator() const
if (!isValid())
return false;
auto flagIs = m_modelNode.metaInfo().visibleInNavigator();
auto flagIs = m_metaInfo.visibleInNavigator();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -322,7 +323,7 @@ bool NodeHints::visibleInNavigator() const
bool NodeHints::visibleInLibrary() const
{
auto flagIs = m_modelNode.metaInfo().visibleInLibrary();
auto flagIs = m_metaInfo.visibleInLibrary();
if (flagIs != FlagIs::Set)
return convert(flagIs);
@@ -391,9 +392,9 @@ NodeHints NodeHints::fromModelNode(const ModelNode &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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -178,8 +178,10 @@ TypeAnnotationReader::ParserSate TypeAnnotationReader::readDocument(const QStrin
TypeAnnotationReader::ParserSate TypeAnnotationReader::readMetaInfoRootElement(const QString &name)
{
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();
return ParsingType;
} else {
addErrorInvalidType(name);

View File

@@ -20,6 +20,7 @@ MATCHER_P2(IsTypeHint,
template<typename PropertiesMatcher, typename ExtraFilePathsMatcher>
auto IsItemLibraryEntry(QmlDesigner::TypeId typeId,
Utils::SmallStringView typeName,
Utils::SmallStringView name,
Utils::SmallStringView iconPath,
Utils::SmallStringView category,
@@ -31,6 +32,7 @@ auto IsItemLibraryEntry(QmlDesigner::TypeId typeId,
{
using QmlDesigner::Storage::Info::ItemLibraryEntry;
return AllOf(Field("typeId", &ItemLibraryEntry::typeId, typeId),
Field("typeName", &ItemLibraryEntry::typeName, typeName),
Field("name", &ItemLibraryEntry::name, name),
Field("iconPath", &ItemLibraryEntry::iconPath, iconPath),
Field("category", &ItemLibraryEntry::category, category),
@@ -66,7 +68,7 @@ auto IsTypeAnnotation(QmlDesigner::SourceId sourceId,
{
using QmlDesigner::Storage::Synchronization::TypeAnnotation;
return AllOf(Field("sourceId", &TypeAnnotation::sourceId, sourceId),
Field("sourceId", &TypeAnnotation::directorySourceId, directorySourceId),
Field("directory sourceId", &TypeAnnotation::directorySourceId, directorySourceId),
Field("typeName", &TypeAnnotation::typeName, typeName),
Field("moduleId", &TypeAnnotation::moduleId, moduleId),
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)
{
return out << R"((")" << entry.name << R"(", ")" << entry.iconPath << R"(", ")"
<< entry.category << R"(", ")" << entry.import << R"(", ")" << entry.toolTip
<< R"(", ")" << entry.templatePath << R"(", )" << entry.properties << ", "
<< entry.extraFilePaths << ")";
return out << R"((")" << entry.typeName << R"(", ")" << entry.name << R"(", ")"
<< entry.iconPath << R"(", ")" << entry.category << R"(", ")" << entry.import
<< R"(", ")" << entry.toolTip << R"(", ")" << entry.templatePath << R"(", )"
<< entry.properties << ", " << entry.extraFilePaths << ")";
}
} // namespace Storage::Info

View File

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

View File

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

View File

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

View File

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