Skip to content
Snippets Groups Projects
Commit 7b9e8b31 authored by Marco Bubke's avatar Marco Bubke
Browse files

Block signals to prevent a cycle

Task-number: BAUHAUS-292
parent 5dce7092
No related branches found
No related tags found
No related merge requests found
......@@ -96,23 +96,35 @@ QSizeF QmlGraphicsItemNodeInstance::size() const
double implicitWidth = qmlGraphicsItem()->implicitWidth();
if (!m_hasWidth
&& implicitWidth // WORKAROUND
&& implicitWidth != qmlGraphicsItem()->width())
&& implicitWidth != qmlGraphicsItem()->width()) {
qmlGraphicsItem()->blockSignals(true);
qmlGraphicsItem()->setWidth(implicitWidth);
qmlGraphicsItem()->blockSignals(false);
}
double implicitHeight = qmlGraphicsItem()->implicitHeight();
if (!m_hasHeight
&& implicitWidth // WORKAROUND
&& implicitHeight != qmlGraphicsItem()->height())
&& implicitHeight != qmlGraphicsItem()->height()) {
qmlGraphicsItem()->blockSignals(true);
qmlGraphicsItem()->setHeight(implicitHeight);
qmlGraphicsItem()->blockSignals(false);
}
}
if (modelNode().isRootNode()) {
if (!m_hasWidth)
if (!m_hasWidth) {
qmlGraphicsItem()->blockSignals(true);
qmlGraphicsItem()->setWidth(100.);
qmlGraphicsItem()->blockSignals(false);
}
if (!m_hasHeight)
if (!m_hasHeight) {
qmlGraphicsItem()->blockSignals(true);
qmlGraphicsItem()->setHeight(100.);
qmlGraphicsItem()->blockSignals(false);
}
}
return QSizeF(qmlGraphicsItem()->width(), qmlGraphicsItem()->height());
......@@ -124,23 +136,35 @@ QRectF QmlGraphicsItemNodeInstance::boundingRect() const
double implicitWidth = qmlGraphicsItem()->implicitWidth();
if (!m_hasWidth
&& implicitWidth // WORKAROUND
&& implicitWidth != qmlGraphicsItem()->width())
&& implicitWidth != qmlGraphicsItem()->width()) {
qmlGraphicsItem()->blockSignals(true);
qmlGraphicsItem()->setWidth(implicitWidth);
qmlGraphicsItem()->blockSignals(false);
}
double implicitHeight = qmlGraphicsItem()->implicitHeight();
if (!m_hasHeight
&& implicitWidth // WORKAROUND
&& implicitHeight != qmlGraphicsItem()->height())
&& implicitHeight != qmlGraphicsItem()->height()) {
qmlGraphicsItem()->blockSignals(true);
qmlGraphicsItem()->setHeight(implicitHeight);
qmlGraphicsItem()->blockSignals(false);
}
}
if (modelNode().isRootNode()) {
if (!m_hasWidth)
if (!m_hasWidth) {
qmlGraphicsItem()->blockSignals(true);
qmlGraphicsItem()->setWidth(100.);
qmlGraphicsItem()->blockSignals(false);
}
if (!m_hasHeight)
if (!m_hasHeight) {
qmlGraphicsItem()->blockSignals(true);
qmlGraphicsItem()->setHeight(100.);
qmlGraphicsItem()->blockSignals(false);
}
}
return qmlGraphicsItem()->boundingRect();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment