Block signals to prevent a cycle

Task-number: BAUHAUS-292
This commit is contained in:
Marco Bubke
2010-01-18 18:56:01 +01:00
parent 5dce709263
commit 7b9e8b314b

View File

@@ -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();