forked from qt-creator/qt-creator
QmlDesigner: Reduce calls to updateGeometry
Those calls can really become slow in large flows and do not seem to be required. Change-Id: Ibd3cda917c2d71db10bc90ad2ca58351e8bf7d0f Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -605,8 +605,14 @@ void FormEditorFlowItem::updateGeometry()
|
|||||||
{
|
{
|
||||||
FormEditorItem::updateGeometry();
|
FormEditorItem::updateGeometry();
|
||||||
const QPointF pos = qmlItemNode().flowPosition();
|
const QPointF pos = qmlItemNode().flowPosition();
|
||||||
|
|
||||||
setTransform(QTransform::fromTranslate(pos.x(), pos.y()));
|
setTransform(QTransform::fromTranslate(pos.x(), pos.y()));
|
||||||
|
|
||||||
|
if (pos == m_oldPos)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_oldPos = pos;
|
||||||
|
|
||||||
// Call updateGeometry() on all related transitions
|
// Call updateGeometry() on all related transitions
|
||||||
QmlFlowTargetNode flowItem(qmlItemNode());
|
QmlFlowTargetNode flowItem(qmlItemNode());
|
||||||
if (flowItem.isValid() && flowItem.flowView().isValid()) {
|
if (flowItem.isValid() && flowItem.flowView().isValid()) {
|
||||||
@@ -652,16 +658,6 @@ void FormEditorFlowActionItem::updateGeometry()
|
|||||||
FormEditorItem::updateGeometry();
|
FormEditorItem::updateGeometry();
|
||||||
//const QPointF pos = qmlItemNode().flowPosition();
|
//const QPointF pos = qmlItemNode().flowPosition();
|
||||||
//setTransform(QTransform::fromTranslate(pos.x(), pos.y()));
|
//setTransform(QTransform::fromTranslate(pos.x(), pos.y()));
|
||||||
|
|
||||||
// Call updateGeometry() on all related transitions
|
|
||||||
QmlFlowItemNode flowItem = QmlFlowActionAreaNode(qmlItemNode()).flowItemParent();
|
|
||||||
if (flowItem.isValid() && flowItem.flowView().isValid()) {
|
|
||||||
const auto nodes = flowItem.flowView().transitions();
|
|
||||||
for (const ModelNode &node : nodes) {
|
|
||||||
if (FormEditorItem *item = scene()->itemForQmlItemNode(node))
|
|
||||||
item->updateGeometry();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorFlowActionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
|
void FormEditorFlowActionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
|
||||||
@@ -1748,16 +1744,6 @@ void FormEditorFlowDecisionItem::updateGeometry()
|
|||||||
setTransform(qmlItemNode().instanceTransformWithContentTransform());
|
setTransform(qmlItemNode().instanceTransformWithContentTransform());
|
||||||
const QPointF pos = qmlItemNode().flowPosition();
|
const QPointF pos = qmlItemNode().flowPosition();
|
||||||
setTransform(QTransform::fromTranslate(pos.x(), pos.y()));
|
setTransform(QTransform::fromTranslate(pos.x(), pos.y()));
|
||||||
|
|
||||||
// Call updateGeometry() on all related transitions
|
|
||||||
QmlFlowTargetNode flowItem(qmlItemNode());
|
|
||||||
if (flowItem.isValid() && flowItem.flowView().isValid()) {
|
|
||||||
const auto nodes = flowItem.flowView().transitions();
|
|
||||||
for (const ModelNode &node : nodes) {
|
|
||||||
if (FormEditorItem *item = scene()->itemForQmlItemNode(node))
|
|
||||||
item->updateGeometry();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorFlowDecisionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void FormEditorFlowDecisionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
@@ -163,6 +163,8 @@ protected:
|
|||||||
FormEditorFlowItem(const QmlItemNode &qmlItemNode, FormEditorScene *scene)
|
FormEditorFlowItem(const QmlItemNode &qmlItemNode, FormEditorScene *scene)
|
||||||
: FormEditorItem(qmlItemNode, scene)
|
: FormEditorItem(qmlItemNode, scene)
|
||||||
{}
|
{}
|
||||||
|
private:
|
||||||
|
QPointF m_oldPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FormEditorFlowActionItem : public FormEditorItem
|
class FormEditorFlowActionItem : public FormEditorItem
|
||||||
@@ -180,6 +182,8 @@ protected:
|
|||||||
FormEditorFlowActionItem(const QmlItemNode &qmlItemNode, FormEditorScene *scene)
|
FormEditorFlowActionItem(const QmlItemNode &qmlItemNode, FormEditorScene *scene)
|
||||||
: FormEditorItem(qmlItemNode, scene)
|
: FormEditorItem(qmlItemNode, scene)
|
||||||
{}
|
{}
|
||||||
|
private:
|
||||||
|
QPointF m_oldPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FormEditorTransitionItem : public FormEditorItem
|
class FormEditorTransitionItem : public FormEditorItem
|
||||||
|
Reference in New Issue
Block a user