diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/sgitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/sgitemnodeinstance.cpp index 3b3e7e3e549..acd46e7c164 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/sgitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/sgitemnodeinstance.cpp @@ -271,7 +271,24 @@ bool SGItemNodeInstance::isSGItem() const QSizeF SGItemNodeInstance::size() const { - return QSizeF(sgItem()->width(), sgItem()->height()); + double width; + + if (QSGItemPrivate::get(sgItem())->widthValid) { + width = sgItem()->width(); + } else { + width = sgItem()->implicitWidth(); + } + + double height; + + if (QSGItemPrivate::get(sgItem())->heightValid) { + height = sgItem()->height(); + } else { + height = sgItem()->implicitHeight(); + } + + + return QSizeF(width, height); } QRectF SGItemNodeInstance::boundingRectWithStepChilds(QSGItem *parentItem) const diff --git a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.cpp index 0092e7beab3..acb4ad488e1 100644 --- a/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qmlpuppet/instances/qmlgraphicsitemnodeinstance.cpp @@ -104,7 +104,24 @@ bool QmlGraphicsItemNodeInstance::isQmlGraphicsItem() const QSizeF QmlGraphicsItemNodeInstance::size() const { - return QSizeF(qmlGraphicsItem()->width(), qmlGraphicsItem()->height()); + double width; + + if (QDeclarativeItemPrivate::get(qmlGraphicsItem())->widthValid) { + width = qmlGraphicsItem()->width(); + } else { + width = qmlGraphicsItem()->implicitWidth(); + } + + double height; + + if (QDeclarativeItemPrivate::get(qmlGraphicsItem())->heightValid) { + height = qmlGraphicsItem()->height(); + } else { + height = qmlGraphicsItem()->implicitHeight(); + } + + + return QSizeF(width, height); } void QmlGraphicsItemNodeInstance::setPropertyVariant(const QString &name, const QVariant &value)