QmlDesigner: Disable "Edit Component" for effect composer effects

These components are autogenerated and overwritten by effect composer,
so a regular user has no reason to modify them manually.

Fixes: QDS-9020
Change-Id: Ida6706f123a8304944a19364c59620b8d9b4adbb
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2024-02-20 13:55:00 +02:00
parent 3e81485c6a
commit f2b29195da
6 changed files with 11 additions and 7 deletions

View File

@@ -577,6 +577,7 @@ QString EffectComposerModel::getQmlEffectString()
QString header{ QString header{
R"( R"(
// Created with Qt Design Studio (version %1), %2 // Created with Qt Design Studio (version %1), %2
// Do not manually edit this file, it will be overwritten if effect is modified in Qt Design Studio.
import QtQuick import QtQuick

View File

@@ -1896,7 +1896,7 @@ void DesignerActionManager::createDefaultDesignerActions()
QKeySequence(Qt::Key_F2), QKeySequence(Qt::Key_F2),
Priorities::ComponentActions + 2, Priorities::ComponentActions + 2,
&goIntoComponentOperation, &goIntoComponentOperation,
&selectionIsComponent)); &selectionIsEditableComponent));
addDesignerAction(new ModelNodeContextMenuAction(jumpToCodeCommandId, addDesignerAction(new ModelNodeContextMenuAction(jumpToCodeCommandId,
JumpToCodeDisplayName, JumpToCodeDisplayName,

View File

@@ -89,10 +89,10 @@ bool fileComponentExists(const ModelNode &modelNode)
return QFileInfo::exists(fileName); return QFileInfo::exists(fileName);
} }
bool selectionIsComponent(const SelectionContext &selectionState) bool selectionIsEditableComponent(const SelectionContext &selectionState)
{ {
return selectionState.currentSingleSelectedNode().isComponent() ModelNode node = selectionState.currentSingleSelectedNode();
&& fileComponentExists(selectionState.currentSingleSelectedNode()); return node.isComponent() && !QmlItemNode(node).isEffectItem() && fileComponentExists(node);
} }
bool selectionIsImported3DAsset(const SelectionContext &selectionState) bool selectionIsImported3DAsset(const SelectionContext &selectionState)

View File

@@ -124,7 +124,7 @@ inline bool singleSelectedItem(const SelectionContext &selectionState)
} }
bool selectionHasSameParent(const SelectionContext &selectionState); bool selectionHasSameParent(const SelectionContext &selectionState);
bool selectionIsComponent(const SelectionContext &selectionState); bool selectionIsEditableComponent(const SelectionContext &selectionState);
bool singleSelectionItemIsAnchored(const SelectionContext &selectionState); bool singleSelectionItemIsAnchored(const SelectionContext &selectionState);
bool singleSelectionItemIsNotAnchored(const SelectionContext &selectionState); bool singleSelectionItemIsNotAnchored(const SelectionContext &selectionState);
bool selectionIsImported3DAsset(const SelectionContext &selectionState); bool selectionIsImported3DAsset(const SelectionContext &selectionState);

View File

@@ -749,7 +749,8 @@ QString PropertyEditorQmlBackend::templateGeneration(const NodeMetaInfo &metaTyp
qmlTemplate += "Column {\n"; qmlTemplate += "Column {\n";
qmlTemplate += "width: parent.width\n"; qmlTemplate += "width: parent.width\n";
if (node.modelNode().isComponent()) bool isEditableComponent = node.modelNode().isComponent() && !QmlItemNode(node).isEffectItem();
if (isEditableComponent)
qmlTemplate += "ComponentButton {}\n"; qmlTemplate += "ComponentButton {}\n";
QString qmlInnerTemplate = ""; QString qmlInnerTemplate = "";

View File

@@ -574,8 +574,10 @@ void PropertyEditorView::setupQmlBackend()
{ {
if constexpr (useProjectStorage()) { if constexpr (useProjectStorage()) {
auto selfAndPrototypes = m_selectedNode.metaInfo().selfAndPrototypes(); auto selfAndPrototypes = m_selectedNode.metaInfo().selfAndPrototypes();
bool isEditableComponent = m_selectedNode.isComponent()
&& !QmlItemNode(m_selectedNode).isEffectItem();
auto specificQmlData = m_propertyEditorComponentGenerator.create(selfAndPrototypes, auto specificQmlData = m_propertyEditorComponentGenerator.create(selfAndPrototypes,
m_selectedNode.isComponent()); isEditableComponent);
auto [panePath, specificsPath] = findPaneAndSpecificsPath(selfAndPrototypes, auto [panePath, specificsPath] = findPaneAndSpecificsPath(selfAndPrototypes,
model()->pathCache()); model()->pathCache());
PropertyEditorQmlBackend *currentQmlBackend = getQmlBackend(m_qmlBackendHash, PropertyEditorQmlBackend *currentQmlBackend = getQmlBackend(m_qmlBackendHash,