forked from qt-creator/qt-creator
QmlDesigner: Refactor isSubClass
IsSubClass is renamed to isBasedOn and takes now NodeMetaInfo as a parameter. But for most cases there are is... functions as short cut. The model is providing shortcut NodeMetaInfos too. This is done in the sake of caching. Task-number: QDS-7445 Change-Id: Iff2dea66e253b412105427134bd49cb16ed76193 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
fa033876e6
commit
da36459759
@@ -103,7 +103,7 @@ QJsonObject Component::nodeToJson(const ModelNode &node)
|
||||
QJsonObject jsonObject;
|
||||
|
||||
// Don't export States, Connection, Timeline etc nodes.
|
||||
if (!node.isSubclassOf("QtQuick.Item"))
|
||||
if (!node.metaInfo().isQtQuickItem())
|
||||
return {};
|
||||
|
||||
std::unique_ptr<NodeDumper> dumper(createNodeDumper(node));
|
||||
|
@@ -175,7 +175,7 @@ void ActionEditor::prepareConnections()
|
||||
|
||||
auto isSkippedType = [](auto &&type) {
|
||||
return !(type.isString() || type.isInteger() || type.isBool() || type.isColor()
|
||||
|| type.isFloat() || type.isQmlItem());
|
||||
|| type.isFloat() || type.isQtObject());
|
||||
};
|
||||
static QList<PropertyName> methodBlackList({"toString", "destroy"});
|
||||
|
||||
|
@@ -203,8 +203,10 @@ bool DesignerActionManager::hasModelNodePreviewHandler(const ModelNode &node) co
|
||||
{
|
||||
const bool isComponent = node.isComponent();
|
||||
for (const auto &handler : qAsConst(m_modelNodePreviewImageHandlers)) {
|
||||
if ((isComponent || !handler.componentOnly) && node.isSubclassOf(handler.type))
|
||||
return true;
|
||||
if ((isComponent || !handler.componentOnly)) {
|
||||
if (auto base = node.model()->metaInfo(handler.type); node.metaInfo().isBasedOn(base))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -215,10 +217,11 @@ ModelNodePreviewImageOperation DesignerActionManager::modelNodePreviewOperation(
|
||||
int prio = -1;
|
||||
const bool isComponent = node.isComponent();
|
||||
for (const auto &handler : qAsConst(m_modelNodePreviewImageHandlers)) {
|
||||
if ((isComponent || !handler.componentOnly) && handler.priority > prio
|
||||
&& node.isSubclassOf(handler.type)) {
|
||||
op = handler.operation;
|
||||
prio = handler.priority;
|
||||
if ((isComponent || !handler.componentOnly) && handler.priority > prio) {
|
||||
if (auto base = node.model()->metaInfo(handler.type); node.metaInfo().isBasedOn(base)) {
|
||||
op = handler.operation;
|
||||
prio = handler.priority;
|
||||
}
|
||||
}
|
||||
}
|
||||
return op;
|
||||
@@ -454,10 +457,7 @@ public:
|
||||
static bool isListViewInBaseState(const SelectionContext &selectionState)
|
||||
{
|
||||
return selectionState.isInBaseState() && selectionState.singleNodeIsSelected()
|
||||
&& (selectionState.currentSingleSelectedNode().metaInfo().isSubclassOf(
|
||||
"QtQuick.ListView")
|
||||
|| selectionState.currentSingleSelectedNode().metaInfo().isSubclassOf(
|
||||
"QtQuick.GridView"));
|
||||
&& selectionState.currentSingleSelectedNode().metaInfo().isListOrGridView();
|
||||
}
|
||||
|
||||
bool isEnabled(const SelectionContext &) const override { return true; }
|
||||
@@ -729,7 +729,7 @@ bool singleSelectionAndInQtQuickLayout(const SelectionContext &context)
|
||||
if (!metaInfo.isValid())
|
||||
return false;
|
||||
|
||||
return metaInfo.isSubclassOf("QtQuick.Layouts.Layout");
|
||||
return metaInfo.isQtQuickLayoutsLayout();
|
||||
}
|
||||
|
||||
bool isStackedContainer(const SelectionContext &context)
|
||||
@@ -823,7 +823,7 @@ bool isGroup(const SelectionContext &context)
|
||||
if (!metaInfo.isValid())
|
||||
return false;
|
||||
|
||||
return metaInfo.isSubclassOf("QtQuick.Studio.Components.GroupItem");
|
||||
return metaInfo.isQtQuickStudioComponentsGroupItem();
|
||||
}
|
||||
|
||||
bool isLayout(const SelectionContext &context)
|
||||
@@ -848,7 +848,7 @@ bool isLayout(const SelectionContext &context)
|
||||
if (isStackedContainer(context))
|
||||
return false;
|
||||
|
||||
return metaInfo.isSubclassOf("QtQuick.Layouts.Layout");
|
||||
return metaInfo.isQtQuickLayoutsLayout();
|
||||
}
|
||||
|
||||
bool isPositioner(const SelectionContext &context)
|
||||
@@ -866,11 +866,7 @@ bool isPositioner(const SelectionContext &context)
|
||||
|
||||
NodeMetaInfo metaInfo = currentSelectedNode.metaInfo();
|
||||
|
||||
if (!metaInfo.isValid())
|
||||
return false;
|
||||
|
||||
return metaInfo.isSubclassOf("<cpp>.QDeclarativeBasePositioner")
|
||||
|| metaInfo.isSubclassOf("QtQuick.Positioner");
|
||||
return metaInfo.isQtQuickPositioner();
|
||||
}
|
||||
|
||||
bool layoutOptionVisible(const SelectionContext &context)
|
||||
|
@@ -14,6 +14,25 @@
|
||||
namespace QmlDesigner {
|
||||
namespace FormatOperation{
|
||||
|
||||
namespace {
|
||||
struct StylePropertyStruct
|
||||
{
|
||||
QString id;
|
||||
QStringList subclasses;
|
||||
QStringList properties;
|
||||
};
|
||||
|
||||
struct StyleProperties
|
||||
{
|
||||
QmlDesigner::PropertyName propertyName;
|
||||
QVariant value;
|
||||
};
|
||||
|
||||
QList<StylePropertyStruct> copyableProperties = {};
|
||||
QList<StyleProperties> applyableProperties = {};
|
||||
StylePropertyStruct chosenItem = {};
|
||||
} // namespace
|
||||
|
||||
void readFormatConfiguration(){
|
||||
|
||||
if (copyableProperties.isEmpty()){
|
||||
@@ -69,10 +88,11 @@ bool propertiesCopyable(const SelectionContext &selectionState)
|
||||
ModelNode modelNode = selectionState.currentSingleSelectedNode();
|
||||
|
||||
for (StylePropertyStruct copyable : copyableProperties)
|
||||
for (QString copyableSubclass : copyable.subclasses)
|
||||
if (modelNode.metaInfo().isSubclassOf(copyableSubclass.toUtf8()))
|
||||
for (QString copyableSubclass : copyable.subclasses) {
|
||||
auto base = modelNode.model()->metaInfo(copyableSubclass.toUtf8());
|
||||
if (modelNode.metaInfo().isBasedOn(base))
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -87,8 +107,9 @@ bool propertiesApplyable(const SelectionContext &selectionState)
|
||||
const ModelNode firstSelectedNode = selectionState.firstSelectedModelNode();
|
||||
bool found = false;
|
||||
|
||||
for (QString copyableSubclass : chosenItem.subclasses){
|
||||
if (firstSelectedNode.metaInfo().isSubclassOf(copyableSubclass.toUtf8())){
|
||||
for (QString copyableSubclass : chosenItem.subclasses) {
|
||||
auto base = firstSelectedNode.model()->metaInfo(copyableSubclass.toUtf8());
|
||||
if (firstSelectedNode.metaInfo().isBasedOn(base)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -100,11 +121,13 @@ bool propertiesApplyable(const SelectionContext &selectionState)
|
||||
for (const ModelNode &modelNode : selectionState.selectedModelNodes()){
|
||||
found = false;
|
||||
|
||||
for (QString subclass : chosenItem.subclasses)
|
||||
if (modelNode.metaInfo().isSubclassOf(subclass.toUtf8())){
|
||||
for (QString subclass : chosenItem.subclasses) {
|
||||
auto base = modelNode.model()->metaInfo(subclass.toUtf8());
|
||||
if (modelNode.metaInfo().isBasedOn(base)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
continue;
|
||||
@@ -120,28 +143,29 @@ void copyFormat(const SelectionContext &selectionState)
|
||||
if (!selectionState.view())
|
||||
return;
|
||||
|
||||
selectionState.view()->executeInTransaction("DesignerActionManager|copyFormat",[selectionState](){
|
||||
|
||||
selectionState.view()->executeInTransaction("DesignerActionManager|copyFormat", [selectionState]() {
|
||||
applyableProperties.clear();
|
||||
|
||||
ModelNode node = selectionState.currentSingleSelectedNode();
|
||||
QStringList propertyList;
|
||||
for (StylePropertyStruct copyable : copyableProperties){
|
||||
bool found = false;
|
||||
for (QString copyableSubclass : copyable.subclasses)
|
||||
if (node.metaInfo().isSubclassOf(copyableSubclass.toUtf8())){
|
||||
for (QString copyableSubclass : copyable.subclasses) {
|
||||
auto base = node.model()->metaInfo(copyableSubclass.toUtf8());
|
||||
if (node.metaInfo().isBasedOn(base)) {
|
||||
propertyList = copyable.properties;
|
||||
chosenItem = copyable;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QmlObjectNode qmlObjectNode(node);
|
||||
|
||||
for (auto propertyName : propertyList){
|
||||
for (auto propertyName : propertyList) {
|
||||
if (qmlObjectNode.propertyAffectedByCurrentState(propertyName.toUtf8())) {
|
||||
StyleProperties property;
|
||||
property.propertyName = propertyName.toUtf8();
|
||||
@@ -165,12 +189,14 @@ void applyFormat(const SelectionContext &selectionState)
|
||||
|
||||
for (StylePropertyStruct copyable : copyableProperties){
|
||||
bool found = false;
|
||||
for (QString copyableSubclass : copyable.subclasses)
|
||||
if (node.metaInfo().isSubclassOf(copyableSubclass.toUtf8())){
|
||||
for (QString copyableSubclass : copyable.subclasses) {
|
||||
auto base = node.model()->metaInfo(copyableSubclass.toUtf8());
|
||||
if (node.metaInfo().isBasedOn(base)) {
|
||||
propertyList = copyable.properties;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
|
@@ -8,23 +8,6 @@
|
||||
namespace QmlDesigner {
|
||||
namespace FormatOperation {
|
||||
|
||||
struct StylePropertyStruct
|
||||
{
|
||||
QString id;
|
||||
QStringList subclasses;
|
||||
QStringList properties;
|
||||
};
|
||||
|
||||
struct StyleProperties
|
||||
{
|
||||
QmlDesigner::PropertyName propertyName;
|
||||
QVariant value;
|
||||
};
|
||||
|
||||
static QList<StylePropertyStruct> copyableProperties = {};
|
||||
static QList<StyleProperties> applyableProperties = {};
|
||||
static StylePropertyStruct chosenItem = {};
|
||||
|
||||
bool propertiesCopyable(const SelectionContext &selectionState);
|
||||
bool propertiesApplyable(const SelectionContext &selectionState);
|
||||
void copyFormat(const SelectionContext &selectionState);
|
||||
|
@@ -45,7 +45,7 @@ inline bool singleSelection(const SelectionContext &selectionState)
|
||||
inline bool isModel(const SelectionContext &selectionState)
|
||||
{
|
||||
ModelNode node = selectionState.currentSingleSelectedNode();
|
||||
return node.isValid() && node.isSubclassOf("QtQuick3D.Model");
|
||||
return node.isValid() && node.metaInfo().isQtQuick3DModel();
|
||||
}
|
||||
|
||||
inline bool modelHasMaterial(const SelectionContext &selectionState)
|
||||
|
@@ -845,8 +845,7 @@ void addItemToStackedContainer(const SelectionContext &selectionContext)
|
||||
if (bindingTarget.isValid()) { // In this case the stacked container might be hooked up to a TabBar
|
||||
potentialTabBar = bindingTarget.parentModelNode();
|
||||
|
||||
if (!(potentialTabBar.metaInfo().isValid()
|
||||
&& potentialTabBar.metaInfo().isSubclassOf("QtQuick.Controls.TabBar")))
|
||||
if (!potentialTabBar.metaInfo().isQtQuickControlsTabBar())
|
||||
potentialTabBar = ModelNode();
|
||||
}
|
||||
}
|
||||
|
@@ -55,31 +55,32 @@ void BackendModel::resetModel()
|
||||
if (rewriterView)
|
||||
for (const QmlTypeData &cppTypeData : rewriterView->getQMLTypes())
|
||||
if (cppTypeData.isSingleton) {
|
||||
NodeMetaInfo metaInfo = m_connectionView->model()->metaInfo(cppTypeData.typeName.toUtf8());
|
||||
if (metaInfo.isValid() && !metaInfo.isSubclassOf("QtQuick.Item")) {
|
||||
auto type = new QStandardItem(cppTypeData.typeName);
|
||||
type->setData(cppTypeData.typeName, Qt::UserRole + 1);
|
||||
type->setData(true, Qt::UserRole + 2);
|
||||
type->setEditable(false);
|
||||
NodeMetaInfo metaInfo = m_connectionView->model()->metaInfo(
|
||||
cppTypeData.typeName.toUtf8());
|
||||
if (metaInfo.isValid() && !metaInfo.isQtQuickItem()) {
|
||||
auto type = new QStandardItem(cppTypeData.typeName);
|
||||
type->setData(cppTypeData.typeName, Qt::UserRole + 1);
|
||||
type->setData(true, Qt::UserRole + 2);
|
||||
type->setEditable(false);
|
||||
|
||||
auto name = new QStandardItem(cppTypeData.typeName);
|
||||
name->setEditable(false);
|
||||
auto name = new QStandardItem(cppTypeData.typeName);
|
||||
name->setEditable(false);
|
||||
|
||||
QStandardItem *singletonItem = new QStandardItem("");
|
||||
singletonItem->setCheckState(Qt::Checked);
|
||||
QStandardItem *singletonItem = new QStandardItem("");
|
||||
singletonItem->setCheckState(Qt::Checked);
|
||||
|
||||
singletonItem->setCheckable(true);
|
||||
singletonItem->setEnabled(false);
|
||||
singletonItem->setCheckable(true);
|
||||
singletonItem->setEnabled(false);
|
||||
|
||||
QStandardItem *inlineItem = new QStandardItem("");
|
||||
QStandardItem *inlineItem = new QStandardItem("");
|
||||
|
||||
inlineItem->setCheckState(Qt::Unchecked);
|
||||
inlineItem->setCheckState(Qt::Unchecked);
|
||||
|
||||
inlineItem->setCheckable(true);
|
||||
inlineItem->setEnabled(false);
|
||||
inlineItem->setCheckable(true);
|
||||
inlineItem->setEnabled(false);
|
||||
|
||||
appendRow({ type, name, singletonItem, inlineItem });
|
||||
}
|
||||
appendRow({type, name, singletonItem, inlineItem});
|
||||
}
|
||||
}
|
||||
|
||||
if (rootNode.isValid()) {
|
||||
@@ -88,7 +89,7 @@ void BackendModel::resetModel()
|
||||
if (property.isDynamic() && !simpleTypes.contains(property.dynamicTypeName())) {
|
||||
|
||||
NodeMetaInfo metaInfo = m_connectionView->model()->metaInfo(property.dynamicTypeName());
|
||||
if (metaInfo.isValid() && !metaInfo.isSubclassOf("QtQuick.Item")) {
|
||||
if (metaInfo.isValid() && !metaInfo.isQtQuickItem()) {
|
||||
QStandardItem *type = new QStandardItem(QString::fromUtf8(property.dynamicTypeName()));
|
||||
type->setEditable(false);
|
||||
|
||||
|
@@ -281,7 +281,7 @@ QWidget *ConnectionDelegate::createEditor(QWidget *parent, const QStyleOptionVie
|
||||
if (propertyType.isValid() && propertyType.isFileComponent()) {
|
||||
if (!property.isEnumType() && !property.isPrivate()
|
||||
&& !property.isListProperty() && !property.isPointer()) {
|
||||
if (propertyType.isQmlItem()) {
|
||||
if (propertyType.isQtObject()) {
|
||||
connectionComboBox->addItem(itemName + "." + property.name());
|
||||
}
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include <easingcurve.h>
|
||||
#include <nodeabstractproperty.h>
|
||||
#include <nodelistproperty.h>
|
||||
#include <nodemetainfo.h>
|
||||
#include <variantproperty.h>
|
||||
#include <qmlstate.h>
|
||||
#include <qmltimeline.h>
|
||||
@@ -181,7 +182,7 @@ QmlTimeline CurveEditorView::activeTimeline() const
|
||||
|
||||
QmlModelState state = currentState();
|
||||
if (state.isBaseState()) {
|
||||
for (const ModelNode &node : allModelNodesOfType("QtQuick.Timeline.Timeline")) {
|
||||
for (const ModelNode &node : allModelNodesOfType(model()->qtQuickTimelineTimelineMetaInfo())) {
|
||||
if (QmlTimeline::isValidQmlTimeline(node)) {
|
||||
if (node.hasVariantProperty("enabled")
|
||||
&& node.variantProperty("enabled").value().toBool())
|
||||
@@ -191,7 +192,7 @@ QmlTimeline CurveEditorView::activeTimeline() const
|
||||
return {};
|
||||
}
|
||||
|
||||
for (const ModelNode &node : allModelNodesOfType("QtQuick.Timeline.Timeline")) {
|
||||
for (const ModelNode &node : allModelNodesOfType(model()->qtQuickTimelineTimelineMetaInfo())) {
|
||||
if (QmlTimeline::isValidQmlTimeline(node) && state.affectsModelNode(node)) {
|
||||
QmlPropertyChanges propertyChanges(state.propertyChanges(node));
|
||||
if (!propertyChanges.isValid())
|
||||
|
@@ -93,7 +93,7 @@ Edit3DCameraAction::Edit3DCameraAction(const QByteArray &menuId, View3DActionCom
|
||||
bool Edit3DCameraAction::isEnabled(const SelectionContext &selectionContext) const
|
||||
{
|
||||
return Utils::anyOf(selectionContext.selectedModelNodes(), [](const ModelNode &node) {
|
||||
return node.isValid() && node.metaInfo().isSubclassOf("QQuick3D.Camera");
|
||||
return node.isValid() && node.metaInfo().isQtQuick3DCamera();
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -173,7 +173,7 @@ void Edit3DCanvas::dropEvent(QDropEvent *e)
|
||||
m_parent->view()->setSelectedModelNode(modelNode);
|
||||
|
||||
// if added node is a Model, assign it a material
|
||||
if (modelNode.isSubclassOf("QtQuick3D.Model"))
|
||||
if (modelNode.metaInfo().isQtQuick3DModel())
|
||||
m_parent->view()->assignMaterialTo3dModel(modelNode);
|
||||
});
|
||||
}
|
||||
|
@@ -69,8 +69,7 @@ void ContentNotEditableIndicator::addAddiationEntries(const QList<FormEditorItem
|
||||
{
|
||||
for (FormEditorItem *formEditorItem : itemList) {
|
||||
const ModelNode modelNode = formEditorItem->qmlItemNode().modelNode();
|
||||
if (modelNode.metaInfo().isValid() && modelNode.metaInfo().isSubclassOf("QtQuick.Loader")) {
|
||||
|
||||
if (modelNode.metaInfo().isValid() && modelNode.metaInfo().isQtQuickLoader()) {
|
||||
if (!m_entryList.contains(EntryPair(formEditorItem, 0))) {
|
||||
auto indicatorShape = new QGraphicsRectItem(m_layerItem);
|
||||
QPen linePen;
|
||||
@@ -84,7 +83,6 @@ void ContentNotEditableIndicator::addAddiationEntries(const QList<FormEditorItem
|
||||
|
||||
m_entryList.append(EntryPair(formEditorItem, indicatorShape));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -396,8 +396,10 @@ void DragTool::handleView3dDrop()
|
||||
{
|
||||
// If a View3D is dropped, we need to assign material to the included model
|
||||
for (const QmlItemNode &dragNode : qAsConst(m_dragNodes)) {
|
||||
if (dragNode.modelNode().isSubclassOf("QtQuick3D.View3D")) {
|
||||
const QList<ModelNode> models = dragNode.modelNode().subModelNodesOfType("QtQuick3D.Model");
|
||||
if (dragNode.modelNode().metaInfo().isQtQuick3DView3D()) {
|
||||
auto model = dragNode.model();
|
||||
const QList<ModelNode> models = dragNode.modelNode().subModelNodesOfType(
|
||||
model->qtQuick3DModelMetaInfo());
|
||||
QTC_ASSERT(models.size() == 1, return);
|
||||
view()->assignMaterialTo3dModel(models.at(0));
|
||||
}
|
||||
|
@@ -564,8 +564,11 @@ void DesignDocument::paste()
|
||||
targetNode = targetNode.parentProperty().parentModelNode();
|
||||
} else if (view.selectedModelNodes().isEmpty()) {
|
||||
// if selection is empty and copied nodes are all 3D nodes, paste them under the active scene
|
||||
bool all3DNodes = std::find_if(selectedNodes.cbegin(), selectedNodes.cend(),
|
||||
[](const ModelNode &node) { return !node.isSubclassOf("QtQuick3D.Node"); })
|
||||
bool all3DNodes = std::find_if(selectedNodes.cbegin(),
|
||||
selectedNodes.cend(),
|
||||
[](const ModelNode &node) {
|
||||
return !node.metaInfo().isQtQuick3DNode();
|
||||
})
|
||||
== selectedNodes.cend();
|
||||
if (all3DNodes) {
|
||||
auto data = rootModelNode().auxiliaryData(active3dSceneProperty);
|
||||
@@ -617,7 +620,7 @@ void DesignDocument::paste()
|
||||
targetNode = view.firstSelectedModelNode();
|
||||
} else {
|
||||
// if selection is empty and this is a 3D Node, paste it under the active scene
|
||||
if (pastedNode.isSubclassOf("QtQuick3D.Node")) {
|
||||
if (pastedNode.metaInfo().isQtQuick3DNode()) {
|
||||
auto data = rootModelNode().auxiliaryData(active3dSceneProperty);
|
||||
if (data) {
|
||||
if (int activeSceneId = data->toInt(); activeSceneId != -1) {
|
||||
|
@@ -388,13 +388,11 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
|
||||
&& (metaInfo.majorVersion() >= entry.majorVersion()
|
||||
|| metaInfo.majorVersion() < 0);
|
||||
|
||||
bool isItem = valid && metaInfo.isSubclassOf("QtQuick.Item");
|
||||
bool isItem = valid && metaInfo.isQtQuickItem();
|
||||
bool forceVisibility = valid && NodeHints::fromItemLibraryEntry(entry).visibleInLibrary();
|
||||
|
||||
if (m_flowMode && metaInfo.isValid()) {
|
||||
isItem = metaInfo.isSubclassOf("FlowView.FlowItem")
|
||||
|| metaInfo.isSubclassOf("FlowView.FlowWildcard")
|
||||
|| metaInfo.isSubclassOf("FlowView.FlowDecision");
|
||||
if (m_flowMode) {
|
||||
isItem = metaInfo.isFlowViewItem();
|
||||
forceVisibility = isItem;
|
||||
}
|
||||
|
||||
|
@@ -2,10 +2,9 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "materialbrowserview.h"
|
||||
|
||||
#include "bindingproperty.h"
|
||||
#include "materialbrowserwidget.h"
|
||||
#include "materialbrowsermodel.h"
|
||||
#include "materialbrowserwidget.h"
|
||||
#include "nodeabstractproperty.h"
|
||||
#include "nodemetainfo.h"
|
||||
#include "qmlobjectnode.h"
|
||||
@@ -14,6 +13,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <designmodecontext.h>
|
||||
#include <nodeinstanceview.h>
|
||||
#include <nodemetainfo.h>
|
||||
#include <qmldesignerconstants.h>
|
||||
|
||||
#include <QQuickItem>
|
||||
@@ -107,7 +107,8 @@ void MaterialBrowserView::modelAttached(Model *model)
|
||||
AbstractView::modelAttached(model);
|
||||
|
||||
m_widget->clearSearchFilter();
|
||||
m_widget->materialBrowserModel()->setHasMaterialRoot(rootModelNode().isSubclassOf("QtQuick3D.Material"));
|
||||
m_widget->materialBrowserModel()->setHasMaterialRoot(
|
||||
rootModelNode().metaInfo().isQtQuick3DMaterial());
|
||||
m_hasQuick3DImport = model->hasImport("QtQuick3D");
|
||||
|
||||
loadPropertyGroups();
|
||||
@@ -148,7 +149,7 @@ bool MaterialBrowserView::isMaterial(const ModelNode &node) const
|
||||
if (!node.isValid())
|
||||
return false;
|
||||
|
||||
return node.isSubclassOf("QtQuick3D.Material");
|
||||
return node.metaInfo().isQtQuick3DMaterial();
|
||||
}
|
||||
|
||||
void MaterialBrowserView::modelAboutToBeDetached(Model *model)
|
||||
@@ -164,7 +165,7 @@ void MaterialBrowserView::selectedNodesChanged(const QList<ModelNode> &selectedN
|
||||
ModelNode selectedModel;
|
||||
|
||||
for (const ModelNode &node : selectedNodeList) {
|
||||
if (node.isSubclassOf("QtQuick3D.Model")) {
|
||||
if (node.metaInfo().isQtQuick3DModel()) {
|
||||
selectedModel = node;
|
||||
break;
|
||||
}
|
||||
|
@@ -672,7 +672,7 @@ void MaterialEditorView::updatePossibleTypes()
|
||||
bool valid = metaInfo.isValid()
|
||||
&& (metaInfo.majorVersion() >= entry.majorVersion()
|
||||
|| metaInfo.majorVersion() < 0);
|
||||
if (valid && metaInfo.isSubclassOf("QtQuick3D.Material")) {
|
||||
if (valid && metaInfo.isQtQuick3DMaterial()) {
|
||||
bool addImport = entry.requiredImport().isEmpty();
|
||||
if (!addImport) {
|
||||
Import import = entryToImport(entry);
|
||||
@@ -695,7 +695,7 @@ void MaterialEditorView::modelAttached(Model *model)
|
||||
m_locked = true;
|
||||
|
||||
m_hasQuick3DImport = model->hasImport("QtQuick3D");
|
||||
m_hasMaterialRoot = rootModelNode().isSubclassOf("QtQuick3D.Material");
|
||||
m_hasMaterialRoot = rootModelNode().metaInfo().isQtQuick3DMaterial();
|
||||
|
||||
if (m_hasMaterialRoot) {
|
||||
m_selectedMaterial = rootModelNode();
|
||||
@@ -838,7 +838,7 @@ void MaterialEditorView::selectedNodesChanged(const QList<ModelNode> &selectedNo
|
||||
m_selectedModels.clear();
|
||||
|
||||
for (const ModelNode &node : selectedNodeList) {
|
||||
if (node.isSubclassOf("QtQuick3D.Model"))
|
||||
if (node.metaInfo().isQtQuick3DModel())
|
||||
m_selectedModels.append(node);
|
||||
}
|
||||
|
||||
|
@@ -37,54 +37,51 @@ ChooseFromPropertyListFilter::ChooseFromPropertyListFilter(const NodeMetaInfo &i
|
||||
// Material
|
||||
// -> Model
|
||||
|
||||
const TypeName textureType = "QtQuick3D.Texture";
|
||||
if (insertInfo.isSubclassOf(textureType)) {
|
||||
const TypeName textureTypeCpp = "<cpp>.QQuick3DTexture";
|
||||
if (parentInfo.isSubclassOf("QtQuick3D.DefaultMaterial")
|
||||
|| parentInfo.isSubclassOf("QtQuick3D.PrincipledMaterial")) {
|
||||
if (insertInfo.isQtQuick3DTexture()) {
|
||||
if (parentInfo.isQtQuick3DDefaultMaterial() || parentInfo.isQtQuick3DPrincipledMaterial()) {
|
||||
// All texture properties are valid targets
|
||||
for (const auto &property : parentInfo.properties()) {
|
||||
const TypeName &propType = property.propertyType().typeName();
|
||||
if (propType == textureType || propType == textureTypeCpp) {
|
||||
const auto &propType = property.propertyType();
|
||||
if (propType.isQtQuick3DTexture()) {
|
||||
propertyList.append(QString::fromUtf8(property.name()));
|
||||
if (breakOnFirst)
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (parentInfo.isSubclassOf("QtQuick3D.Particles3D.SpriteParticle3D")) {
|
||||
} else if (parentInfo.isQtQuick3DParticles3DSpriteParticle3D()) {
|
||||
propertyList.append("sprite");
|
||||
} else if (parentInfo.isSubclassOf("QtQuick3D.TextureInput")) {
|
||||
} else if (parentInfo.isQtQuick3DTextureInput()) {
|
||||
propertyList.append("texture");
|
||||
} else if (parentInfo.isSubclassOf("QtQuick3D.SceneEnvironment")) {
|
||||
} else if (parentInfo.isQtQuick3DSceneEnvironment()) {
|
||||
propertyList.append("lightProbe");
|
||||
}
|
||||
} else if (insertInfo.isSubclassOf("QtQuick3D.Effect")) {
|
||||
if (parentInfo.isSubclassOf("QtQuick3D.SceneEnvironment"))
|
||||
} else if (insertInfo.isQtQuick3DEffect()) {
|
||||
if (parentInfo.isQtQuick3DSceneEnvironment())
|
||||
propertyList.append("effects");
|
||||
} else if (insertInfo.isSubclassOf("QtQuick3D.Shader")) {
|
||||
if (parentInfo.isSubclassOf("QtQuick3D.Pass"))
|
||||
} else if (insertInfo.isQtQuick3DShader()) {
|
||||
if (parentInfo.isQtQuick3DPass())
|
||||
propertyList.append("shaders");
|
||||
} else if (insertInfo.isSubclassOf("QtQuick3D.Command")) {
|
||||
if (parentInfo.isSubclassOf("QtQuick3D.Pass"))
|
||||
} else if (insertInfo.isQtQuick3DCommand()) {
|
||||
if (parentInfo.isQtQuick3DPass())
|
||||
propertyList.append("commands");
|
||||
} else if (insertInfo.isSubclassOf("QtQuick3D.Buffer")) {
|
||||
if (parentInfo.isSubclassOf("QtQuick3D.Pass"))
|
||||
} else if (insertInfo.isQtQuick3DBuffer()) {
|
||||
if (parentInfo.isQtQuick3DPass())
|
||||
propertyList.append("output");
|
||||
} else if (insertInfo.isSubclassOf("QtQuick3D.InstanceListEntry")) {
|
||||
if (parentInfo.isSubclassOf("QtQuick3D.InstanceList"))
|
||||
} else if (insertInfo.isQtQuick3DInstanceListEntry()) {
|
||||
if (parentInfo.isQtQuick3DInstanceList())
|
||||
propertyList.append("instances");
|
||||
} else if (insertInfo.isSubclassOf("QtQuick3D.Pass")) {
|
||||
if (parentInfo.isSubclassOf("QtQuick3D.Effect"))
|
||||
} else if (insertInfo.isQtQuick3DPass()) {
|
||||
if (parentInfo.isQtQuick3DEffect())
|
||||
propertyList.append("passes");
|
||||
} else if (insertInfo.isSubclassOf("QtQuick3D.Particles3D.Particle3D")) {
|
||||
if (parentInfo.isSubclassOf("QtQuick3D.Particles3D.ParticleEmitter3D"))
|
||||
} else if (insertInfo.isQtQuick3DParticles3DParticle3D()) {
|
||||
if (parentInfo.isQtQuick3DParticles3DParticleEmitter3D())
|
||||
propertyList.append("particle");
|
||||
} else if (insertInfo.isSubclassOf("QQuick3DParticleAbstractShape")) {
|
||||
if (parentInfo.isSubclassOf("QtQuick3D.Particles3D.ParticleEmitter3D")
|
||||
|| parentInfo.isSubclassOf("QtQuick3D.Particles3D.Attractor3D"))
|
||||
} else if (insertInfo.isQuick3DParticleAbstractShape()) {
|
||||
if (parentInfo.isQtQuick3DParticles3DParticleEmitter3D()
|
||||
|| parentInfo.isQtQuick3DParticles3DAttractor3D())
|
||||
propertyList.append("shape");
|
||||
} else if (insertInfo.isSubclassOf("QtQuick3D.Material")) {
|
||||
if (parentInfo.isSubclassOf("QtQuick3D.Particles3D.Model"))
|
||||
} else if (insertInfo.isQtQuick3DMaterial()) {
|
||||
if (parentInfo.isQtQuick3DParticles3DModel())
|
||||
propertyList.append("materials");
|
||||
}
|
||||
}
|
||||
|
@@ -672,9 +672,9 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in
|
||||
newQmlObjectNode = QmlItemNode::createQmlObjectNode(m_view, itemLibraryEntry, QPointF(), targetProperty, false);
|
||||
ModelNode newModelNode = newQmlObjectNode.modelNode();
|
||||
if (newModelNode.isValid()) {
|
||||
if (newModelNode.isSubclassOf("QtQuick3D.Material")) {
|
||||
if (newModelNode.metaInfo().isQtQuick3DMaterial()) {
|
||||
// Don't allow dropping materials on any node but Models
|
||||
if (!targetNode.isSubclassOf("QtQuick3D.Model")) {
|
||||
if (!targetNode.metaInfo().isQtQuick3DModel()) {
|
||||
newQmlObjectNode.destroy();
|
||||
return;
|
||||
}
|
||||
@@ -691,12 +691,12 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in
|
||||
TypeName selectedProp = dialog->selectedProperty();
|
||||
|
||||
// Pass and TextureInput can't have children, so we have to move nodes under parent
|
||||
if (((newModelNode.isSubclassOf("QtQuick3D.Shader")
|
||||
|| newModelNode.isSubclassOf("QtQuick3D.Command")
|
||||
|| newModelNode.isSubclassOf("QtQuick3D.Buffer"))
|
||||
&& targetProperty.parentModelNode().isSubclassOf("QtQuick3D.Pass"))
|
||||
|| (newModelNode.isSubclassOf("QtQuick3D.Texture")
|
||||
&& targetProperty.parentModelNode().isSubclassOf("QtQuick3D.TextureInput"))) {
|
||||
if (((newModelNode.metaInfo().isQtQuick3DShader()
|
||||
|| newModelNode.metaInfo().isQtQuick3DCommand()
|
||||
|| newModelNode.metaInfo().isQtQuick3DBuffer())
|
||||
&& targetProperty.parentModelNode().metaInfo().isQtQuick3DPass())
|
||||
|| (newModelNode.metaInfo().isQtQuick3DTexture()
|
||||
&& targetProperty.parentModelNode().metaInfo().isQtQuick3DTextureInput())) {
|
||||
if (moveNodeToParent(targetProperty, newQmlObjectNode)) {
|
||||
targetProperty = targetProperty.parentProperty();
|
||||
moveNodesAfter = false;
|
||||
@@ -715,11 +715,12 @@ void NavigatorTreeModel::handleItemLibraryItemDrop(const QMimeData *mimeData, in
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
if (newModelNode.isSubclassOf("QtQuick3D.View3D")) {
|
||||
const QList<ModelNode> models = newModelNode.subModelNodesOfType("QtQuick3D.Model");
|
||||
if (newModelNode.metaInfo().isQtQuick3DView3D()) {
|
||||
const QList<ModelNode> models = newModelNode.subModelNodesOfType(
|
||||
m_view->model()->qtQuick3DModelMetaInfo());
|
||||
QTC_ASSERT(models.size() == 1, return);
|
||||
m_view->assignMaterialTo3dModel(models.at(0));
|
||||
} else if (newModelNode.isSubclassOf("QtQuick3D.Model")) {
|
||||
} else if (newModelNode.metaInfo().isQtQuick3DModel()) {
|
||||
m_view->assignMaterialTo3dModel(newModelNode);
|
||||
}
|
||||
|
||||
@@ -773,7 +774,7 @@ void NavigatorTreeModel::handleMaterialDrop(const QMimeData *mimeData, int rowNu
|
||||
return;
|
||||
|
||||
ModelNode targetNode = targetProperty.parentModelNode();
|
||||
if (!targetNode.isSubclassOf("QtQuick3D.Model"))
|
||||
if (!targetNode.metaInfo().isQtQuick3DModel())
|
||||
return;
|
||||
|
||||
QByteArray data = mimeData->data(Constants::MIME_TYPE_MATERIAL);
|
||||
@@ -801,7 +802,7 @@ ModelNode NavigatorTreeModel::handleItemLibraryImageDrop(const QString &imagePat
|
||||
ModelNode newModelNode;
|
||||
|
||||
if (!dropAsImage3dTexture(targetNode, targetProperty, imagePathRelative, newModelNode, outMoveNodesAfter)) {
|
||||
if (targetNode.isSubclassOf("QtQuick.Image") || targetNode.isSubclassOf("QtQuick.BorderImage")) {
|
||||
if (targetNode.metaInfo().isQtQuickImage() || targetNode.metaInfo().isQtQuickBorderImage()) {
|
||||
// if dropping an image on an existing image, set the source
|
||||
targetNode.variantProperty("source").setValue(imagePathRelative);
|
||||
} else {
|
||||
@@ -827,7 +828,7 @@ ModelNode NavigatorTreeModel::handleItemLibraryFontDrop(const QString &fontFamil
|
||||
|
||||
ModelNode newModelNode;
|
||||
|
||||
if (targetNode.isSubclassOf("QtQuick.Text")) {
|
||||
if (targetNode.metaInfo().isQtQuickText()) {
|
||||
// if dropping into an existing Text, update font
|
||||
targetNode.variantProperty("font.family").setValue(fontFamily);
|
||||
} else {
|
||||
@@ -883,7 +884,7 @@ ModelNode NavigatorTreeModel::handleItemLibraryShaderDrop(const QString &shaderP
|
||||
|
||||
const QString relPath = DocumentManager::currentFilePath().toFileInfo().dir().relativeFilePath(shaderPath);
|
||||
|
||||
if (targetNode.isSubclassOf("QtQuick3D.Shader")) {
|
||||
if (targetNode.metaInfo().isQtQuick3DShader()) {
|
||||
// if dropping into an existing Shader, update
|
||||
targetNode.variantProperty("stage").setEnumeration(isFragShader ? "Shader.Fragment"
|
||||
: "Shader.Vertex");
|
||||
@@ -914,7 +915,7 @@ ModelNode NavigatorTreeModel::handleItemLibraryShaderDrop(const QString &shaderP
|
||||
newModelNode.setIdWithoutRefactoring(
|
||||
m_view->model()->generateNewId(fi.baseName(), "shader"));
|
||||
// Passes can't have children, so move shader node under parent
|
||||
if (targetProperty.parentModelNode().isSubclassOf("QtQuick3D.Pass")) {
|
||||
if (targetProperty.parentModelNode().metaInfo().isQtQuick3DPass()) {
|
||||
BindingProperty listProp = targetNode.bindingProperty("shaders");
|
||||
listProp.addModelNodeToArray(newModelNode);
|
||||
outMoveNodesAfter = !moveNodeToParent(targetProperty, newModelNode);
|
||||
@@ -936,7 +937,7 @@ ModelNode NavigatorTreeModel::handleItemLibrarySoundDrop(const QString &soundPat
|
||||
|
||||
const QString relPath = DocumentManager::currentFilePath().toFileInfo().dir().relativeFilePath(soundPath);
|
||||
|
||||
if (targetNode.isSubclassOf("QtMultimedia.SoundEffect")) {
|
||||
if (targetNode.metaInfo().isQtMultimediaSoundEffect()) {
|
||||
// if dropping into on an existing SoundEffect, update
|
||||
targetNode.variantProperty("source").setValue(relPath);
|
||||
} else {
|
||||
@@ -1014,8 +1015,8 @@ bool NavigatorTreeModel::dropAsImage3dTexture(const ModelNode &targetNode,
|
||||
});
|
||||
};
|
||||
|
||||
if (targetNode.isSubclassOf("QtQuick3D.DefaultMaterial")
|
||||
|| targetNode.isSubclassOf("QtQuick3D.PrincipledMaterial")) {
|
||||
if (targetNode.metaInfo().isQtQuick3DDefaultMaterial()
|
||||
|| targetNode.metaInfo().isQtQuick3DPrincipledMaterial()) {
|
||||
// if dropping an image on a material, create a texture instead of image
|
||||
// Show texture property selection dialog
|
||||
auto dialog = ChooseFromPropertyListDialog::createIfNeeded(targetNode,
|
||||
@@ -1037,16 +1038,16 @@ bool NavigatorTreeModel::dropAsImage3dTexture(const ModelNode &targetNode,
|
||||
|
||||
delete dialog;
|
||||
return true;
|
||||
} else if (targetNode.isSubclassOf("QtQuick3D.TextureInput")) {
|
||||
} else if (targetNode.metaInfo().isQtQuick3DTextureInput()) {
|
||||
bindToProperty("texture", true);
|
||||
return newNode.isValid();
|
||||
} else if (targetNode.isSubclassOf("QtQuick3D.Particles3D.SpriteParticle3D")) {
|
||||
} else if (targetNode.metaInfo().isQtQuick3DParticles3DSpriteParticle3D()) {
|
||||
bindToProperty("sprite", false);
|
||||
return newNode.isValid();
|
||||
} else if (targetNode.isSubclassOf("QtQuick3D.SceneEnvironment")) {
|
||||
} else if (targetNode.metaInfo().isQtQuick3DSceneEnvironment()) {
|
||||
bindToProperty("lightProbe", false);
|
||||
return newNode.isValid();
|
||||
} else if (targetNode.isSubclassOf("QtQuick3D.Texture")) {
|
||||
} else if (targetNode.metaInfo().isQtQuick3DTexture()) {
|
||||
// if dropping an image on an existing texture, set the source
|
||||
targetNode.variantProperty("source").setValue(imagePath);
|
||||
return true;
|
||||
@@ -1103,7 +1104,7 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty &parentProper
|
||||
for (const ModelNode &modelNode : modelNodes) {
|
||||
if (modelNode.isValid() && modelNode != parentProperty.parentModelNode()
|
||||
&& !modelNode.isAncestorOf(parentProperty.parentModelNode())
|
||||
&& (modelNode.metaInfo().isSubclassOf(propertyQmlType) || propertyQmlType.isAlias()
|
||||
&& (modelNode.metaInfo().isBasedOn(propertyQmlType) || propertyQmlType.isAlias()
|
||||
|| parentProperty.name() == "data"
|
||||
|| (parentProperty.parentModelNode().metaInfo().defaultPropertyName()
|
||||
== parentProperty.name()
|
||||
|
@@ -56,7 +56,7 @@ static int pathRankForModelNode(const ModelNode &modelNode) {
|
||||
if (modelNode.metaInfo().hasProperty("path")) {
|
||||
if (modelNode.hasNodeProperty("path")) {
|
||||
ModelNode pathNode = modelNode.nodeProperty("path").modelNode();
|
||||
if (pathNode.metaInfo().isSubclassOf("QtQuick.Path") && pathNode.hasNodeListProperty("pathElements")) {
|
||||
if (pathNode.metaInfo().isQtQuickPath() && pathNode.hasNodeListProperty("pathElements")) {
|
||||
const QList<ModelNode> pathElements = pathNode.nodeListProperty("pathElements")
|
||||
.toModelNodeList();
|
||||
if (pathElements.isEmpty())
|
||||
|
@@ -24,7 +24,7 @@ static bool isInEditedPath(const NodeAbstractProperty &propertyParent, const Mod
|
||||
if (editingPathViewModelNode.isValid()) {
|
||||
if (editingPathViewModelNode.hasNodeProperty("path")) {
|
||||
ModelNode pathModelNode = editingPathViewModelNode.nodeProperty("path").modelNode();
|
||||
if (pathModelNode.metaInfo().isSubclassOf("QtQuick.Path")) {
|
||||
if (pathModelNode.metaInfo().isQtQuickPath()) {
|
||||
if (propertyParent.name() == "pathElements" && propertyParent.parentModelNode() == pathModelNode)
|
||||
return true;
|
||||
}
|
||||
|
@@ -76,10 +76,12 @@ void ItemFilterModel::setupModel()
|
||||
m_lock = true;
|
||||
m_model.clear();
|
||||
|
||||
const auto nodes = m_selectionOnly ? m_modelNode.view()->selectedModelNodes() : m_modelNode.view()->allModelNodes();
|
||||
const auto nodes = m_selectionOnly ? m_modelNode.view()->selectedModelNodes()
|
||||
: m_modelNode.view()->allModelNodes();
|
||||
|
||||
auto base = m_modelNode.model()->metaInfo(m_typeFilter.toUtf8());
|
||||
for (const QmlDesigner::ModelNode &node : nodes) {
|
||||
if (node.hasId() && node.metaInfo().isValid() && node.metaInfo().isSubclassOf(m_typeFilter.toUtf8()))
|
||||
if (node.hasId() && node.metaInfo().isBasedOn(base))
|
||||
m_model.append(node.id());
|
||||
}
|
||||
|
||||
|
@@ -559,14 +559,13 @@ inline bool dotPropertyHeuristic(const QmlObjectNode &node, const NodeMetaInfo &
|
||||
|
||||
NodeMetaInfo propertyType = type.property(parentProperty).propertyType();
|
||||
|
||||
NodeMetaInfo itemInfo = node.view()->model()->metaInfo("QtQuick.Item");
|
||||
NodeMetaInfo textInfo = node.view()->model()->metaInfo("QtQuick.Text");
|
||||
NodeMetaInfo rectangleInfo = node.view()->model()->metaInfo("QtQuick.Rectangle");
|
||||
NodeMetaInfo imageInfo = node.view()->model()->metaInfo("QtQuick.Image");
|
||||
NodeMetaInfo itemInfo = node.view()->model()->qtQuickItemMetaInfo();
|
||||
NodeMetaInfo textInfo = node.view()->model()->qtQuickTextMetaInfo();
|
||||
NodeMetaInfo rectangleInfo = node.view()->model()->qtQuickRectangleMetaInfo();
|
||||
NodeMetaInfo imageInfo = node.view()->model()->qtQuickImageMetaInfo();
|
||||
|
||||
if (propertyType.isFont() || itemInfo.hasProperty(itemProperty)
|
||||
|| textInfo.isSubclassOf(propertyType) || rectangleInfo.isSubclassOf(propertyType)
|
||||
|| imageInfo.isSubclassOf(propertyType))
|
||||
|| propertyType.isBasedOn(textInfo, rectangleInfo, imageInfo))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -783,11 +782,9 @@ TypeName PropertyEditorQmlBackend::fixTypeNameForPanes(const TypeName &typeName)
|
||||
|
||||
static NodeMetaInfo findCommonSuperClass(const NodeMetaInfo &first, const NodeMetaInfo &second)
|
||||
{
|
||||
for (const NodeMetaInfo &info : first.superClasses()) {
|
||||
if (second.isSubclassOf(info.typeName()))
|
||||
return info;
|
||||
}
|
||||
return first;
|
||||
auto commonBase = first.commonBase(second);
|
||||
|
||||
return commonBase.isValid() ? commonBase : first;
|
||||
}
|
||||
|
||||
NodeMetaInfo PropertyEditorQmlBackend::findCommonAncestor(const ModelNode &node)
|
||||
@@ -803,8 +800,8 @@ NodeMetaInfo PropertyEditorQmlBackend::findCommonAncestor(const ModelNode &node)
|
||||
if (view->selectedModelNodes().count() > 1) {
|
||||
NodeMetaInfo commonClass = node.metaInfo();
|
||||
for (const ModelNode ¤tNode : view->selectedModelNodes()) {
|
||||
if (currentNode.metaInfo().isValid() && !currentNode.isSubclassOf(commonClass.typeName(), -1, -1))
|
||||
commonClass = findCommonSuperClass(currentNode.metaInfo(), commonClass);
|
||||
if (currentNode.metaInfo().isValid() && !currentNode.metaInfo().isBasedOn(commonClass))
|
||||
commonClass = findCommonSuperClass(currentNode.metaInfo(), commonClass);
|
||||
}
|
||||
return commonClass;
|
||||
}
|
||||
|
@@ -276,12 +276,16 @@ void PropertyEditorValue::setHasActiveDrag(bool val)
|
||||
}
|
||||
}
|
||||
|
||||
static bool isAllowedSubclassType(const QString &type, const QmlDesigner::NodeMetaInfo &metaInfo)
|
||||
static bool isAllowedSubclassType(const QString &type,
|
||||
const QmlDesigner::NodeMetaInfo &metaInfo,
|
||||
QmlDesigner::Model *model)
|
||||
{
|
||||
if (!metaInfo.isValid())
|
||||
return false;
|
||||
|
||||
return (metaInfo.isSubclassOf(type.toUtf8()));
|
||||
auto base = model->metaInfo(type.toUtf8());
|
||||
|
||||
return metaInfo.isBasedOn(base);
|
||||
}
|
||||
|
||||
bool PropertyEditorValue::isAvailable() const
|
||||
@@ -306,7 +310,7 @@ bool PropertyEditorValue::isAvailable() const
|
||||
//allowed item properties:
|
||||
const auto itemTypes = mcuAllowedItemProperties.keys();
|
||||
for (const auto &itemType : itemTypes) {
|
||||
if (isAllowedSubclassType(itemType, m_modelNode.metaInfo())) {
|
||||
if (isAllowedSubclassType(itemType, m_modelNode.metaInfo(), m_modelNode.model())) {
|
||||
const QmlDesigner::DesignerMcuManager::ItemProperties allowedItemProps =
|
||||
mcuAllowedItemProperties.value(itemType);
|
||||
if (allowedItemProps.properties.contains(pureNameStr)) {
|
||||
@@ -509,7 +513,7 @@ bool PropertyEditorValue::idListReplace(int idx, const QString &value)
|
||||
|
||||
void PropertyEditorValue::commitDrop(const QString &path)
|
||||
{
|
||||
if (m_modelNode.isSubclassOf("QtQuick3D.Material")
|
||||
if (m_modelNode.metaInfo().isQtQuick3DMaterial()
|
||||
&& m_modelNode.metaInfo().property(m_name).propertyType().isQtQuick3DTexture()) {
|
||||
// create a texture node
|
||||
QmlDesigner::NodeMetaInfo metaInfo = m_modelNode.view()->model()->metaInfo("QtQuick3D.Texture");
|
||||
|
@@ -82,7 +82,7 @@ void StatesEditorView::removeState(int nodeId)
|
||||
try {
|
||||
if (nodeId > 0 && hasModelNodeForInternalId(nodeId)) {
|
||||
ModelNode stateNode(modelNodeForInternalId(nodeId));
|
||||
Q_ASSERT(stateNode.metaInfo().isSubclassOf("QtQuick.State"));
|
||||
Q_ASSERT(stateNode.metaInfo().isQtQuickState());
|
||||
|
||||
QmlModelState modelState(stateNode);
|
||||
if (modelState.isValid()) {
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include "textedititem.h"
|
||||
|
||||
#include <formeditorscene.h>
|
||||
#include <model.h>
|
||||
#include <nodemetainfo.h>
|
||||
#include <rewritingexception.h>
|
||||
|
||||
@@ -50,9 +51,9 @@ void TextEditItem::setFormEditorItem(FormEditorItem *formEditorItem)
|
||||
NodeMetaInfo metaInfo = m_formEditorItem->qmlItemNode().modelNode().metaInfo();
|
||||
auto node = m_formEditorItem->qmlItemNode();
|
||||
auto font = node.instanceValue("font").value<QFont>();
|
||||
if (metaInfo.isValid() &&
|
||||
(metaInfo.isSubclassOf("QtQuick.TextEdit")
|
||||
|| metaInfo.isSubclassOf("QtQuick.Controls.TextArea"))) {
|
||||
auto model = node.modelNode().model();
|
||||
if (metaInfo.isBasedOn(model->qtQuickTextEditMetaInfo(),
|
||||
model->qtQuickControlsTextAreaMetaInfo())) {
|
||||
QSize maximumSize = rect.size().toSize();
|
||||
textEdit()->setFont(font);
|
||||
activateTextEdit(maximumSize);
|
||||
|
@@ -142,8 +142,7 @@ void TimelineActions::copyKeyframes(const QList<ModelNode> &keyframes)
|
||||
|
||||
bool isKeyframe(const ModelNode &node)
|
||||
{
|
||||
return node.isValid() && node.metaInfo().isValid()
|
||||
&& node.metaInfo().isSubclassOf("QtQuick.Timeline.Keyframe");
|
||||
return node.isValid() && node.metaInfo().isQtQuickTimelineKeyframe();
|
||||
}
|
||||
|
||||
QVariant getValue(const ModelNode &node)
|
||||
|
@@ -495,8 +495,7 @@ QList<ModelNode> TimelineView::getAnimations(const QmlTimeline &timeline)
|
||||
if (node.metaInfo().isValid() && node.hasParentProperty()
|
||||
&& (node.parentProperty().parentModelNode()
|
||||
== timeline.modelNode()))
|
||||
return node.metaInfo().isSubclassOf(
|
||||
"QtQuick.Timeline.TimelineAnimation");
|
||||
return node.metaInfo().isQtQuickTimelineTimelineAnimation();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <bindingproperty.h>
|
||||
#include <nodeabstractproperty.h>
|
||||
#include <nodemetainfo.h>
|
||||
#include <rewritertransaction.h>
|
||||
#include <rewritingexception.h>
|
||||
#include <theme.h>
|
||||
@@ -166,7 +167,7 @@ void TransitionEditorPropertyItem::invalidateBar()
|
||||
const ModelNode parent = m_animation.parentProperty().parentModelNode();
|
||||
|
||||
for (const ModelNode &child : parent.directSubModelNodes())
|
||||
if (child.hasMetaInfo() && child.isSubclassOf("QtQuick.PauseAnimation"))
|
||||
if (child.metaInfo().isQtQuickPauseAnimation())
|
||||
min = child.variantProperty("duration").value().toDouble();
|
||||
|
||||
max = m_animation.variantProperty("duration").value().toDouble() + min;
|
||||
@@ -199,7 +200,7 @@ ModelNode TransitionEditorPropertyItem::pauseAnimation() const
|
||||
const ModelNode parent = m_animation.parentProperty().parentModelNode();
|
||||
|
||||
for (const ModelNode &child : parent.directSubModelNodes())
|
||||
if (child.hasMetaInfo() && child.isSubclassOf("QtQuick.PauseAnimation"))
|
||||
if (child.metaInfo().isQtQuickPauseAnimation())
|
||||
return child;
|
||||
|
||||
return {};
|
||||
|
@@ -102,8 +102,9 @@ TransitionEditorSectionItem *TransitionEditorSectionItem::create(const ModelNode
|
||||
ModelNode target;
|
||||
|
||||
if (animation.isValid()) {
|
||||
auto model = target.model();
|
||||
const QList<ModelNode> propertyAnimations = animation.subModelNodesOfType(
|
||||
"QtQuick.PropertyAnimation");
|
||||
model->qtQuickPropertyAnimationMetaInfo());
|
||||
|
||||
for (const ModelNode &child : propertyAnimations) {
|
||||
if (child.hasBindingProperty("target"))
|
||||
@@ -141,9 +142,9 @@ void TransitionEditorSectionItem::invalidateBar()
|
||||
qreal locMax = 0;
|
||||
|
||||
for (const ModelNode &child : sequential.directSubModelNodes()) {
|
||||
if (child.hasMetaInfo() && child.isSubclassOf("QtQuick.PropertyAnimation"))
|
||||
if (child.metaInfo().isQtQuickPropertyAnimation())
|
||||
locMax = child.variantProperty("duration").value().toDouble();
|
||||
else if (child.hasMetaInfo() && child.isSubclassOf("QtQuick.PauseAnimation"))
|
||||
else if (child.metaInfo().isQtQuickPauseAnimation())
|
||||
locMin = child.variantProperty("duration").value().toDouble();
|
||||
}
|
||||
|
||||
@@ -211,7 +212,7 @@ void TransitionEditorSectionItem::moveAllDurations(qreal offset)
|
||||
{
|
||||
for (const ModelNode &sequential : m_animationNode.directSubModelNodes()) {
|
||||
for (const ModelNode &child : sequential.directSubModelNodes()) {
|
||||
if (child.hasMetaInfo() && child.isSubclassOf("QtQuick.PauseAnimation"))
|
||||
if (child.metaInfo().isQtQuickPauseAnimation())
|
||||
moveDuration(child, offset);
|
||||
}
|
||||
}
|
||||
@@ -221,7 +222,7 @@ void TransitionEditorSectionItem::scaleAllDurations(qreal scale)
|
||||
{
|
||||
for (const ModelNode &sequential : m_animationNode.directSubModelNodes()) {
|
||||
for (const ModelNode &child : sequential.directSubModelNodes()) {
|
||||
if (child.hasMetaInfo() && child.isSubclassOf("QtQuick.PropertyAnimation"))
|
||||
if (child.metaInfo().isQtQuickPropertyAnimation())
|
||||
scaleDuration(child, scale);
|
||||
}
|
||||
}
|
||||
@@ -436,8 +437,9 @@ void TransitionEditorSectionItem::invalidateHeight()
|
||||
height = TimelineConstants::sectionHeight;
|
||||
visible = false;
|
||||
} else {
|
||||
auto model = m_animationNode.model();
|
||||
const QList<ModelNode> propertyAnimations = m_animationNode.subModelNodesOfType(
|
||||
"QtQuick.PropertyAnimation");
|
||||
model->qtQuickPropertyAnimationMetaInfo());
|
||||
|
||||
height = TimelineConstants::sectionHeight
|
||||
+ propertyAnimations.count() * TimelineConstants::sectionHeight;
|
||||
@@ -458,8 +460,9 @@ void TransitionEditorSectionItem::invalidateHeight()
|
||||
void TransitionEditorSectionItem::createPropertyItems()
|
||||
{
|
||||
int yPos = TimelineConstants::sectionHeight;
|
||||
auto model = m_animationNode.model();
|
||||
const QList<ModelNode> propertyAnimations = m_animationNode.subModelNodesOfType(
|
||||
"QtQuick.PropertyAnimation");
|
||||
model->qtQuickPropertyAnimationMetaInfo());
|
||||
for (const auto &anim : propertyAnimations) {
|
||||
auto item = TransitionEditorPropertyItem::create(anim, this);
|
||||
item->setY(yPos);
|
||||
|
@@ -79,7 +79,7 @@ void TransitionEditorView::nodeRemoved(const ModelNode & removedNode,
|
||||
widget()->updateData(removedNode);
|
||||
|
||||
const ModelNode parent = parentProperty.parentModelNode();
|
||||
if (parent.isValid() && parent.metaInfo().isSubclassOf("QtQuick.Transition"))
|
||||
if (parent.isValid() && parent.metaInfo().isQtQuickTransition())
|
||||
asyncUpdate(parent);
|
||||
}
|
||||
|
||||
@@ -93,8 +93,7 @@ void TransitionEditorView::nodeReparented(const ModelNode &node,
|
||||
|
||||
const ModelNode parent = newPropertyParent.parentModelNode();
|
||||
|
||||
if (parent.isValid() && parent.metaInfo().isValid()
|
||||
&& parent.metaInfo().isSubclassOf("QtQuick.Transition")) {
|
||||
if (parent.isValid() && parent.metaInfo().isValid() && parent.metaInfo().isQtQuickTransition()) {
|
||||
asyncUpdate(parent);
|
||||
}
|
||||
}
|
||||
@@ -158,7 +157,7 @@ bool TransitionEditorView::hasWidget() const
|
||||
|
||||
void TransitionEditorView::nodeIdChanged(const ModelNode &node, const QString &, const QString &)
|
||||
{
|
||||
if (node.metaInfo().isValid() && node.metaInfo().isSubclassOf("QtQuick.Transition"))
|
||||
if (node.metaInfo().isValid() && node.metaInfo().isQtQuickTransition())
|
||||
widget()->init();
|
||||
}
|
||||
|
||||
|
@@ -359,7 +359,7 @@ void TransitionEditorWidget::updateData(const ModelNode &transition)
|
||||
}
|
||||
|
||||
if (transition.metaInfo().isValid()
|
||||
&& transition.metaInfo().isSubclassOf("QtQuick.Transition")) {
|
||||
&& transition.metaInfo().isQtQuickTransition()) {
|
||||
if (transition.id() == m_toolbar->currentTransitionId()) {
|
||||
m_graphicsScene->setTransition(transition);
|
||||
} else {
|
||||
|
@@ -22,14 +22,13 @@ namespace QmlDesigner {
|
||||
|
||||
bool isTabView(const ModelNode &modelNode)
|
||||
{
|
||||
return modelNode.metaInfo().isSubclassOf("QtQuick.Controls.TabView");
|
||||
return modelNode.metaInfo().isQtQuickControlsTabView();
|
||||
}
|
||||
|
||||
bool isTabAndParentIsTabView(const ModelNode &modelNode)
|
||||
{
|
||||
return modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab")
|
||||
&& modelNode.hasParentProperty()
|
||||
&& modelNode.parentProperty().parentModelNode().metaInfo().isSubclassOf("QtQuick.Controls.TabView");
|
||||
return modelNode.metaInfo().isQtQuickControlsTab() && modelNode.hasParentProperty()
|
||||
&& modelNode.parentProperty().parentModelNode().metaInfo().isQtQuickControlsTabView();
|
||||
}
|
||||
|
||||
AddTabDesignerAction::AddTabDesignerAction()
|
||||
@@ -75,7 +74,7 @@ bool AddTabDesignerAction::isEnabled(const SelectionContext &selectionContext) c
|
||||
|
||||
static ModelNode findTabViewModelNode(const ModelNode ¤tModelNode)
|
||||
{
|
||||
if (currentModelNode.metaInfo().isSubclassOf("QtQuick.Controls.TabView"))
|
||||
if (currentModelNode.metaInfo().isQtQuickControlsTabView())
|
||||
return currentModelNode;
|
||||
else
|
||||
return findTabViewModelNode(currentModelNode.parentProperty().parentModelNode());
|
||||
|
@@ -61,9 +61,9 @@ void EnterTabDesignerAction::updateContext()
|
||||
if (action()->isEnabled()) {
|
||||
const ModelNode selectedModelNode = selectionContext().currentSingleSelectedNode();
|
||||
if (selectedModelNode.metaInfo().isValid()
|
||||
&& selectedModelNode.metaInfo().isSubclassOf("QtQuick.Controls.TabView")) {
|
||||
|
||||
const NodeAbstractProperty defaultProperty = selectedModelNode.defaultNodeAbstractProperty();
|
||||
&& selectedModelNode.metaInfo().isQtQuickControlsTabView()) {
|
||||
const NodeAbstractProperty defaultProperty = selectedModelNode
|
||||
.defaultNodeAbstractProperty();
|
||||
const QList<QmlDesigner::ModelNode> childModelNodes = defaultProperty.directSubNodes();
|
||||
for (const QmlDesigner::ModelNode &childModelNode : childModelNodes) {
|
||||
createActionForTab(childModelNode);
|
||||
@@ -77,7 +77,7 @@ bool EnterTabDesignerAction::isVisible(const SelectionContext &selectionContext)
|
||||
{
|
||||
if (selectionContext.singleNodeIsSelected()) {
|
||||
ModelNode selectedModelNode = selectionContext.currentSingleSelectedNode();
|
||||
return selectedModelNode.metaInfo().isValid() && selectedModelNode.metaInfo().isTabView();
|
||||
return selectedModelNode.metaInfo().isQtQuickControlsTabView();
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -95,9 +95,7 @@ bool EnterTabDesignerAction::isEnabled(const SelectionContext &selectionContext)
|
||||
|
||||
void EnterTabDesignerAction::createActionForTab(const ModelNode &modelNode)
|
||||
{
|
||||
if (modelNode.metaInfo().isValid()
|
||||
&& modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab")) {
|
||||
|
||||
if (modelNode.metaInfo().isQtQuickControlsTab()) {
|
||||
QmlDesigner::QmlItemNode itemNode(modelNode);
|
||||
|
||||
if (itemNode.isValid()) {
|
||||
|
@@ -36,14 +36,11 @@ QStringList TabViewIndexModel::tabViewIndexModel() const
|
||||
void TabViewIndexModel::setupModel()
|
||||
{
|
||||
m_tabViewIndexModel.clear();
|
||||
if (m_modelNode.isValid()
|
||||
&& m_modelNode.metaInfo().isValid()
|
||||
&& m_modelNode.metaInfo().isSubclassOf("QtQuick.Controls.TabView")) {
|
||||
if (m_modelNode.isValid() && m_modelNode.metaInfo().isQtQuickControlsTabView()) {
|
||||
const QList<QmlDesigner::ModelNode> childModelNodes
|
||||
= m_modelNode.defaultNodeAbstractProperty().directSubNodes();
|
||||
for (const QmlDesigner::ModelNode &childModelNode : childModelNodes) {
|
||||
if (childModelNode.metaInfo().isValid()
|
||||
&& childModelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab")) {
|
||||
if (childModelNode.metaInfo().isQtQuickControlsTab()) {
|
||||
QmlDesigner::QmlItemNode itemNode(childModelNode);
|
||||
if (itemNode.isValid()) {
|
||||
m_tabViewIndexModel.append(itemNode.instanceValue("title").toString());
|
||||
|
@@ -74,9 +74,10 @@ void ImageCacheCollector::start(Utils::SmallStringView name,
|
||||
|
||||
model->setRewriterView(&rewriterView);
|
||||
|
||||
auto rootModelNodeMetaInfo = rewriterView.rootModelNode().metaInfo();
|
||||
bool is3DRoot = rewriterView.errors().isEmpty()
|
||||
&& (rewriterView.rootModelNode().isSubclassOf("QtQuick3D.Node")
|
||||
|| rewriterView.rootModelNode().isSubclassOf("QtQuick3D.Material"));
|
||||
&& (rootModelNodeMetaInfo.isQtQuick3DNode()
|
||||
|| rootModelNodeMetaInfo.isQtQuick3DMaterial());
|
||||
|
||||
if (!rewriterView.errors().isEmpty() || (!rewriterView.rootModelNode().metaInfo().isGraphicalItem()
|
||||
&& !is3DRoot)) {
|
||||
|
@@ -123,7 +123,7 @@ public:
|
||||
bool hasModelNodeForInternalId(qint32 internalId) const;
|
||||
|
||||
QList<ModelNode> allModelNodes() const;
|
||||
QList<ModelNode> allModelNodesOfType(const TypeName &typeName) const;
|
||||
QList<ModelNode> allModelNodesOfType(const NodeMetaInfo &typeName) const;
|
||||
|
||||
void emitDocumentMessage(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings = QList<DocumentMessage>());
|
||||
void emitDocumentMessage(const QString &error);
|
||||
|
@@ -83,6 +83,23 @@ public:
|
||||
bool hasNodeMetaInfo(const TypeName &typeName, int majorVersion = -1, int minorVersion = -1) const;
|
||||
void setMetaInfo(const MetaInfo &metaInfo);
|
||||
|
||||
NodeMetaInfo flowViewFlowDecisionMetaInfo() const;
|
||||
NodeMetaInfo flowViewFlowTransitionMetaInfo() const;
|
||||
NodeMetaInfo flowViewFlowWildcardMetaInfo() const;
|
||||
NodeMetaInfo qtQuick3DDefaultMaterialMetaInfo() const;
|
||||
NodeMetaInfo qtQuick3DMaterialMetaInfo() const;
|
||||
NodeMetaInfo qtQuick3DModelMetaInfo() const;
|
||||
NodeMetaInfo qtQuick3DNodeMetaInfo() const;
|
||||
NodeMetaInfo qtQuickControlsTextAreaMetaInfo() const;
|
||||
NodeMetaInfo qtQuickImageMetaInfo() const;
|
||||
NodeMetaInfo qtQuickItemMetaInfo() const;
|
||||
NodeMetaInfo qtQuickPropertyAnimationMetaInfo() const;
|
||||
NodeMetaInfo qtQuickRectangleMetaInfo() const;
|
||||
NodeMetaInfo qtQuickTextEditMetaInfo() const;
|
||||
NodeMetaInfo qtQuickTextMetaInfo() const;
|
||||
NodeMetaInfo qtQuickTimelineKeyframeGroupMetaInfo() const;
|
||||
NodeMetaInfo qtQuickTimelineTimelineMetaInfo() const;
|
||||
|
||||
void attachView(AbstractView *view);
|
||||
void detachView(AbstractView *view, ViewNotification emitDetachNotify = NotifyView);
|
||||
|
||||
@@ -129,6 +146,10 @@ public:
|
||||
|
||||
NotNullPointer<const ProjectStorage<Sqlite::Database>> projectStorage() const;
|
||||
|
||||
private:
|
||||
template<const auto &moduleName, const auto &typeName>
|
||||
NodeMetaInfo createNodeMetaInfo() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Internal::ModelPrivate> d;
|
||||
};
|
||||
|
@@ -105,8 +105,8 @@ public:
|
||||
bool hasParentProperty() const;
|
||||
|
||||
QList<ModelNode> directSubModelNodes() const;
|
||||
QList<ModelNode> directSubModelNodesOfType(const TypeName &typeName) const;
|
||||
QList<ModelNode> subModelNodesOfType(const TypeName &typeName) const;
|
||||
QList<ModelNode> directSubModelNodesOfType(const NodeMetaInfo &type) const;
|
||||
QList<ModelNode> subModelNodesOfType(const NodeMetaInfo &type) const;
|
||||
|
||||
QList<ModelNode> allSubModelNodes() const;
|
||||
QList<ModelNode> allSubModelNodesAndThisNode() const;
|
||||
@@ -236,7 +236,6 @@ public:
|
||||
NodeSourceType nodeSourceType() const;
|
||||
|
||||
bool isComponent() const;
|
||||
bool isSubclassOf(const TypeName &typeName, int majorVersion = -1, int minorVersion = -1) const;
|
||||
QIcon typeIcon() const;
|
||||
QString behaviorPropertyName() const;
|
||||
|
||||
|
@@ -52,11 +52,12 @@ public:
|
||||
PropertyNameList signalNames() const;
|
||||
PropertyNameList slotNames() const;
|
||||
PropertyName defaultPropertyName() const;
|
||||
PropertyMetaInfo defaultProperty() const;
|
||||
bool hasDefaultProperty() const;
|
||||
|
||||
std::vector<NodeMetaInfo> classHierarchy() const;
|
||||
std::vector<NodeMetaInfo> superClasses() const;
|
||||
NodeMetaInfo directSuperClass() const;
|
||||
NodeMetaInfo commonBase(const NodeMetaInfo &metaInfo) const;
|
||||
|
||||
bool defaultPropertyIsComponent() const;
|
||||
|
||||
@@ -68,25 +69,88 @@ public:
|
||||
QString componentFileName() const;
|
||||
|
||||
bool availableInVersion(int majorVersion, int minorVersion) const;
|
||||
bool isSubclassOf(const TypeName &type, int majorVersion = -1, int minorVersion = -1) const;
|
||||
bool isSubclassOf(const NodeMetaInfo &metaInfo) const;
|
||||
|
||||
bool isGraphicalItem() const;
|
||||
bool isQmlItem() const;
|
||||
bool isLayoutable() const;
|
||||
bool isView() const;
|
||||
bool isTabView() const;
|
||||
bool isBasedOn(const NodeMetaInfo &metaInfo) const;
|
||||
bool isBasedOn(const NodeMetaInfo &metaInfo1, const NodeMetaInfo &metaInfo2) const;
|
||||
bool isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
const NodeMetaInfo &metaInfo2,
|
||||
const NodeMetaInfo &metaInfo3) const;
|
||||
|
||||
bool isAlias() const;
|
||||
bool isQmlComponent() const;
|
||||
bool isFont() const;
|
||||
bool isColor() const;
|
||||
bool isBool() const;
|
||||
bool isInteger() const;
|
||||
bool isColor() const;
|
||||
bool isFloat() const;
|
||||
bool isVariant() const;
|
||||
bool isFlowViewFlowActionArea() const;
|
||||
bool isFlowViewFlowDecision() const;
|
||||
bool isFlowViewFlowItem() const;
|
||||
bool isFlowViewFlowTransition() const;
|
||||
bool isFlowViewFlowView() const;
|
||||
bool isFlowViewFlowWildcard() const;
|
||||
bool isFlowViewItem() const;
|
||||
bool isFont() const;
|
||||
bool isGraphicalItem() const;
|
||||
bool isInteger() const;
|
||||
bool isLayoutable() const;
|
||||
bool isListOrGridView() const;
|
||||
bool isQmlComponent() const;
|
||||
bool isQtMultimediaSoundEffect() const;
|
||||
bool isQtObject() const;
|
||||
bool isQtQuick3D() const;
|
||||
bool isQtQuick3DBuffer() const;
|
||||
bool isQtQuick3DCamera() const;
|
||||
bool isQtQuick3DCommand() const;
|
||||
bool isQtQuick3DDefaultMaterial() const;
|
||||
bool isQtQuick3DEffect() const;
|
||||
bool isQtQuick3DInstanceList() const;
|
||||
bool isQtQuick3DInstanceListEntry() const;
|
||||
bool isQtQuick3DMaterial() const;
|
||||
bool isQtQuick3DModel() const;
|
||||
bool isQtQuick3DNode() const;
|
||||
bool isQtQuick3DParticles3DAffector3D() const;
|
||||
bool isQtQuick3DParticles3DAttractor3D() const;
|
||||
bool isQtQuick3DParticles3DModel() const;
|
||||
bool isQtQuick3DParticles3DParticle3D() const;
|
||||
bool isQtQuick3DParticles3DParticleEmitter3D() const;
|
||||
bool isQtQuick3DParticles3DSpriteParticle3D() const;
|
||||
bool isQtQuick3DPass() const;
|
||||
bool isQtQuick3DPrincipledMaterial() const;
|
||||
bool isQtQuick3DSceneEnvironment() const;
|
||||
bool isQtQuick3DShader() const;
|
||||
bool isQtQuick3DTexture() const;
|
||||
bool isQtQuick3DTextureInput() const;
|
||||
bool isQtQuick3DView3D() const;
|
||||
bool isQtQuickBorderImage() const;
|
||||
bool isQtQuickControlsSwipeView() const;
|
||||
bool isQtQuickControlsTab() const;
|
||||
bool isQtQuickControlsTabBar() const;
|
||||
bool isQtQuickControlsTabView() const;
|
||||
bool isQtQuickExtrasPicture() const;
|
||||
bool isQtQuickImage() const;
|
||||
bool isQtQuickItem() const;
|
||||
bool isQtQuickLayoutsLayout() const;
|
||||
bool isQtQuickLoader() const;
|
||||
bool isQtQuickPath() const;
|
||||
bool isQtQuickPauseAnimation() const;
|
||||
bool isQtQuickPositioner() const;
|
||||
bool isQtQuickPropertyAnimation() const;
|
||||
bool isQtQuickPropertyChanges() const;
|
||||
bool isQtQuickRepeater() const;
|
||||
bool isQtQuickState() const;
|
||||
bool isQtQuickStudioComponentsGroupItem() const;
|
||||
bool isQtQuickText() const;
|
||||
bool isQtQuickTimelineKeyframe() const;
|
||||
bool isQtQuickTimelineKeyframeGroup() const;
|
||||
bool isQtQuickTimelineTimeline() const;
|
||||
bool isQtQuickTimelineTimelineAnimation() const;
|
||||
bool isQtQuickTransition() const;
|
||||
bool isQtSafeRendererSafeRendererPicture() const;
|
||||
bool isQtSafeRendererSafePicture() const;
|
||||
bool isQuick3DParticleAbstractShape() const;
|
||||
bool isQuickStateOperation() const;
|
||||
bool isString() const;
|
||||
bool isUrl() const;
|
||||
bool isQtQuick3DTexture() const;
|
||||
bool isVariant() const;
|
||||
bool isView() const;
|
||||
|
||||
bool isEnumeration() const;
|
||||
QString importDirectoryPath() const;
|
||||
@@ -101,6 +165,7 @@ public:
|
||||
|
||||
private:
|
||||
const Storage::Info::Type &typeData() const;
|
||||
bool isSubclassOf(const TypeName &type, int majorVersion = -1, int minorVersion = -1) const;
|
||||
|
||||
private:
|
||||
TypeId m_typeId;
|
||||
|
@@ -23,6 +23,7 @@ public:
|
||||
QmlModelNodeFacade();
|
||||
|
||||
AbstractView *view() const;
|
||||
Model *model() const;
|
||||
static NodeInstanceView *nodeInstanceView(const ModelNode &modelNode);
|
||||
NodeInstanceView *nodeInstanceView() const;
|
||||
bool isRootNode() const;
|
||||
|
@@ -257,7 +257,7 @@ void NodeInstanceView::modelAttached(Model *model)
|
||||
}
|
||||
|
||||
ModelNode stateNode = currentStateNode();
|
||||
if (stateNode.isValid() && stateNode.metaInfo().isSubclassOf("QtQuick.State", 1, 0)) {
|
||||
if (stateNode.isValid() && stateNode.metaInfo().isQtQuickState()) {
|
||||
NodeInstance newStateInstance = instanceForModelNode(stateNode);
|
||||
activateState(newStateInstance);
|
||||
}
|
||||
@@ -369,7 +369,7 @@ void NodeInstanceView::restartProcess()
|
||||
}
|
||||
|
||||
ModelNode stateNode = currentStateNode();
|
||||
if (stateNode.isValid() && stateNode.metaInfo().isSubclassOf("QtQuick.State", 1, 0)) {
|
||||
if (stateNode.isValid() && stateNode.metaInfo().isQtQuickState()) {
|
||||
NodeInstance newStateInstance = instanceForModelNode(stateNode);
|
||||
activateState(newStateInstance);
|
||||
}
|
||||
@@ -581,9 +581,10 @@ void NodeInstanceView::nodeReparented(const ModelNode &node, const NodeAbstractP
|
||||
|
||||
// Reset puppet when particle emitter/affector is reparented to work around issue in
|
||||
// autodetecting the particle system it belongs to. QTBUG-101157
|
||||
if ((node.isSubclassOf("QtQuick.Particles3D.ParticleEmitter3D")
|
||||
|| node.isSubclassOf("QtQuick.Particles3D.Affector3D"))
|
||||
&& node.property("system").toBindingProperty().expression().isEmpty()) {
|
||||
if (auto metaInfo = node.metaInfo();
|
||||
(metaInfo.isQtQuick3DParticles3DParticleEmitter3D()
|
||||
|| metaInfo.isQtQuick3DParticles3DAffector3D())
|
||||
&& node.property("system").toBindingProperty().expression().isEmpty()) {
|
||||
resetPuppet();
|
||||
}
|
||||
}
|
||||
@@ -741,7 +742,7 @@ void NodeInstanceView::currentStateChanged(const ModelNode &node)
|
||||
{
|
||||
NodeInstance newStateInstance = instanceForModelNode(node);
|
||||
|
||||
if (newStateInstance.isValid() && node.metaInfo().isSubclassOf("QtQuick.State", 1, 0))
|
||||
if (newStateInstance.isValid() && node.metaInfo().isQtQuickState())
|
||||
nodeInstanceView()->activateState(newStateInstance);
|
||||
else
|
||||
nodeInstanceView()->activateBaseState();
|
||||
@@ -1075,7 +1076,7 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
|
||||
InstanceContainer::NodeSourceType nodeSourceType = static_cast<InstanceContainer::NodeSourceType>(instance.modelNode().nodeSourceType());
|
||||
|
||||
InstanceContainer::NodeMetaType nodeMetaType = InstanceContainer::ObjectMetaType;
|
||||
if (instance.modelNode().metaInfo().isSubclassOf("QtQuick.Item"))
|
||||
if (instance.modelNode().metaInfo().isQtQuickItem())
|
||||
nodeMetaType = InstanceContainer::ItemMetaType;
|
||||
|
||||
InstanceContainer::NodeFlags nodeFlags;
|
||||
@@ -1182,7 +1183,7 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
|
||||
|
||||
ModelNode stateNode = currentStateNode();
|
||||
qint32 stateInstanceId = 0;
|
||||
if (stateNode.isValid() && stateNode.metaInfo().isSubclassOf("QtQuick.State", 1, 0))
|
||||
if (stateNode.isValid() && stateNode.metaInfo().isQtQuickState())
|
||||
stateInstanceId = stateNode.internalId();
|
||||
|
||||
QColor gridColor;
|
||||
@@ -1254,7 +1255,7 @@ CreateInstancesCommand NodeInstanceView::createCreateInstancesCommand(const QLis
|
||||
InstanceContainer::NodeSourceType nodeSourceType = static_cast<InstanceContainer::NodeSourceType>(instance.modelNode().nodeSourceType());
|
||||
|
||||
InstanceContainer::NodeMetaType nodeMetaType = InstanceContainer::ObjectMetaType;
|
||||
if (instance.modelNode().metaInfo().isSubclassOf("QtQuick.Item"))
|
||||
if (instance.modelNode().metaInfo().isQtQuickItem())
|
||||
nodeMetaType = InstanceContainer::ItemMetaType;
|
||||
|
||||
InstanceContainer::NodeFlags nodeFlags;
|
||||
@@ -1839,12 +1840,12 @@ QVariant NodeInstanceView::previewImageDataForImageNode(const ModelNode &modelNo
|
||||
imageData.id = modelNode.id();
|
||||
imageData.type = QString::fromLatin1(modelNode.type());
|
||||
#ifndef QMLDESIGNER_TEST
|
||||
const double ratio = QmlDesignerPlugin::formEditorDevicePixelRatio();
|
||||
const double ratio = QmlDesignerPlugin::formEditorDevicePixelRatio();
|
||||
#else
|
||||
const double ratio = 1;
|
||||
const double ratio = 1;
|
||||
#endif
|
||||
|
||||
if (imageSource.isEmpty() && modelNode.isSubclassOf("QtQuick3D.Texture")) {
|
||||
if (imageSource.isEmpty() && modelNode.metaInfo().isQtQuick3DTexture()) {
|
||||
// Texture node may have sourceItem instead
|
||||
BindingProperty binding = modelNode.bindingProperty("sourceItem");
|
||||
if (binding.isValid()) {
|
||||
@@ -1858,9 +1859,10 @@ QVariant NodeInstanceView::previewImageDataForImageNode(const ModelNode &modelNo
|
||||
} else {
|
||||
QmlItemNode itemNode(boundNode);
|
||||
const int dim = Constants::MODELNODE_PREVIEW_IMAGE_DIMENSIONS * ratio;
|
||||
imageData.pixmap = itemNode.instanceRenderPixmap().scaled(dim, dim, Qt::KeepAspectRatio);
|
||||
imageData.pixmap = itemNode.instanceRenderPixmap().scaled(dim,
|
||||
dim,
|
||||
Qt::KeepAspectRatio);
|
||||
imageData.pixmap.setDevicePixelRatio(ratio);
|
||||
|
||||
}
|
||||
imageData.info = ::QmlDesigner::NodeInstanceView::tr("Source item: %1")
|
||||
.arg(boundNode.id());
|
||||
@@ -1875,7 +1877,9 @@ QVariant NodeInstanceView::previewImageDataForImageNode(const ModelNode &modelNo
|
||||
|
||||
QFileInfo imageFi(imageSource);
|
||||
if (imageFi.isRelative())
|
||||
imageSource = QFileInfo(modelNode.model()->fileUrl().toLocalFile()).dir().absoluteFilePath(imageSource);
|
||||
imageSource = QFileInfo(modelNode.model()->fileUrl().toLocalFile())
|
||||
.dir()
|
||||
.absoluteFilePath(imageSource);
|
||||
|
||||
imageFi = QFileInfo(imageSource);
|
||||
QDateTime modified = imageFi.lastModified();
|
||||
@@ -1889,7 +1893,7 @@ QVariant NodeInstanceView::previewImageDataForImageNode(const ModelNode &modelNo
|
||||
|
||||
if (reload) {
|
||||
QPixmap originalPixmap;
|
||||
if (modelNode.isSubclassOf("Qt.SafeRenderer.SafeRendererPicture")) {
|
||||
if (modelNode.metaInfo().isQtSafeRendererSafeRendererPicture()) {
|
||||
QPicture picture;
|
||||
picture.load(imageSource);
|
||||
if (!picture.isNull()) {
|
||||
@@ -1923,8 +1927,12 @@ QVariant NodeInstanceView::previewImageDataForImageNode(const ModelNode &modelNo
|
||||
++unitIndex;
|
||||
imgSize /= 1024.;
|
||||
}
|
||||
imageData.info = QStringLiteral("%1 x %2\n%3%4 (%5)").arg(originalPixmap.width()).arg(originalPixmap.height())
|
||||
.arg(QString::number(imgSize, 'g', 3)).arg(units[unitIndex]).arg(imageFi.suffix());
|
||||
imageData.info = QStringLiteral("%1 x %2\n%3%4 (%5)")
|
||||
.arg(originalPixmap.width())
|
||||
.arg(originalPixmap.height())
|
||||
.arg(QString::number(imgSize, 'g', 3))
|
||||
.arg(units[unitIndex])
|
||||
.arg(imageFi.suffix());
|
||||
m_imageDataMap.insert(imageData.id, imageData);
|
||||
}
|
||||
}
|
||||
@@ -2207,7 +2215,8 @@ void NodeInstanceView::updateRotationBlocks()
|
||||
for (const auto &node : selectedNodes) {
|
||||
if (Qml3DNode::isValidQml3DNode(node)) {
|
||||
if (!groupsResolved) {
|
||||
const QList<ModelNode> keyframeGroups = allModelNodesOfType("KeyframeGroup");
|
||||
const QList<ModelNode> keyframeGroups = allModelNodesOfType(
|
||||
model()->qtQuickTimelineKeyframeGroupMetaInfo());
|
||||
for (const auto &kfgNode : keyframeGroups) {
|
||||
if (kfgNode.isValid()) {
|
||||
VariantProperty varProp = kfgNode.variantProperty(propertyPropName);
|
||||
@@ -2240,13 +2249,13 @@ void NodeInstanceView::maybeResetOnPropertyChange(const PropertyName &name, cons
|
||||
PropertyChangeFlags flags)
|
||||
{
|
||||
bool reset = false;
|
||||
if (flags & AbstractView::PropertiesAdded
|
||||
&& name == "model" && node.isSubclassOf("QtQuick.Repeater")) {
|
||||
if (flags & AbstractView::PropertiesAdded && name == "model"
|
||||
&& node.metaInfo().isQtQuickRepeater()) {
|
||||
// TODO: This is a workaround for QTBUG-97583:
|
||||
// Reset puppet when repeater model is first added, if there is already a delegate
|
||||
if (node.hasProperty("delegate"))
|
||||
reset = true;
|
||||
} else if (name == "shader" && node.isSubclassOf("QtQuick3D.Shader")) {
|
||||
} else if (name == "shader" && node.metaInfo().isQtQuick3DShader()) {
|
||||
reset = true;
|
||||
}
|
||||
if (reset)
|
||||
|
@@ -32,8 +32,7 @@ namespace QmlDesigner {
|
||||
|
||||
static bool isSwipeView(const ModelNode &node)
|
||||
{
|
||||
if (node.metaInfo().isValid()
|
||||
&& node.metaInfo().isSubclassOf("QtQuick.Controls.SwipeView"))
|
||||
if (node.metaInfo().isQtQuickControlsSwipeView())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -373,31 +372,35 @@ bool JSObject::potentialChildIsRoot() const
|
||||
bool JSObject::isSubclassOf(const QString &typeName)
|
||||
{
|
||||
NodeMetaInfo metaInfo = m_modelNode.metaInfo();
|
||||
auto model = m_modelNode.model();
|
||||
|
||||
if (metaInfo.isValid())
|
||||
return metaInfo.isSubclassOf(typeName.toUtf8());
|
||||
auto base = model->metaInfo(typeName.toUtf8());
|
||||
|
||||
return false;
|
||||
return metaInfo.isBasedOn(base);
|
||||
}
|
||||
|
||||
bool JSObject::rootItemIsSubclassOf(const QString &typeName)
|
||||
{
|
||||
NodeMetaInfo metaInfo = m_modelNode.view()->rootModelNode().metaInfo();
|
||||
|
||||
if (metaInfo.isValid())
|
||||
return metaInfo.isSubclassOf(typeName.toUtf8());
|
||||
auto model = m_modelNode.model();
|
||||
|
||||
return false;
|
||||
auto base = model->metaInfo(typeName.toUtf8());
|
||||
|
||||
return metaInfo.isBasedOn(base);
|
||||
}
|
||||
|
||||
bool JSObject::currentParentIsSubclassOf(const QString &typeName)
|
||||
{
|
||||
if (m_modelNode.hasParentProperty()
|
||||
&& m_modelNode.parentProperty().isValid()) {
|
||||
NodeMetaInfo metaInfo = m_modelNode.parentProperty().parentModelNode().metaInfo();
|
||||
if (metaInfo.isValid())
|
||||
return metaInfo.isSubclassOf(typeName.toUtf8());
|
||||
NodeMetaInfo metaInfo = m_modelNode.parentProperty().parentModelNode().metaInfo();
|
||||
auto model = m_modelNode.model();
|
||||
auto base = model->metaInfo(typeName.toUtf8());
|
||||
|
||||
return metaInfo.isBasedOn(base);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -405,20 +408,22 @@ bool JSObject::potentialParentIsSubclassOf(const QString &typeName)
|
||||
{
|
||||
NodeMetaInfo metaInfo = m_otherNode.metaInfo();
|
||||
|
||||
if (metaInfo.isValid())
|
||||
return metaInfo.isSubclassOf(typeName.toUtf8());
|
||||
auto model = m_modelNode.model();
|
||||
|
||||
return false;
|
||||
auto base = model->metaInfo(typeName.toUtf8());
|
||||
|
||||
return metaInfo.isBasedOn(base);
|
||||
}
|
||||
|
||||
bool JSObject::potentialChildIsSubclassOf(const QString &typeName)
|
||||
{
|
||||
NodeMetaInfo metaInfo = m_otherNode.metaInfo();
|
||||
|
||||
if (metaInfo.isValid())
|
||||
return metaInfo.isSubclassOf(typeName.toUtf8());
|
||||
auto model = m_otherNode.model();
|
||||
|
||||
return false;
|
||||
auto base = model->metaInfo(typeName.toUtf8());
|
||||
|
||||
return metaInfo.isBasedOn(base);
|
||||
}
|
||||
|
||||
} //Internal
|
||||
|
@@ -1491,6 +1491,15 @@ PropertyName NodeMetaInfo::defaultPropertyName() const
|
||||
return m_privateData->defaultPropertyName();
|
||||
}
|
||||
}
|
||||
|
||||
PropertyMetaInfo NodeMetaInfo::defaultProperty() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
return PropertyMetaInfo(typeData().defaultPropertyId, m_projectStorage);
|
||||
} else {
|
||||
return property(defaultPropertyName());
|
||||
}
|
||||
}
|
||||
bool NodeMetaInfo::hasDefaultProperty() const
|
||||
{
|
||||
if constexpr (useProjectStorage())
|
||||
@@ -1501,41 +1510,50 @@ bool NodeMetaInfo::hasDefaultProperty() const
|
||||
|
||||
NodeMetaInfos NodeMetaInfo::classHierarchy() const
|
||||
{
|
||||
NodeMetaInfos hierarchy = {*this};
|
||||
Model *model = m_privateData->model();
|
||||
for (const TypeDescription &type : m_privateData->prototypes())
|
||||
hierarchy.emplace_back(model, type.className.toUtf8(), type.majorVersion, type.minorVersion);
|
||||
if constexpr (useProjectStorage()) {
|
||||
NodeMetaInfos hierarchy;
|
||||
const auto typeIds = m_projectStorage->prototypeAndSelfIds(m_typeId);
|
||||
hierarchy.reserve(typeIds.size());
|
||||
|
||||
return hierarchy;
|
||||
for (TypeId typeId : typeIds)
|
||||
hierarchy.emplace_back(typeId, m_projectStorage);
|
||||
|
||||
return hierarchy;
|
||||
} else {
|
||||
NodeMetaInfos hierarchy = {*this};
|
||||
Model *model = m_privateData->model();
|
||||
for (const TypeDescription &type : m_privateData->prototypes())
|
||||
hierarchy.emplace_back(model, type.className.toUtf8(), type.majorVersion, type.minorVersion);
|
||||
|
||||
return hierarchy;
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfos NodeMetaInfo::superClasses() const
|
||||
{
|
||||
NodeMetaInfos hierarchy;
|
||||
Model *model = m_privateData->model();
|
||||
for (const TypeDescription &type : m_privateData->prototypes())
|
||||
hierarchy.emplace_back(model, type.className.toUtf8(), type.majorVersion, type.minorVersion);
|
||||
if constexpr (useProjectStorage()) {
|
||||
NodeMetaInfos hierarchy;
|
||||
const auto typeIds = m_projectStorage->prototypeIds(m_typeId);
|
||||
hierarchy.reserve(typeIds.size());
|
||||
|
||||
return hierarchy;
|
||||
}
|
||||
for (TypeId typeId : typeIds)
|
||||
hierarchy.emplace_back(typeId, m_projectStorage);
|
||||
|
||||
NodeMetaInfo NodeMetaInfo::directSuperClass() const // actually this can be too because their arre extensions
|
||||
{
|
||||
const auto &protoTypes = m_privateData->prototypes();
|
||||
Model *model = m_privateData->model();
|
||||
return hierarchy;
|
||||
} else {
|
||||
NodeMetaInfos hierarchy;
|
||||
Model *model = m_privateData->model();
|
||||
for (const TypeDescription &type : m_privateData->prototypes())
|
||||
hierarchy.emplace_back(model, type.className.toUtf8(), type.majorVersion, type.minorVersion);
|
||||
|
||||
if (protoTypes.empty())
|
||||
return NodeMetaInfo{m_projectStorage};
|
||||
|
||||
const auto &type = m_privateData->prototypes().front();
|
||||
|
||||
return NodeMetaInfo{model, type.className.toUtf8(), type.majorVersion, type.minorVersion};
|
||||
return hierarchy;
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::defaultPropertyIsComponent() const
|
||||
{
|
||||
if (hasDefaultProperty())
|
||||
return property(defaultPropertyName()).propertyType().isQmlComponent();
|
||||
return defaultProperty().propertyType().isQmlComponent();
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1624,11 +1642,60 @@ bool NodeMetaInfo::isSubclassOf(const TypeName &type, int majorVersion, int mino
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isSubclassOf(const NodeMetaInfo &metaInfo) const
|
||||
bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo) const
|
||||
{
|
||||
return isSubclassOf(metaInfo.typeName(), metaInfo.majorVersion(), metaInfo.minorVersion());
|
||||
if constexpr (useProjectStorage()) {
|
||||
return m_projectStorage->isBasedOn(m_typeId, metaInfo.m_typeId);
|
||||
} else {
|
||||
return isValid()
|
||||
&& isSubclassOf(metaInfo.typeName(), metaInfo.majorVersion(), metaInfo.minorVersion());
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1, const NodeMetaInfo &metaInfo2) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
return m_projectStorage->isBasedOn(m_typeId, metaInfo1.m_typeId, metaInfo2.m_typeId);
|
||||
} else {
|
||||
return isValid()
|
||||
&& (isSubclassOf(metaInfo1.typeName(), metaInfo1.majorVersion(), metaInfo1.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(),
|
||||
metaInfo2.majorVersion(),
|
||||
metaInfo2.minorVersion()));
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isBasedOn(const NodeMetaInfo &metaInfo1,
|
||||
const NodeMetaInfo &metaInfo2,
|
||||
const NodeMetaInfo &metaInfo3) const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
return m_projectStorage->isBasedOn(m_typeId,
|
||||
metaInfo1.m_typeId,
|
||||
metaInfo2.m_typeId,
|
||||
metaInfo3.m_typeId);
|
||||
} else {
|
||||
return isValid()
|
||||
&& (isSubclassOf(metaInfo1.typeName(), metaInfo1.majorVersion(), metaInfo1.minorVersion())
|
||||
|| isSubclassOf(metaInfo2.typeName(),
|
||||
metaInfo2.majorVersion(),
|
||||
metaInfo2.minorVersion())
|
||||
|| isSubclassOf(metaInfo3.typeName(),
|
||||
metaInfo3.majorVersion(),
|
||||
metaInfo3.minorVersion()));
|
||||
}
|
||||
}
|
||||
namespace {
|
||||
template<const char *moduleName, const char *typeName>
|
||||
bool isBasedOnCommonType(NotNullPointer<const ProjectStorage<Sqlite::Database>> projectStorage,
|
||||
TypeId typeId)
|
||||
{
|
||||
auto base = projectStorage->commonTypeId<moduleName, typeName>();
|
||||
|
||||
return projectStorage->isBasedOn(typeId, base);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
bool NodeMetaInfo::isGraphicalItem() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
@@ -1640,18 +1707,20 @@ bool NodeMetaInfo::isGraphicalItem() const
|
||||
|
||||
return m_projectStorage->isBasedOn(m_typeId, itemId, windowId, dialogId, popupId);
|
||||
} else {
|
||||
return isSubclassOf("QtQuick.Item") || isSubclassOf("QtQuick.Window.Window")
|
||||
|| isSubclassOf("QtQuick.Dialogs.Dialog") || isSubclassOf("QtQuick.Controls.Popup");
|
||||
return isValid()
|
||||
&& (isSubclassOf("QtQuick.Item") || isSubclassOf("QtQuick.Window.Window")
|
||||
|| isSubclassOf("QtQuick.Dialogs.Dialog")
|
||||
|| isSubclassOf("QtQuick.Controls.Popup"));
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQmlItem() const
|
||||
bool NodeMetaInfo::isQtObject() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return m_projectStorage->isBasedOn(m_typeId, m_projectStorage->commonTypeId<QML, QtObject>());
|
||||
return isBasedOnCommonType<QML, QtObject>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isSubclassOf("QtQuick.QtObject") || isSubclassOf("QtQml.QtObject");
|
||||
return isValid() && (isSubclassOf("QtQuick.QtObject") || isSubclassOf("QtQml.QtObject"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1666,11 +1735,19 @@ bool NodeMetaInfo::isLayoutable() const
|
||||
return m_projectStorage->isBasedOn(m_typeId, positionerId, layoutId, splitViewId);
|
||||
|
||||
} else {
|
||||
if (isSubclassOf("<cpp>.QDeclarativeBasePositioner"))
|
||||
return true; //QtQuick 1
|
||||
return isValid()
|
||||
&& (isSubclassOf("QtQuick.Positioner") || isSubclassOf("QtQuick.Layouts.Layout")
|
||||
|| isSubclassOf("QtQuick.Controls.SplitView"));
|
||||
}
|
||||
}
|
||||
|
||||
return isSubclassOf("QtQuick.Positioner") || isSubclassOf("QtQuick.Layouts.Layout")
|
||||
|| isSubclassOf("QtQuick.Controls.SplitView");
|
||||
bool NodeMetaInfo::isQtQuickLayoutsLayout() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Layouts, Layout>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Layouts.Layout");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1689,15 +1766,139 @@ bool NodeMetaInfo::isView() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isTabView() const
|
||||
bool NodeMetaInfo::isQtQuickPropertyChanges() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, Storage::Info::PropertyChanges>(m_projectStorage,
|
||||
m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.PropertyChanges");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQuickStateOperation() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_cppnative, QuickStateOperation>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("<cpp>.QQuickStateOperation");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtSafeRendererSafeRendererPicture() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<Qt_SafeRenderer, SafeRendererPicture>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("Qt.SafeRenderer.SafeRendererPicture");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtSafeRendererSafePicture() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<Qt_SafeRenderer, SafePicture>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("Qt.SafeRenderer.SafePicture");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickTimelineKeyframe() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Timeline, Keyframe>(m_projectStorage, m_typeId);
|
||||
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Timeline.Keyframe");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickTimelineTimelineAnimation() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Timeline, TimelineAnimation>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Timeline.TimelineAnimation");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickTimelineTimeline() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Timeline, Timeline>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Timeline.Timeline");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickTimelineKeyframeGroup() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Timeline, KeyframeGroup>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Timeline.KeyframeGroup");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isListOrGridView() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
auto listViewId = m_projectStorage->commonTypeId<QtQuick, ListView>();
|
||||
auto gridViewId = m_projectStorage->commonTypeId<QtQuick, GridView>();
|
||||
return m_projectStorage->isBasedOn(m_typeId, listViewId, gridViewId);
|
||||
} else {
|
||||
return isValid() && (isSubclassOf("QtQuick.ListView") || isSubclassOf("QtQuick.GridView"));
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickControlsTabView() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Controls, TabView>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Controls.TabView");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickExtrasPicture() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Extras, Picture>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Extras.Picture");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickImage() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
|
||||
return m_projectStorage->isBasedOn(m_typeId,
|
||||
m_projectStorage->commonTypeId<QtQuick, TabView>());
|
||||
return isBasedOnCommonType<QtQuick, Image>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isSubclassOf("QtQuick.Controls.TabView");
|
||||
return isValid() && isSubclassOf("QtQuick.Image");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickBorderImage() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
|
||||
return isBasedOnCommonType<QtQuick, BorderImage>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.BorderImage");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1706,11 +1907,320 @@ bool NodeMetaInfo::isAlias() const
|
||||
return m_privateData && m_privateData->qualfiedTypeName() == "alias";
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickPositioner() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
|
||||
return isBasedOnCommonType<QtQuick, Positioner>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Positioner");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickPropertyAnimation() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, PropertyAnimation>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.PropertyAnimation");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickRepeater() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, Repeater>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Repeater");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickControlsTabBar() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Controls, TabBar>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Controls.TabBar");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickControlsTab() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
|
||||
return isBasedOnCommonType<QtQuick_Controls, Tab>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Controls.Tab");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickControlsSwipeView() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Controls, SwipeView>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Controls.SwipeView");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DCamera() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, Camera>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QQuick3D.Camera");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DBuffer() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, Buffer>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QQuick3D.Buffer");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DInstanceListEntry() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, InstanceListEntry>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QQuick3D.InstanceListEntry");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DInstanceList() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, InstanceList>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QQuick3D.InstanceList");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DParticles3DParticle3D() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D_Particles3D, Particle3D>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Particles3D.Particle3D");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DParticles3DParticleEmitter3D() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D_Particles3D, ParticleEmitter3D>(m_projectStorage,
|
||||
m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Particles3D.ParticleEmitter3D");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DParticles3DAttractor3D() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D_Particles3D, Attractor3D>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Particles3D.Attractor3D");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQuick3DParticleAbstractShape() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D_Particles3D_cppnative, QQuick3DParticleAbstractShape>(
|
||||
m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QQuick3DParticleAbstractShape");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickItem() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, Item>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Item");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickPath() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, Path>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Path");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickPauseAnimation() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, PauseAnimation>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.PauseAnimation");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickTransition() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, Transition>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Transition");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickLoader() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, Loader>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Loader");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickState() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, State>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.State");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickText() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick, Text>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Text");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtMultimediaSoundEffect() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtMultimedia, SoundEffect>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtMultimedia.SoundEffect");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isFlowViewItem() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
auto flowItemId = m_projectStorage->commonTypeId<FlowView, FlowItem>();
|
||||
auto flowWildcardId = m_projectStorage->commonTypeId<FlowView, FlowWildcard>();
|
||||
auto flowDecisionId = m_projectStorage->commonTypeId<FlowView, FlowDecision>();
|
||||
return m_projectStorage->isBasedOn(m_typeId, flowItemId, flowWildcardId, flowDecisionId);
|
||||
} else {
|
||||
return isValid()
|
||||
&& (isSubclassOf("FlowView.FlowItem") || isSubclassOf("FlowView.FlowWildcard")
|
||||
|| isSubclassOf("FlowView.FlowDecision"));
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isFlowViewFlowItem() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<FlowView, FlowItem>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("FlowView.FlowItem");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isFlowViewFlowView() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<FlowView, FlowView>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("FlowView.FlowView");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isFlowViewFlowActionArea() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<FlowView, FlowActionArea>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("FlowView.FlowActionArea");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isFlowViewFlowTransition() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<FlowView, FlowTransition>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("FlowView.FlowTransition");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isFlowViewFlowDecision() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<FlowView, FlowDecision>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("FlowView.FlowDecision");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isFlowViewFlowWildcard() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<FlowView, FlowWildcard>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("FlowView.FlowWildcard");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuickStudioComponentsGroupItem() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick_Studio_Components, GroupItem>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick.Studio.Components.GroupItem");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQmlComponent() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return m_projectStorage->isBasedOn(m_typeId, m_projectStorage->commonTypeId<QML, Component>());
|
||||
return isBasedOnCommonType<QML, Component>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
auto type = m_privateData->qualfiedTypeName();
|
||||
|
||||
@@ -1734,7 +2244,7 @@ bool isTypeId(TypeId typeId, TypeIds... otherTypeIds)
|
||||
|
||||
bool NodeMetaInfo::isFont() const
|
||||
{
|
||||
if (useProjectStorage()) {
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isTypeId(m_typeId, m_projectStorage->commonTypeId<QtQuick, font>());
|
||||
} else {
|
||||
@@ -1744,7 +2254,7 @@ bool NodeMetaInfo::isFont() const
|
||||
|
||||
bool NodeMetaInfo::isColor() const
|
||||
{
|
||||
if (useProjectStorage()) {
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isTypeId(m_typeId, m_projectStorage->builtinTypeId<QColor>());
|
||||
} else {
|
||||
@@ -1759,7 +2269,7 @@ bool NodeMetaInfo::isColor() const
|
||||
|
||||
bool NodeMetaInfo::isBool() const
|
||||
{
|
||||
if (useProjectStorage()) {
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isTypeId(m_typeId, m_projectStorage->builtinTypeId<bool>());
|
||||
} else {
|
||||
@@ -1774,7 +2284,7 @@ bool NodeMetaInfo::isBool() const
|
||||
|
||||
bool NodeMetaInfo::isInteger() const
|
||||
{
|
||||
if (useProjectStorage()) {
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isTypeId(m_typeId, m_projectStorage->builtinTypeId<int>());
|
||||
} else {
|
||||
@@ -1789,7 +2299,7 @@ bool NodeMetaInfo::isInteger() const
|
||||
|
||||
bool NodeMetaInfo::isFloat() const
|
||||
{
|
||||
if (useProjectStorage()) {
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
auto floatId = m_projectStorage->builtinTypeId<float>();
|
||||
auto doubleId = m_projectStorage->builtinTypeId<double>();
|
||||
@@ -1807,7 +2317,7 @@ bool NodeMetaInfo::isFloat() const
|
||||
|
||||
bool NodeMetaInfo::isVariant() const
|
||||
{
|
||||
if (useProjectStorage()) {
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isTypeId(m_typeId, m_projectStorage->builtinTypeId<QVariant>());
|
||||
} else {
|
||||
@@ -1817,7 +2327,7 @@ bool NodeMetaInfo::isVariant() const
|
||||
|
||||
bool NodeMetaInfo::isString() const
|
||||
{
|
||||
if (useProjectStorage()) {
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isTypeId(m_typeId, m_projectStorage->builtinTypeId<QString>());
|
||||
} else {
|
||||
@@ -1832,7 +2342,7 @@ bool NodeMetaInfo::isString() const
|
||||
|
||||
bool NodeMetaInfo::isUrl() const
|
||||
{
|
||||
if (useProjectStorage()) {
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isTypeId(m_typeId, m_projectStorage->builtinTypeId<QUrl>());
|
||||
} else {
|
||||
@@ -1847,12 +2357,164 @@ bool NodeMetaInfo::isUrl() const
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DTexture() const
|
||||
{
|
||||
if (useProjectStorage()) {
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return m_projectStorage->isBasedOn(m_typeId,
|
||||
m_projectStorage->commonTypeId<QtQuick3D, Texture>());
|
||||
return isBasedOnCommonType<QtQuick3D, Texture>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return m_privateData && m_privateData->qualfiedTypeName() == "QtQuick3D.Texture";
|
||||
return isValid()
|
||||
&& (isSubclassOf("QtQuick3D.Texture") || isSubclassOf("<cpp>.QQuick3DTexture"));
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DShader() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, Shader>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Shader");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DPass() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, Pass>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Pass");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DCommand() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, Command>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Command");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DDefaultMaterial() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, DefaultMaterial>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.DefaultMaterial");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DMaterial() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, Material>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Material");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DModel() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, Storage::Info::Model>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Model");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DNode() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, Node>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Node");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DParticles3DAffector3D() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D_Particles3D, Affector3D>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Affector3D");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DView3D() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, View3D>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.View3D");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DParticles3DModel() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D_Particles3D, Storage::Info::Model>(m_projectStorage,
|
||||
m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Particles3D.Model");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DPrincipledMaterial() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, PrincipledMaterial>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.PrincipledMaterial");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DParticles3DSpriteParticle3D() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D_Particles3D, SpriteParticle3D>(m_projectStorage,
|
||||
m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Particles3D.SpriteParticle3D");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DTextureInput() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, TextureInput>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.TextureInput");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DSceneEnvironment() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, SceneEnvironment>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.SceneEnvironment");
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isQtQuick3DEffect() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return isBasedOnCommonType<QtQuick3D, Effect>(m_projectStorage, m_typeId);
|
||||
} else {
|
||||
return isValid() && isSubclassOf("QtQuick3D.Effect");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2036,4 +2698,14 @@ TypeName PropertyMetaInfo::propertyTypeName() const
|
||||
return propertyType().typeName();
|
||||
}
|
||||
|
||||
NodeMetaInfo NodeMetaInfo::commonBase(const NodeMetaInfo &metaInfo) const
|
||||
{
|
||||
for (const NodeMetaInfo &info : metaInfo.superClasses()) {
|
||||
if (isBasedOn(info))
|
||||
return info;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -665,11 +665,10 @@ QList<ModelNode> AbstractView::allModelNodes() const
|
||||
return toModelNodeList(model()->d->allNodes());
|
||||
}
|
||||
|
||||
QList<ModelNode> AbstractView::allModelNodesOfType(const TypeName &typeName) const
|
||||
QList<ModelNode> AbstractView::allModelNodesOfType(const NodeMetaInfo &type) const
|
||||
{
|
||||
return Utils::filtered(allModelNodes(), [typeName](const ModelNode &node){
|
||||
return node.metaInfo().isValid() && node.metaInfo().isSubclassOf(typeName);
|
||||
});
|
||||
return Utils::filtered(allModelNodes(),
|
||||
[&](const ModelNode &node) { return node.metaInfo().isBasedOn(type); });
|
||||
}
|
||||
|
||||
void AbstractView::emitDocumentMessage(const QString &error)
|
||||
@@ -814,19 +813,19 @@ void AbstractView::changeRootNodeType(const TypeName &type, int majorVersion, in
|
||||
void AbstractView::ensureMaterialLibraryNode()
|
||||
{
|
||||
ModelNode matLib = modelNodeForId(Constants::MATERIAL_LIB_ID);
|
||||
if (matLib.isValid() || rootModelNode().isSubclassOf("QtQuick3D.Material"))
|
||||
if (matLib.isValid() || rootModelNode().metaInfo().isQtQuick3DMaterial())
|
||||
return;
|
||||
|
||||
// Create material library node
|
||||
TypeName nodeType = rootModelNode().isSubclassOf("QtQuick3D.Node") ? "QtQuick3D.Node"
|
||||
: "QtQuick.Item";
|
||||
NodeMetaInfo metaInfo = model()->metaInfo(nodeType);
|
||||
matLib = createModelNode(nodeType, metaInfo.majorVersion(), metaInfo.minorVersion());
|
||||
auto nodeType = rootModelNode().metaInfo().isQtQuick3DNode() ? model()->qtQuick3DNodeMetaInfo()
|
||||
: model()->qtQuickItemMetaInfo();
|
||||
matLib = createModelNode(nodeType.typeName(), nodeType.majorVersion(), nodeType.minorVersion());
|
||||
|
||||
matLib.setIdWithoutRefactoring(Constants::MATERIAL_LIB_ID);
|
||||
rootModelNode().defaultNodeListProperty().reparentHere(matLib);
|
||||
|
||||
const QList<ModelNode> materials = rootModelNode().subModelNodesOfType("QtQuick3D.Material");
|
||||
const QList<ModelNode> materials = rootModelNode().subModelNodesOfType(
|
||||
model()->qtQuick3DMaterialMetaInfo());
|
||||
if (!materials.isEmpty()) {
|
||||
// Move all materials to under material library node
|
||||
for (const ModelNode &node : materials) {
|
||||
@@ -859,7 +858,7 @@ ModelNode AbstractView::materialLibraryNode()
|
||||
// changes to model.
|
||||
void AbstractView::assignMaterialTo3dModel(const ModelNode &modelNode, const ModelNode &materialNode)
|
||||
{
|
||||
QTC_ASSERT(modelNode.isValid() && modelNode.isSubclassOf("QtQuick3D.Model"), return);
|
||||
QTC_ASSERT(modelNode.isValid() && modelNode.metaInfo().isQtQuick3DModel(), return );
|
||||
|
||||
ModelNode matLib = materialLibraryNode();
|
||||
|
||||
@@ -868,13 +867,13 @@ void AbstractView::assignMaterialTo3dModel(const ModelNode &modelNode, const Mod
|
||||
|
||||
ModelNode newMaterialNode;
|
||||
|
||||
if (materialNode.isValid() && materialNode.isSubclassOf("QtQuick3D.Material")) {
|
||||
if (materialNode.isValid() && materialNode.metaInfo().isQtQuick3DMaterial()) {
|
||||
newMaterialNode = materialNode;
|
||||
} else {
|
||||
const QList<ModelNode> materials = matLib.directSubModelNodes();
|
||||
if (materials.size() > 0) {
|
||||
for (const ModelNode &mat : materials) {
|
||||
if (mat.isSubclassOf("QtQuick3D.Material")) {
|
||||
if (mat.metaInfo().isQtQuick3DMaterial()) {
|
||||
newMaterialNode = mat;
|
||||
break;
|
||||
}
|
||||
@@ -883,7 +882,7 @@ void AbstractView::assignMaterialTo3dModel(const ModelNode &modelNode, const Mod
|
||||
|
||||
// if no valid material, create a new default material
|
||||
if (!newMaterialNode.isValid()) {
|
||||
NodeMetaInfo metaInfo = model()->metaInfo("QtQuick3D.DefaultMaterial");
|
||||
NodeMetaInfo metaInfo = model()->qtQuick3DDefaultMaterialMetaInfo();
|
||||
newMaterialNode = createModelNode("QtQuick3D.DefaultMaterial", metaInfo.majorVersion(),
|
||||
metaInfo.minorVersion());
|
||||
newMaterialNode.validId();
|
||||
|
@@ -1734,6 +1734,174 @@ void Model::setMetaInfo(const MetaInfo &metaInfo)
|
||||
d->setMetaInfo(metaInfo);
|
||||
}
|
||||
|
||||
template<const auto &moduleName, const auto &typeName>
|
||||
NodeMetaInfo Model::createNodeMetaInfo() const
|
||||
{
|
||||
auto typeId = d->projectStorage->commonTypeCache.typeId<moduleName, typeName>();
|
||||
|
||||
return {typeId, d->projectStorage};
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickItemMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick, Item>();
|
||||
} else {
|
||||
return metaInfo("QtQuick.Item");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickRectangleMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick, Rectangle>();
|
||||
} else {
|
||||
return metaInfo("QtQuick.Rectangle");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickImageMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick, Image>();
|
||||
} else {
|
||||
return metaInfo("QtQuick.Image");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickTextMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick, Text>();
|
||||
} else {
|
||||
return metaInfo("QtQuick.Text");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickPropertyAnimationMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick, PropertyAnimation>();
|
||||
} else {
|
||||
return metaInfo("QtQuick.PropertyAnimation");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::flowViewFlowDecisionMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<FlowView, FlowDecision>();
|
||||
} else {
|
||||
return metaInfo("FlowView.FlowDecision");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::flowViewFlowWildcardMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<FlowView, FlowWildcard>();
|
||||
} else {
|
||||
return metaInfo("FlowView.FlowWildcard");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::flowViewFlowTransitionMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<FlowView, FlowTransition>();
|
||||
} else {
|
||||
return metaInfo("FlowView.FlowTransition");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickTextEditMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick, TextEdit>();
|
||||
} else {
|
||||
return metaInfo("QtQuick.TextEdit");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickControlsTextAreaMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick_Controls, TextArea>();
|
||||
} else {
|
||||
return metaInfo("QtQuick.Controls.TextArea");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuick3DNodeMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick3D, Node>();
|
||||
} else {
|
||||
return metaInfo("QtQuick3D.Node");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuick3DMaterialMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick3D, Material>();
|
||||
} else {
|
||||
return metaInfo("QtQuick3D.Material");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuick3DDefaultMaterialMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick3D, DefaultMaterial>();
|
||||
} else {
|
||||
return metaInfo("QtQuick3D.DefaultMaterial");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickTimelineTimelineMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick_Timeline, Timeline>();
|
||||
} else {
|
||||
return metaInfo("QtQuick.Timeline.Timeline");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuickTimelineKeyframeGroupMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick_Timeline, KeyframeGroup>();
|
||||
} else {
|
||||
return metaInfo("QtQuick.Timeline.KeyframeGroup");
|
||||
}
|
||||
}
|
||||
|
||||
NodeMetaInfo Model::qtQuick3DModelMetaInfo() const
|
||||
{
|
||||
if constexpr (useProjectStorage()) {
|
||||
using namespace Storage::Info;
|
||||
return createNodeMetaInfo<QtQuick3D, Storage::Info::Model>();
|
||||
} else {
|
||||
return metaInfo("QtQuick3D.Model");
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
[[maybe_unused]] std::pair<Utils::SmallStringView, Utils::SmallStringView> moduleTypeName(
|
||||
const TypeName &typeName)
|
||||
|
@@ -259,6 +259,7 @@ private:
|
||||
QVector<InternalNodePointer> toInternalNodeVector(const QVector<ModelNode> &modelNodeVector) const;
|
||||
const QList<QPointer<AbstractView>> enabledViews() const;
|
||||
|
||||
private:
|
||||
Model *m_model = nullptr;
|
||||
MetaInfo m_metaInfo;
|
||||
QList<Import> m_imports;
|
||||
|
@@ -795,17 +795,17 @@ QList<ModelNode> ModelNode::directSubModelNodes() const
|
||||
return toModelNodeList(m_internalNode->allDirectSubNodes(), view());
|
||||
}
|
||||
|
||||
QList<ModelNode> ModelNode::directSubModelNodesOfType(const TypeName &typeName) const
|
||||
QList<ModelNode> ModelNode::directSubModelNodesOfType(const NodeMetaInfo &type) const
|
||||
{
|
||||
return Utils::filtered(directSubModelNodes(), [typeName](const ModelNode &node){
|
||||
return node.metaInfo().isValid() && node.metaInfo().isSubclassOf(typeName);
|
||||
return Utils::filtered(directSubModelNodes(), [&](const ModelNode &node) {
|
||||
return node.metaInfo().isValid() && node.metaInfo().isBasedOn(type);
|
||||
});
|
||||
}
|
||||
|
||||
QList<ModelNode> ModelNode::subModelNodesOfType(const TypeName &typeName) const
|
||||
QList<ModelNode> ModelNode::subModelNodesOfType(const NodeMetaInfo &type) const
|
||||
{
|
||||
return Utils::filtered(allSubModelNodes(), [typeName](const ModelNode &node){
|
||||
return node.metaInfo().isValid() && node.metaInfo().isSubclassOf(typeName);
|
||||
return Utils::filtered(allSubModelNodes(), [&](const ModelNode &node) {
|
||||
return node.metaInfo().isValid() && node.metaInfo().isBasedOn(type);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -843,13 +843,8 @@ bool ModelNode::hasAnySubModelNodes() const
|
||||
|
||||
NodeMetaInfo ModelNode::metaInfo() const
|
||||
{
|
||||
if (!isValid()) {
|
||||
Q_ASSERT_X(isValid(), Q_FUNC_INFO, "model node is invalid");
|
||||
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
|
||||
}
|
||||
|
||||
if (!m_internalNode->typeId)
|
||||
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
|
||||
if (!isValid())
|
||||
return {};
|
||||
|
||||
if constexpr (useProjectStorage()) {
|
||||
return NodeMetaInfo(m_internalNode->typeId, m_model->projectStorage());
|
||||
@@ -1433,8 +1428,7 @@ bool ModelNode::isComponent() const
|
||||
}
|
||||
}
|
||||
|
||||
if (metaInfo().isSubclassOf("QtQuick.Loader")) {
|
||||
|
||||
if (metaInfo().isQtQuickLoader()) {
|
||||
if (hasNodeListProperty("component")) {
|
||||
|
||||
/*
|
||||
@@ -1463,14 +1457,6 @@ bool ModelNode::isComponent() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ModelNode::isSubclassOf(const TypeName &typeName, int majorVersion, int minorVersion) const
|
||||
{
|
||||
if (metaInfo().isValid())
|
||||
return metaInfo().isSubclassOf(typeName, majorVersion, minorVersion);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QIcon ModelNode::typeIcon() const
|
||||
{
|
||||
if (isValid()) {
|
||||
|
@@ -32,18 +32,13 @@ bool Qml3DNode::isValid() const
|
||||
|
||||
bool Qml3DNode::isValidQml3DNode(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlObjectNode(modelNode)
|
||||
&& modelNode.metaInfo().isValid()
|
||||
&& (modelNode.metaInfo().isSubclassOf("QtQuick3D.Node"));
|
||||
return isValidQmlObjectNode(modelNode) && (modelNode.metaInfo().isQtQuick3DNode());
|
||||
}
|
||||
|
||||
bool Qml3DNode::isValidVisualRoot(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlObjectNode(modelNode)
|
||||
&& modelNode.metaInfo().isValid()
|
||||
&& ((modelNode.metaInfo().isSubclassOf("QtQuick3D.Node"))
|
||||
|| (modelNode.metaInfo().isSubclassOf("QtQuick3D.Material")));
|
||||
|
||||
&& (modelNode.metaInfo().isQtQuick3DNode() || modelNode.metaInfo().isQtQuick3DMaterial());
|
||||
}
|
||||
|
||||
void Qml3DNode::setVariantProperty(const PropertyName &name, const QVariant &value)
|
||||
@@ -82,7 +77,7 @@ void Qml3DNode::handleEulerRotationSet()
|
||||
// The rotation property is quaternion, which is difficult to deal with for users, so QDS
|
||||
// only supports eulerRotation. Since having both on the same object isn't supported,
|
||||
// remove the rotation property if eulerRotation is set.
|
||||
if (node.isValid() && node.isSubclassOf("QtQuick3D.Node")) {
|
||||
if (node.isValid() && node.metaInfo().isQtQuick3DNode()) {
|
||||
if (!isInBaseState()) {
|
||||
QmlPropertyChanges changeSet(currentState().propertyChanges(node));
|
||||
Q_ASSERT(changeSet.isValid());
|
||||
|
@@ -29,7 +29,7 @@ bool QmlPropertyChanges::isValid() const
|
||||
|
||||
bool QmlPropertyChanges::isValidQmlPropertyChanges(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlModelNodeFacade(modelNode) && modelNode.metaInfo().isSubclassOf("QtQuick.PropertyChanges");
|
||||
return isValidQmlModelNodeFacade(modelNode) && modelNode.metaInfo().isQtQuickPropertyChanges();
|
||||
}
|
||||
|
||||
bool QmlModelStateOperation::isValid() const
|
||||
@@ -39,9 +39,7 @@ bool QmlModelStateOperation::isValid() const
|
||||
|
||||
bool QmlModelStateOperation::isValidQmlModelStateOperation(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlModelNodeFacade(modelNode)
|
||||
&& (modelNode.metaInfo().isSubclassOf("<cpp>.QDeclarative1StateOperation")
|
||||
|| modelNode.metaInfo().isSubclassOf("<cpp>.QQuickStateOperation"));
|
||||
return isValidQmlModelNodeFacade(modelNode) && modelNode.metaInfo().isQuickStateOperation();
|
||||
}
|
||||
|
||||
void QmlPropertyChanges::removeProperty(const PropertyName &name)
|
||||
|
@@ -34,16 +34,16 @@ namespace QmlDesigner {
|
||||
|
||||
bool QmlItemNode::isItemOrWindow(const ModelNode &modelNode)
|
||||
{
|
||||
if (modelNode.metaInfo().isSubclassOf("QtQuick.Item"))
|
||||
return true;
|
||||
auto metaInfo = modelNode.metaInfo();
|
||||
auto model = modelNode.model();
|
||||
|
||||
if (modelNode.metaInfo().isSubclassOf("FlowView.FlowDecision"))
|
||||
if (metaInfo.isBasedOn(model->qtQuickItemMetaInfo(),
|
||||
model->flowViewFlowDecisionMetaInfo(),
|
||||
model->flowViewFlowWildcardMetaInfo())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (modelNode.metaInfo().isSubclassOf("FlowView.FlowWildcard"))
|
||||
return true;
|
||||
|
||||
if (modelNode.metaInfo().isGraphicalItem() && modelNode.isRootNode())
|
||||
if (metaInfo.isGraphicalItem() && modelNode.isRootNode())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -264,10 +264,9 @@ bool QmlItemNode::instanceIsAnchoredByChildren() const
|
||||
|
||||
bool QmlItemNode::instanceIsMovable() const
|
||||
{
|
||||
if (modelNode().metaInfo().isValid()
|
||||
&& (modelNode().metaInfo().isSubclassOf("FlowView.FlowDecision")
|
||||
|| modelNode().metaInfo().isSubclassOf("FlowView.FlowWildcard")
|
||||
))
|
||||
auto metaInfo = modelNode().metaInfo();
|
||||
auto m = model();
|
||||
if (metaInfo.isBasedOn(m->flowViewFlowDecisionMetaInfo(), m->flowViewFlowWildcardMetaInfo()))
|
||||
return true;
|
||||
|
||||
return nodeInstance().isMovable();
|
||||
@@ -290,7 +289,7 @@ bool QmlItemNode::instanceHasScaleOrRotationTransform() const
|
||||
|
||||
bool itemIsMovable(const ModelNode &modelNode)
|
||||
{
|
||||
if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab"))
|
||||
if (modelNode.metaInfo().isQtQuickControlsTab())
|
||||
return false;
|
||||
|
||||
if (!modelNode.hasParentProperty())
|
||||
@@ -304,7 +303,7 @@ bool itemIsMovable(const ModelNode &modelNode)
|
||||
|
||||
bool itemIsResizable(const ModelNode &modelNode)
|
||||
{
|
||||
if (modelNode.metaInfo().isSubclassOf("QtQuick.Controls.Tab"))
|
||||
if (modelNode.metaInfo().isQtQuickControlsTab())
|
||||
return false;
|
||||
|
||||
return NodeHints::fromModelNode(modelNode).isResizable();
|
||||
@@ -559,7 +558,7 @@ bool QmlItemNode::isInLayout() const
|
||||
ModelNode parent = modelNode().parentProperty().parentModelNode();
|
||||
|
||||
if (parent.isValid() && parent.metaInfo().isValid())
|
||||
return parent.metaInfo().isSubclassOf("QtQuick.Layouts.Layout");
|
||||
return parent.metaInfo().isQtQuickLayoutsLayout();
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -581,20 +580,17 @@ bool QmlItemNode::isInStackedContainer() const
|
||||
|
||||
bool QmlItemNode::isFlowView() const
|
||||
{
|
||||
return modelNode().isValid()
|
||||
&& modelNode().metaInfo().isSubclassOf("FlowView.FlowView");
|
||||
return modelNode().isValid() && modelNode().metaInfo().isFlowViewFlowView();
|
||||
}
|
||||
|
||||
bool QmlItemNode::isFlowItem() const
|
||||
{
|
||||
return modelNode().isValid()
|
||||
&& modelNode().metaInfo().isSubclassOf("FlowView.FlowItem");
|
||||
return modelNode().isValid() && modelNode().metaInfo().isFlowViewFlowItem();
|
||||
}
|
||||
|
||||
bool QmlItemNode::isFlowActionArea() const
|
||||
{
|
||||
return modelNode().isValid()
|
||||
&& modelNode().metaInfo().isSubclassOf("FlowView.FlowActionArea");
|
||||
return modelNode().isValid() && modelNode().metaInfo().isFlowViewFlowActionArea();
|
||||
}
|
||||
|
||||
ModelNode QmlItemNode::rootModelNode() const
|
||||
@@ -646,8 +642,7 @@ bool QmlFlowItemNode::isValid() const
|
||||
|
||||
bool QmlFlowItemNode::isValidQmlFlowItemNode(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlObjectNode(modelNode) && modelNode.metaInfo().isValid()
|
||||
&& modelNode.metaInfo().isSubclassOf("FlowView.FlowItem");
|
||||
return isValidQmlObjectNode(modelNode) && modelNode.metaInfo().isFlowViewFlowItem();
|
||||
}
|
||||
|
||||
QList<QmlFlowActionAreaNode> QmlFlowItemNode::flowActionAreas() const
|
||||
@@ -673,8 +668,7 @@ bool QmlFlowActionAreaNode::isValid() const
|
||||
|
||||
bool QmlFlowActionAreaNode::isValidQmlFlowActionAreaNode(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlObjectNode(modelNode) && modelNode.metaInfo().isValid()
|
||||
&& modelNode.metaInfo().isSubclassOf("FlowView.FlowActionArea");
|
||||
return isValidQmlObjectNode(modelNode) && modelNode.metaInfo().isFlowViewFlowActionArea();
|
||||
}
|
||||
|
||||
ModelNode QmlFlowActionAreaNode::targetTransition() const
|
||||
@@ -730,7 +724,7 @@ bool QmlFlowViewNode::isValid() const
|
||||
bool QmlFlowViewNode::isValidQmlFlowViewNode(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlObjectNode(modelNode) && modelNode.metaInfo().isValid()
|
||||
&& modelNode.metaInfo().isSubclassOf("FlowView.FlowView");
|
||||
&& modelNode.metaInfo().isFlowViewFlowView();
|
||||
}
|
||||
|
||||
QList<QmlFlowItemNode> QmlFlowViewNode::flowItems() const
|
||||
|
@@ -17,6 +17,11 @@ AbstractView *QmlModelNodeFacade::view() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Model *QmlModelNodeFacade::model() const
|
||||
{
|
||||
return m_modelNode.model();
|
||||
}
|
||||
|
||||
NodeInstanceView *QmlModelNodeFacade::nodeInstanceView(const ModelNode &modelNode)
|
||||
{
|
||||
return modelNode.model()->nodeInstanceView();
|
||||
|
@@ -323,10 +323,11 @@ static void removeStateOperationsForChildren(const QmlObjectNode &node)
|
||||
|
||||
static void removeAnimationsFromAnimation(const ModelNode &animation)
|
||||
{
|
||||
QTC_ASSERT(animation.isValid(), return);
|
||||
QTC_ASSERT(animation.isValid(), return );
|
||||
|
||||
auto model = animation.model();
|
||||
const QList<ModelNode> propertyAnimations = animation.subModelNodesOfType(
|
||||
"QtQuick.PropertyAnimation");
|
||||
model->qtQuickPropertyAnimationMetaInfo());
|
||||
|
||||
for (const ModelNode &child : propertyAnimations) {
|
||||
if (!child.hasBindingProperty("target")) {
|
||||
@@ -808,7 +809,7 @@ QmlObjectNode *QmlObjectNode::getQmlObjectNodeOfCorrectType(const ModelNode &mod
|
||||
// Create QmlObjectNode of correct type for the modelNode
|
||||
// Note: Currently we are only interested in differentiating 3D nodes, so no check for
|
||||
// visual nodes is done for efficiency reasons
|
||||
if (modelNode.isValid() && modelNode.isSubclassOf("QtQuick3D.Node"))
|
||||
if (modelNode.isValid() && modelNode.metaInfo().isQtQuick3DNode())
|
||||
return new Qml3DNode(modelNode);
|
||||
return new QmlObjectNode(modelNode);
|
||||
}
|
||||
|
@@ -220,8 +220,7 @@ bool QmlModelState::isValid() const
|
||||
bool QmlModelState::isValidQmlModelState(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlModelNodeFacade(modelNode)
|
||||
&& modelNode.metaInfo().isValid()
|
||||
&& (modelNode.metaInfo().isSubclassOf("QtQuick.State") || isBaseState(modelNode));
|
||||
&& (modelNode.metaInfo().isQtQuickState() || isBaseState(modelNode));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -33,9 +33,7 @@ bool QmlTimeline::isValid() const
|
||||
|
||||
bool QmlTimeline::isValidQmlTimeline(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlModelNodeFacade(modelNode)
|
||||
&& modelNode.metaInfo().isValid()
|
||||
&& modelNode.metaInfo().isSubclassOf("QtQuick.Timeline.Timeline");
|
||||
return isValidQmlModelNodeFacade(modelNode) && modelNode.metaInfo().isQtQuickTimelineTimeline();
|
||||
}
|
||||
|
||||
void QmlTimeline::destroy()
|
||||
|
@@ -32,8 +32,7 @@ bool QmlTimelineKeyframeGroup::isValid() const
|
||||
|
||||
bool QmlTimelineKeyframeGroup::isValidQmlTimelineKeyframeGroup(const ModelNode &modelNode)
|
||||
{
|
||||
return modelNode.isValid() && modelNode.metaInfo().isValid()
|
||||
&& modelNode.metaInfo().isSubclassOf("QtQuick.Timeline.KeyframeGroup");
|
||||
return modelNode.isValid() && modelNode.metaInfo().isQtQuickTimelineKeyframeGroup();
|
||||
}
|
||||
|
||||
void QmlTimelineKeyframeGroup::destroy()
|
||||
@@ -263,8 +262,7 @@ QList<ModelNode> QmlTimelineKeyframeGroup::keyframePositions() const
|
||||
|
||||
bool QmlTimelineKeyframeGroup::isValidKeyframe(const ModelNode &node)
|
||||
{
|
||||
return isValidQmlModelNodeFacade(node) && node.metaInfo().isValid()
|
||||
&& node.metaInfo().isSubclassOf("QtQuick.Timeline.Keyframe");
|
||||
return isValidQmlModelNodeFacade(node) && node.metaInfo().isQtQuickTimelineKeyframe();
|
||||
}
|
||||
|
||||
bool QmlTimelineKeyframeGroup::checkKeyframesType(const ModelNode &node)
|
||||
@@ -291,7 +289,8 @@ QList<QmlTimelineKeyframeGroup> QmlTimelineKeyframeGroup::allInvalidTimelineKeyf
|
||||
QTC_ASSERT(view->model(), return ret);
|
||||
QTC_ASSERT(view->rootModelNode().isValid(), return ret);
|
||||
|
||||
const auto groups = view->rootModelNode().subModelNodesOfType("QtQuick.Timeline.KeyframeGroup");
|
||||
const auto groups = view->rootModelNode().subModelNodesOfType(
|
||||
view->model()->qtQuickTimelineKeyframeGroupMetaInfo());
|
||||
for (const QmlTimelineKeyframeGroup group : groups) {
|
||||
if (group.isDangling())
|
||||
ret.append(group);
|
||||
|
@@ -30,13 +30,13 @@ static char imagePlaceHolder[] = "qrc:/qtquickplugin/images/template_image.png";
|
||||
|
||||
bool QmlVisualNode::isItemOr3DNode(const ModelNode &modelNode)
|
||||
{
|
||||
if (modelNode.metaInfo().isSubclassOf("QtQuick.Item"))
|
||||
auto metaInfo = modelNode.metaInfo();
|
||||
auto model = modelNode.model();
|
||||
|
||||
if (metaInfo.isBasedOn(model->qtQuickItemMetaInfo(), model->qtQuick3DNodeMetaInfo()))
|
||||
return true;
|
||||
|
||||
if (modelNode.metaInfo().isSubclassOf("QtQuick3D.Node"))
|
||||
return true;
|
||||
|
||||
if (modelNode.metaInfo().isGraphicalItem() && modelNode.isRootNode())
|
||||
if (metaInfo.isGraphicalItem() && modelNode.isRootNode())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -49,11 +49,15 @@ bool QmlVisualNode::isValid() const
|
||||
|
||||
bool QmlVisualNode::isValidQmlVisualNode(const ModelNode &modelNode)
|
||||
{
|
||||
return isValidQmlObjectNode(modelNode)
|
||||
&& modelNode.metaInfo().isValid()
|
||||
&& (isItemOr3DNode(modelNode) || modelNode.metaInfo().isSubclassOf("FlowView.FlowTransition")
|
||||
|| modelNode.metaInfo().isSubclassOf("FlowView.FlowDecision")
|
||||
|| modelNode.metaInfo().isSubclassOf("FlowView.FlowWildcard"));
|
||||
if (!isValidQmlObjectNode(modelNode))
|
||||
return false;
|
||||
|
||||
auto metaInfo = modelNode.metaInfo();
|
||||
auto model = modelNode.model();
|
||||
|
||||
return metaInfo.isBasedOn(model->flowViewFlowTransitionMetaInfo(),
|
||||
model->flowViewFlowDecisionMetaInfo(),
|
||||
model->flowViewFlowWildcardMetaInfo());
|
||||
}
|
||||
|
||||
bool QmlVisualNode::isRootNode() const
|
||||
@@ -370,23 +374,17 @@ NodeListProperty QmlVisualNode::findSceneNodeProperty(AbstractView *view, qint32
|
||||
|
||||
bool QmlVisualNode::isFlowTransition(const ModelNode &node)
|
||||
{
|
||||
return node.isValid()
|
||||
&& node.metaInfo().isValid()
|
||||
&& node.metaInfo().isSubclassOf("FlowView.FlowTransition");
|
||||
return node.isValid() && node.metaInfo().isFlowViewFlowTransition();
|
||||
}
|
||||
|
||||
bool QmlVisualNode::isFlowDecision(const ModelNode &node)
|
||||
{
|
||||
return node.isValid()
|
||||
&& node.metaInfo().isValid()
|
||||
&& node.metaInfo().isSubclassOf("FlowView.FlowDecision");
|
||||
return node.isValid() && node.metaInfo().isFlowViewFlowDecision();
|
||||
}
|
||||
|
||||
bool QmlVisualNode::isFlowWildcard(const ModelNode &node)
|
||||
{
|
||||
return node.isValid()
|
||||
&& node.metaInfo().isValid()
|
||||
&& node.metaInfo().isSubclassOf("FlowView.FlowWildcard");
|
||||
return node.isValid() && node.metaInfo().isFlowViewFlowWildcard();
|
||||
}
|
||||
|
||||
bool QmlVisualNode::isFlowTransition() const
|
||||
|
@@ -313,7 +313,7 @@ bool isConnectionsType(const QmlDesigner::TypeName &type)
|
||||
|
||||
bool propertyIsComponentType(const QmlDesigner::NodeAbstractProperty &property, const QmlDesigner::TypeName &type, QmlDesigner::Model *model)
|
||||
{
|
||||
if (model->metaInfo(type).isSubclassOf("QtQuick.Component") && !isComponentType(type))
|
||||
if (model->metaInfo(type).isQmlComponent() && !isComponentType(type))
|
||||
return false; //If the type is already a subclass of Component keep it
|
||||
|
||||
return property.parentModelNode().isValid()
|
||||
@@ -507,7 +507,7 @@ public:
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
qDebug() << astTypeNode->name.toString() << typeName;
|
||||
qDebug() << metaInfo.isValid() << metaInfo.typeName();
|
||||
qDebug() << metaInfo.directSuperClass().typeName();
|
||||
qDebug() << metaInfo.superClasses().front().typeName();
|
||||
|
||||
if (!typeName.startsWith("...") && m_model == m_model->metaInfoProxyModel()
|
||||
&& metaInfo.isValid())
|
||||
|
@@ -21,33 +21,95 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace QmlDesigner::Storage::Info {
|
||||
|
||||
inline constexpr char QMLNative[] = "QML-cppnative";
|
||||
inline constexpr char Affector3D[] = "Affector3D";
|
||||
inline constexpr char Attractor3D[] = "Attractor3D";
|
||||
inline constexpr char BoolType[] = "bool";
|
||||
inline constexpr char BorderImage[] = "BorderImage";
|
||||
inline constexpr char Buffer[] = "Buffer";
|
||||
inline constexpr char Camera[] = "Camera";
|
||||
inline constexpr char Command[] = "Command";
|
||||
inline constexpr char Component[] = "Component";
|
||||
inline constexpr char DefaultMaterial[] = "DefaultMaterial";
|
||||
inline constexpr char Dialog[] = "Dialog";
|
||||
inline constexpr char DoubleType[] = "double";
|
||||
inline constexpr char Effect[] = "Effect";
|
||||
inline constexpr char FloatType[] = "float";
|
||||
inline constexpr char FlowActionArea[] = "FlowActionArea";
|
||||
inline constexpr char FlowDecision[] = "FlowDecision";
|
||||
inline constexpr char FlowItem[] = "FlowItem";
|
||||
inline constexpr char FlowTransition[] = "FlowTransition";
|
||||
inline constexpr char FlowView[] = "FlowView";
|
||||
inline constexpr char FlowWildcard[] = "FlowWildcard";
|
||||
inline constexpr char GridView[] = "GridView";
|
||||
inline constexpr char GroupItem[] = "GroupItem";
|
||||
inline constexpr char Image[] = "Image";
|
||||
inline constexpr char InstanceListEntry[] = "InstanceListEntry";
|
||||
inline constexpr char InstanceList[] = "InstanceList";
|
||||
inline constexpr char IntType[] = "int";
|
||||
inline constexpr char Item[] = "Item";
|
||||
inline constexpr char KeyframeGroup[] = "KeyframeGroup";
|
||||
inline constexpr char Keyframe[] = "Keyframe";
|
||||
inline constexpr char Layout[] = "Layout";
|
||||
inline constexpr char ListView[] = "ListView";
|
||||
inline constexpr char Loader[] = "Loader";
|
||||
inline constexpr char Material[] = "Material";
|
||||
inline constexpr char Model[] = "Model";
|
||||
inline constexpr char Node[] = "Node";
|
||||
inline constexpr char Particle3D[] = "Particle3D";
|
||||
inline constexpr char ParticleEmitter3D[] = "ParticleEmitter3D";
|
||||
inline constexpr char Pass[] = "Pass";
|
||||
inline constexpr char PathView[] = "PathView";
|
||||
inline constexpr char Path[] = "Path";
|
||||
inline constexpr char PauseAnimation[] = "PauseAnimation";
|
||||
inline constexpr char Picture[] = "Picture";
|
||||
inline constexpr char Popup[] = "Popup";
|
||||
inline constexpr char Positioner[] = "Positioner";
|
||||
inline constexpr char PrincipledMaterial[] = "PrincipledMaterial";
|
||||
inline constexpr char PropertyAnimation[] = "PropertyAnimation";
|
||||
inline constexpr char PropertyChanges[] = "PropertyChanges";
|
||||
inline constexpr char QML[] = "QML";
|
||||
inline constexpr char QML_cppnative[] = "QML-cppnative";
|
||||
inline constexpr char QQuick3DParticleAbstractShape[] = "QQuick3DParticleAbstractShape";
|
||||
inline constexpr char QtMultimedia[] = "QtMultimedia";
|
||||
inline constexpr char QtObject[] = "QtObject";
|
||||
inline constexpr char QtQml[] = "QtQml";
|
||||
inline constexpr char QtQuick3D[] = "QtQuick3D";
|
||||
inline constexpr char QtQuick3D_Particles3D[] = "QtQuick3D.Particles3D";
|
||||
inline constexpr char QtQuick3D_Particles3D_cppnative[] = "QtQuick3D.Particles3D-cppnative";
|
||||
inline constexpr char QtQuick[] = "QtQuick";
|
||||
inline constexpr char QtQuick_Controls[] = "QtQuick.Controls";
|
||||
inline constexpr char QtQuick_Dialogs[] = "QtQuick.Dialogs";
|
||||
inline constexpr char QtQuick_Extras[] = "QtQuick.Extras";
|
||||
inline constexpr char QtQuick_Layouts[] = "QtQuick.Layouts";
|
||||
inline constexpr char QtQuick_Studio_Components[] = "QtQuick.Studio.Components";
|
||||
inline constexpr char QtQuick_Timeline[] = "QtQuick.Timeline";
|
||||
inline constexpr char QtQuick_Window[] = "QtQuick.Window";
|
||||
|
||||
inline constexpr char BoolType[] = "bool";
|
||||
inline constexpr char Component[] = "Component";
|
||||
inline constexpr char Dialog[] = "Dialog";
|
||||
inline constexpr char DoubleType[] = "double";
|
||||
inline constexpr char FloatType[] = "float";
|
||||
inline constexpr char GridView[] = "GridView";
|
||||
inline constexpr char IntType[] = "int";
|
||||
inline constexpr char Item[] = "Item";
|
||||
inline constexpr char Layout[] = "Layout";
|
||||
inline constexpr char ListView[] = "ListView";
|
||||
inline constexpr char PathView[] = "PathView";
|
||||
inline constexpr char Popup[] = "Popup";
|
||||
inline constexpr char Positioner[] = "Positioner";
|
||||
inline constexpr char QtObject[] = "QtObject";
|
||||
inline constexpr char QtQuick_cppnative[] = "QtQuick-cppnative";
|
||||
inline constexpr char Qt_SafeRenderer[] = "Qt.SafeRenderer";
|
||||
inline constexpr char QuickStateOperation[] = "QuickStateOperation";
|
||||
inline constexpr char Rectangle[] = "Rectangle";
|
||||
inline constexpr char Repeater[] = "Repeater";
|
||||
inline constexpr char SafePicture[] = "SafePicture";
|
||||
inline constexpr char SafeRendererPicture[] = "SafeRendererPicture";
|
||||
inline constexpr char SceneEnvironment[] = "SceneEnvironment";
|
||||
inline constexpr char Shader[] = "Shader";
|
||||
inline constexpr char SoundEffect[] = "SoundEffect";
|
||||
inline constexpr char SplitView[] = "SplitView";
|
||||
inline constexpr char SpriteParticle3D[] = "SpriteParticle3D";
|
||||
inline constexpr char State[] = "State";
|
||||
inline constexpr char SwipeView[] = "SwipeView";
|
||||
inline constexpr char TabBar[] = "TabBar";
|
||||
inline constexpr char TabView[] = "TabView";
|
||||
inline constexpr char Tab[] = "Tab";
|
||||
inline constexpr char TextArea[] = "TextArea";
|
||||
inline constexpr char TextEdit[] = "TextEdit";
|
||||
inline constexpr char Text[] = "Text";
|
||||
inline constexpr char TextureInput[] = "TextureInput";
|
||||
inline constexpr char Texture[] = "Texture";
|
||||
inline constexpr char TimelineAnimation[] = "TimelineAnimation";
|
||||
inline constexpr char Timeline[] = "Timeline";
|
||||
inline constexpr char Transition[] = "Transition";
|
||||
inline constexpr char View3D[] = "View3D";
|
||||
inline constexpr char Window[] = "Window";
|
||||
inline constexpr char color[] = "color";
|
||||
inline constexpr char date[] = "date";
|
||||
@@ -59,44 +121,102 @@ inline constexpr char vector2d[] = "vector2d";
|
||||
inline constexpr char vector3d[] = "vector3d";
|
||||
inline constexpr char vector4d[] = "vector4d";
|
||||
|
||||
template<const auto &moduleName_, const auto &typeName_>
|
||||
struct CacheType
|
||||
struct BaseCacheType
|
||||
{
|
||||
QmlDesigner::ModuleId moduleId;
|
||||
QmlDesigner::TypeId typeId;
|
||||
};
|
||||
|
||||
template<const char *moduleName_, const char *typeName_>
|
||||
struct CacheType : public BaseCacheType
|
||||
{
|
||||
};
|
||||
|
||||
template<typename ProjectStorage>
|
||||
class CommonTypeCache
|
||||
{
|
||||
using CommonTypes = std::tuple<CacheType<QML, BoolType>,
|
||||
using CommonTypes = std::tuple<CacheType<FlowView, FlowActionArea>,
|
||||
CacheType<FlowView, FlowDecision>,
|
||||
CacheType<FlowView, FlowItem>,
|
||||
CacheType<FlowView, FlowTransition>,
|
||||
CacheType<FlowView, FlowView>,
|
||||
CacheType<FlowView, FlowWildcard>,
|
||||
CacheType<QML, BoolType>,
|
||||
CacheType<QML, Component>,
|
||||
CacheType<QML, DoubleType>,
|
||||
CacheType<QML, IntType>,
|
||||
CacheType<QML, QtObject>,
|
||||
CacheType<QML, date>,
|
||||
CacheType<QML, date>,
|
||||
CacheType<QML, string>,
|
||||
CacheType<QML, url>,
|
||||
CacheType<QML, var>,
|
||||
CacheType<QMLNative, FloatType>,
|
||||
CacheType<QML_cppnative, FloatType>,
|
||||
CacheType<QtMultimedia, SoundEffect>,
|
||||
CacheType<QtQuick, BorderImage>,
|
||||
CacheType<QtQuick, GridView>,
|
||||
CacheType<QtQuick, Image>,
|
||||
CacheType<QtQuick, Item>,
|
||||
CacheType<QtQuick, ListView>,
|
||||
CacheType<QtQuick, Loader>,
|
||||
CacheType<QtQuick, Path>,
|
||||
CacheType<QtQuick, PathView>,
|
||||
CacheType<QtQuick, PauseAnimation>,
|
||||
CacheType<QtQuick, Positioner>,
|
||||
CacheType<QtQuick, TabView>,
|
||||
CacheType<QtQuick, PropertyAnimation>,
|
||||
CacheType<QtQuick, PropertyChanges>,
|
||||
CacheType<QtQuick, Rectangle>,
|
||||
CacheType<QtQuick, Repeater>,
|
||||
CacheType<QtQuick, State>,
|
||||
CacheType<QtQuick, Text>,
|
||||
CacheType<QtQuick, TextEdit>,
|
||||
CacheType<QtQuick, Transition>,
|
||||
CacheType<QtQuick, color>,
|
||||
CacheType<QtQuick, font>,
|
||||
CacheType<QtQuick, vector2d>,
|
||||
CacheType<QtQuick, vector3d>,
|
||||
CacheType<QtQuick, vector4d>,
|
||||
CacheType<QtQuick, vector4d>,
|
||||
CacheType<QtQuick3D, Buffer>,
|
||||
CacheType<QtQuick3D, Camera>,
|
||||
CacheType<QtQuick3D, Command>,
|
||||
CacheType<QtQuick3D, DefaultMaterial>,
|
||||
CacheType<QtQuick3D, Effect>,
|
||||
CacheType<QtQuick3D, InstanceList>,
|
||||
CacheType<QtQuick3D, InstanceListEntry>,
|
||||
CacheType<QtQuick3D, Material>,
|
||||
CacheType<QtQuick3D, Model>,
|
||||
CacheType<QtQuick3D, Node>,
|
||||
CacheType<QtQuick3D, Pass>,
|
||||
CacheType<QtQuick3D, PrincipledMaterial>,
|
||||
CacheType<QtQuick3D, SceneEnvironment>,
|
||||
CacheType<QtQuick3D, Shader>,
|
||||
CacheType<QtQuick3D, Texture>,
|
||||
CacheType<QtQuick3D, TextureInput>,
|
||||
CacheType<QtQuick3D, View3D>,
|
||||
CacheType<QtQuick3D_Particles3D, Affector3D>,
|
||||
CacheType<QtQuick3D_Particles3D, Attractor3D>,
|
||||
CacheType<QtQuick3D_Particles3D, Model>,
|
||||
CacheType<QtQuick3D_Particles3D, Particle3D>,
|
||||
CacheType<QtQuick3D_Particles3D, ParticleEmitter3D>,
|
||||
CacheType<QtQuick3D_Particles3D, SpriteParticle3D>,
|
||||
CacheType<QtQuick3D_Particles3D_cppnative, QQuick3DParticleAbstractShape>,
|
||||
CacheType<QtQuick_Controls, Popup>,
|
||||
CacheType<QtQuick_Controls, SplitView>,
|
||||
CacheType<QtQuick_Controls, SwipeView>,
|
||||
CacheType<QtQuick_Controls, Tab>,
|
||||
CacheType<QtQuick_Controls, TabBar>,
|
||||
CacheType<QtQuick_Controls, TabView>,
|
||||
CacheType<QtQuick_Controls, TextArea>,
|
||||
CacheType<QtQuick_Dialogs, Dialog>,
|
||||
CacheType<QtQuick_Extras, Picture>,
|
||||
CacheType<QtQuick_Layouts, Layout>,
|
||||
CacheType<QtQuick_Studio_Components, GroupItem>,
|
||||
CacheType<QtQuick_Timeline, Keyframe>,
|
||||
CacheType<QtQuick_Timeline, KeyframeGroup>,
|
||||
CacheType<QtQuick_Timeline, Timeline>,
|
||||
CacheType<QtQuick_Timeline, TimelineAnimation>,
|
||||
CacheType<QtQuick_cppnative, QuickStateOperation>,
|
||||
CacheType<Qt_SafeRenderer, SafePicture>,
|
||||
CacheType<Qt_SafeRenderer, SafeRendererPicture>,
|
||||
CacheType<QtQuick_Window, Window>>;
|
||||
|
||||
public:
|
||||
@@ -109,13 +229,10 @@ public:
|
||||
std::apply([](auto &...type) { ((type.typeId = QmlDesigner::TypeId{}), ...); }, m_types);
|
||||
}
|
||||
|
||||
template<const auto &moduleName, const auto &typeName>
|
||||
auto typeId() const
|
||||
TypeId refreshTypedId(BaseCacheType &type,
|
||||
Utils::SmallStringView moduleName,
|
||||
Utils::SmallStringView typeName) const
|
||||
{
|
||||
auto &type = std::get<CacheType<moduleName, typeName>>(m_types);
|
||||
if (type.typeId)
|
||||
return type.typeId;
|
||||
|
||||
if (!type.moduleId)
|
||||
type.moduleId = m_projectStorage.moduleId(moduleName);
|
||||
|
||||
@@ -126,14 +243,24 @@ public:
|
||||
return type.typeId;
|
||||
}
|
||||
|
||||
template<const auto &typeName>
|
||||
auto builtinTypeId() const
|
||||
template<const char *moduleName, const char *typeName>
|
||||
TypeId typeId() const
|
||||
{
|
||||
auto &type = std::get<CacheType<moduleName, typeName>>(m_types);
|
||||
if (type.typeId)
|
||||
return type.typeId;
|
||||
|
||||
return refreshTypedId(type, moduleName, typeName);
|
||||
}
|
||||
|
||||
template<const char *typeName>
|
||||
TypeId builtinTypeId() const
|
||||
{
|
||||
return typeId<QML, typeName>();
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
auto builtinTypeId() const
|
||||
TypeId builtinTypeId() const
|
||||
{
|
||||
if constexpr (std::is_same_v<Type, double>)
|
||||
return typeId<QML, DoubleType>();
|
||||
@@ -142,7 +269,7 @@ public:
|
||||
if constexpr (std::is_same_v<Type, bool>)
|
||||
return typeId<QML, BoolType>();
|
||||
if constexpr (std::is_same_v<Type, float>)
|
||||
return typeId<QMLNative, FloatType>();
|
||||
return typeId<QML_cppnative, FloatType>();
|
||||
if constexpr (std::is_same_v<Type, QString>)
|
||||
return typeId<QML, string>();
|
||||
if constexpr (std::is_same_v<Type, QDateTime>)
|
||||
|
@@ -193,7 +193,7 @@ public:
|
||||
propertyDeclarationId);
|
||||
}
|
||||
|
||||
template<const auto &moduleName, const auto &typeName>
|
||||
template<const char *moduleName, const char *typeName>
|
||||
TypeId commonTypeId() const
|
||||
{
|
||||
return commonTypeCache.template typeId<moduleName, typeName>();
|
||||
@@ -205,7 +205,7 @@ public:
|
||||
return commonTypeCache.template builtinTypeId<BuiltinType>();
|
||||
}
|
||||
|
||||
template<const auto &builtinType>
|
||||
template<const char *builtinType>
|
||||
TypeId builtinTypeId() const
|
||||
{
|
||||
return commonTypeCache.template builtinTypeId<builtinType>();
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
|
||||
auto range = selectPrototypeAndSelfIdsStatement.template rangeWithTransaction<TypeId>(typeId);
|
||||
|
||||
for (TypeId currentTypeId : range) {
|
||||
for ([[maybe_unused]] TypeId currentTypeId : range) {
|
||||
if (((currentTypeId == baseTypeIds) || ...))
|
||||
return true;
|
||||
}
|
||||
|
@@ -200,10 +200,7 @@ static bool hasDelegateWithFileComponent(const ModelNode &node)
|
||||
|
||||
static bool isLoaderWithSourceComponent(const ModelNode &modelNode)
|
||||
{
|
||||
if (modelNode.isValid()
|
||||
&& modelNode.metaInfo().isValid()
|
||||
&& modelNode.metaInfo().isSubclassOf("QtQuick.Loader")) {
|
||||
|
||||
if (modelNode.isValid() && modelNode.metaInfo().isQtQuickLoader()) {
|
||||
if (modelNode.hasNodeProperty("sourceComponent"))
|
||||
return true;
|
||||
if (modelNode.hasNodeListProperty("component"))
|
||||
@@ -215,10 +212,8 @@ static bool isLoaderWithSourceComponent(const ModelNode &modelNode)
|
||||
|
||||
static bool hasSourceWithFileComponent(const ModelNode &modelNode)
|
||||
{
|
||||
if (modelNode.isValid()
|
||||
&& modelNode.metaInfo().isValid()
|
||||
&& modelNode.metaInfo().isSubclassOf("QtQuick.Loader")
|
||||
&& modelNode.hasVariantProperty("source"))
|
||||
if (modelNode.isValid() && modelNode.metaInfo().isQtQuickLoader()
|
||||
&& modelNode.hasVariantProperty("source"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@@ -4764,7 +4764,7 @@ void tst_TestCore::testMetaInfoSimpleType()
|
||||
QCOMPARE(itemMetaInfo.minorVersion(), 1);
|
||||
|
||||
// super classes
|
||||
NodeMetaInfo qobject = itemMetaInfo.directSuperClass();
|
||||
NodeMetaInfo qobject = itemMetaInfo.superClasses().front();
|
||||
QVERIFY(qobject.isValid());
|
||||
QVERIFY(qobject.isSubclassOf("<cpp>.QObject"));
|
||||
|
||||
@@ -4793,7 +4793,7 @@ void tst_TestCore::testMetaInfoUncreatableType()
|
||||
QCOMPARE(animationTypeInfo.majorVersion(), 2);
|
||||
QCOMPARE(animationTypeInfo.minorVersion(), 1);
|
||||
|
||||
NodeMetaInfo qObjectTypeInfo = animationTypeInfo.directSuperClass();
|
||||
NodeMetaInfo qObjectTypeInfo = animationTypeInfo.superClass().front();
|
||||
QVERIFY(qObjectTypeInfo.isValid());
|
||||
QCOMPARE(qObjectTypeInfo.simplifiedTypeName(), QmlDesigner::TypeName("QtObject"));
|
||||
|
||||
@@ -4811,7 +4811,7 @@ void tst_TestCore::testMetaInfoExtendedType()
|
||||
QVERIFY(typeInfo.hasProperty("font")); // from QGraphicsWidget
|
||||
QVERIFY(typeInfo.hasProperty("enabled")); // from QGraphicsItem
|
||||
|
||||
NodeMetaInfo graphicsObjectTypeInfo = typeInfo.directSuperClass();
|
||||
NodeMetaInfo graphicsObjectTypeInfo = typeInfo.superClass().front();
|
||||
QVERIFY(graphicsObjectTypeInfo.isValid());
|
||||
}
|
||||
|
||||
@@ -4833,7 +4833,7 @@ void tst_TestCore::testMetaInfoCustomType()
|
||||
QVERIFY(propertyChangesInfo.hasProperty("restoreEntryValues"));
|
||||
QVERIFY(propertyChangesInfo.hasProperty("explicit"));
|
||||
|
||||
NodeMetaInfo stateOperationInfo = propertyChangesInfo.directSuperClass();
|
||||
NodeMetaInfo stateOperationInfo = propertyChangesInfo.superClass().front();
|
||||
QVERIFY(stateOperationInfo.isValid());
|
||||
QCOMPARE(stateOperationInfo.typeName(), QmlDesigner::TypeName("QtQuick.QQuickStateOperation"));
|
||||
QCOMPARE(stateOperationInfo.majorVersion(), -1);
|
||||
|
@@ -47,7 +47,6 @@ public:
|
||||
|
||||
std::vector<NodeMetaInfo> classHierarchy() const { return {}; }
|
||||
std::vector<NodeMetaInfo> superClasses() const { return {}; }
|
||||
NodeMetaInfo directSuperClass() const { return {}; }
|
||||
|
||||
bool defaultPropertyIsComponent() const { return {}; }
|
||||
|
||||
@@ -62,12 +61,21 @@ public:
|
||||
bool hasCustomParser() const { return {}; }
|
||||
|
||||
bool availableInVersion(int, int) const { return {}; }
|
||||
bool isSubclassOf(const TypeName &, int = -1, int = -1) const { return {}; }
|
||||
bool isBasedOn(const NodeMetaInfo &) const { return {}; }
|
||||
bool isBasedOn(const NodeMetaInfo &, const NodeMetaInfo &) const { return {}; }
|
||||
bool isBasedOn(const NodeMetaInfo &, const NodeMetaInfo &, const NodeMetaInfo &) const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
bool isGraphicalItem() const { return {}; }
|
||||
bool isLayoutable() const { return {}; }
|
||||
bool isView() const { return {}; }
|
||||
bool isTabView() const { return {}; }
|
||||
bool isQtQuick3DNode() const { return {}; }
|
||||
bool isQtQuick3DModel() const { return {}; }
|
||||
bool isQtQuick3DMaterial() const { return {}; }
|
||||
bool isQtQuickLoader() const { return {}; }
|
||||
|
||||
QString importDirectoryPath() const { return {}; }
|
||||
|
||||
|
@@ -6792,7 +6792,7 @@ TEST_F(ProjectStorage, GetPrototypeAndSelfIdsWithExtension)
|
||||
fetchTypeId(sourceId1, "QObject")));
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, IsBaseOfForDirectPrototype)
|
||||
TEST_F(ProjectStorage, IsBasedOnForDirectPrototype)
|
||||
{
|
||||
auto package{createPackageWithProperties()};
|
||||
storage.synchronize(package);
|
||||
@@ -6805,7 +6805,7 @@ TEST_F(ProjectStorage, IsBaseOfForDirectPrototype)
|
||||
ASSERT_TRUE(isBasedOn);
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, IsBaseOfForIndirectPrototype)
|
||||
TEST_F(ProjectStorage, IsBasedOnForIndirectPrototype)
|
||||
{
|
||||
auto package{createPackageWithProperties()};
|
||||
storage.synchronize(package);
|
||||
@@ -6817,7 +6817,7 @@ TEST_F(ProjectStorage, IsBaseOfForIndirectPrototype)
|
||||
ASSERT_TRUE(isBasedOn);
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, IsBaseOfForDirectExtension)
|
||||
TEST_F(ProjectStorage, IsBasedOnForDirectExtension)
|
||||
{
|
||||
auto package{createPackageWithProperties()};
|
||||
std::swap(package.types[1].extension, package.types[1].prototype);
|
||||
@@ -6830,7 +6830,7 @@ TEST_F(ProjectStorage, IsBaseOfForDirectExtension)
|
||||
ASSERT_TRUE(isBasedOn);
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, IsBaseOfForIndirectExtension)
|
||||
TEST_F(ProjectStorage, IsBasedOnForIndirectExtension)
|
||||
{
|
||||
auto package{createPackageWithProperties()};
|
||||
std::swap(package.types[1].extension, package.types[1].prototype);
|
||||
@@ -6843,7 +6843,7 @@ TEST_F(ProjectStorage, IsBaseOfForIndirectExtension)
|
||||
ASSERT_TRUE(isBasedOn);
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, IsBaseOfForSelf)
|
||||
TEST_F(ProjectStorage, IsBasedOnForSelf)
|
||||
{
|
||||
auto package{createPackageWithProperties()};
|
||||
storage.synchronize(package);
|
||||
@@ -6855,7 +6855,7 @@ TEST_F(ProjectStorage, IsBaseOfForSelf)
|
||||
ASSERT_TRUE(isBasedOn);
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, IsNotBaseOf)
|
||||
TEST_F(ProjectStorage, IsNotBasedOn)
|
||||
{
|
||||
auto package{createPackageWithProperties()};
|
||||
storage.synchronize(package);
|
||||
@@ -6868,7 +6868,7 @@ TEST_F(ProjectStorage, IsNotBaseOf)
|
||||
ASSERT_FALSE(isBasedOn);
|
||||
}
|
||||
|
||||
TEST_F(ProjectStorage, IsNotBaseOfIfNoBaseTypeIsGiven)
|
||||
TEST_F(ProjectStorage, IsNotBasedOnIfNoBaseTypeIsGiven)
|
||||
{
|
||||
auto package{createPackageWithProperties()};
|
||||
storage.synchronize(package);
|
||||
|
Reference in New Issue
Block a user