QmlDesigner: Handle binding properties in FormEditorView

Since the target property affects how transitions are visualized,
we have to implement this callback and update the items.

Change-Id: I30fe74dedfc0187498eee9b884f099703ca001d5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2020-01-29 15:09:46 +01:00
committed by Tim Jenssen
parent 6d32975d9a
commit 6622c6a4b7
2 changed files with 30 additions and 0 deletions

View File

@@ -36,6 +36,7 @@
#include "formeditorscene.h"
#include "abstractcustomtool.h"
#include <bindingproperty.h>
#include <designersettings.h>
#include <designmodecontext.h>
#include <modelnode.h>
@@ -367,6 +368,32 @@ void FormEditorView::selectedNodesChanged(const QList<ModelNode> &selectedNodeLi
m_scene->update();
}
void FormEditorView::bindingPropertiesChanged(const QList<BindingProperty> &propertyList, AbstractView::PropertyChangeFlags propertyChange)
{
for (const BindingProperty &property : propertyList) {
QmlVisualNode node(property.parentModelNode());
if (node.isFlowTransition()) {
qDebug() << "isflow" << node;
FormEditorItem *item = m_scene->itemForQmlItemNode(node.toQmlItemNode());
if (item) {
m_scene->reparentItem(node.toQmlItemNode(), node.toQmlItemNode().modelParentItem());
m_scene->synchronizeTransformation(item);
item->update();
}
} else if (QmlFlowActionAreaNode::isValidQmlFlowActionAreaNode(property.parentModelNode())) {
const QmlVisualNode target = property.resolveToModelNode();
if (target.modelNode().isValid() && target.isFlowTransition()) {
FormEditorItem *item = m_scene->itemForQmlItemNode(target.toQmlItemNode());
if (item) {
m_scene->reparentItem(node.toQmlItemNode(), node.toQmlItemNode().modelParentItem());
m_scene->synchronizeTransformation(item);
item->update();
}
}
}
}
}
void FormEditorView::documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &)
{
if (!errors.isEmpty())

View File

@@ -76,6 +76,9 @@ public:
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList) override;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList,
PropertyChangeFlags propertyChange) override;
void documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &warnings) override;
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data) override;