QmlDesigner: Create arbitrary type for effects to identify them in qds

Using arbitrary type name because at this time we don't have effect maker specific type

Task-number: QDS-8729
Change-Id: I3f70e241a03e0ce14512af1cafa066ef0a6c90d5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Amr Essam
2023-01-04 18:19:00 +02:00
committed by Amr Elsayed
parent 1482bc0ae1
commit 63e885e7a1
3 changed files with 8 additions and 10 deletions

View File

@@ -8,6 +8,7 @@
#include "qmldesignericons.h"
#include "qmldesignerplugin.h"
#include "assetslibrarywidget.h"
#include "commontypecache.h"
#include "nameitemdelegate.h"
#include "iconcheckboxitemdelegate.h"
@@ -273,10 +274,9 @@ void NavigatorView::dragStarted(QMimeData *mimeData)
auto assetTypeAndData = AssetsLibraryWidget::getAssetTypeAndData(assetsPaths[0]);
QString assetType = assetTypeAndData.first;
if (assetType == Constants::MIME_TYPE_ASSET_EFFECT) {
qint32 internalId = mimeData->data(Constants::MIME_TYPE_ASSET_EFFECT).toInt();
ModelNode effectNode = modelNodeForInternalId(internalId);
m_widget->setDragType(effectNode.metaInfo().typeName());
// We use arbitrary type name because at this time we don't have effect maker
// specific type
m_widget->setDragType(Storage::Info::EffectMaker);
m_widget->update();
}
}

View File

@@ -2537,12 +2537,9 @@ bool NodeMetaInfo::isColor() const
bool NodeMetaInfo::isEffectMaker() const
{
if constexpr (useProjectStorage()) {
using namespace Storage::Info;
return isBasedOnCommonType<Effect, Item>(m_projectStorage, m_typeId);
} else {
return isValid() && m_privateData->properties().contains("layer.effect");
}
// We use arbitrary type name because at this time we don't have effect maker
// specific type
return typeName() == QString::fromUtf8(Storage::Info::EffectMaker);
}
bool NodeMetaInfo::isBool() const

View File

@@ -35,6 +35,7 @@ inline constexpr char DefaultMaterial[] = "DefaultMaterial";
inline constexpr char Dialog[] = "Dialog";
inline constexpr char DoubleType[] = "double";
inline constexpr char Effect[] = "Effect";
inline constexpr char EffectMaker[] = "EffectMaker";
inline constexpr char FloatType[] = "float";
inline constexpr char FlowActionArea[] = "FlowActionArea";
inline constexpr char FlowDecision[] = "FlowDecision";