Commit a49b85ea authored by Marco Bubke's avatar Marco Bubke Committed by Thomas Hartmann
Browse files

QmlDesigner.NodeInstances: Return the implicit size if the size is invalid

Task-number: QTCREATORBUG-5240

Change-Id: Ie8be3a2cc728805411a79c1f216ede566c641c17
Reviewed-on: http://codereview.qt.nokia.com/925


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent bc6879cb
......@@ -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
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment