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: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
Marco Bubke
2011-06-29 19:34:07 +02:00
committed by Thomas Hartmann
parent bc6879cbc8
commit a49b85eac5
2 changed files with 36 additions and 2 deletions

View File

@@ -271,7 +271,24 @@ bool SGItemNodeInstance::isSGItem() const
QSizeF SGItemNodeInstance::size() 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 QRectF SGItemNodeInstance::boundingRectWithStepChilds(QSGItem *parentItem) const

View File

@@ -104,7 +104,24 @@ bool QmlGraphicsItemNodeInstance::isQmlGraphicsItem() const
QSizeF QmlGraphicsItemNodeInstance::size() 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) void QmlGraphicsItemNodeInstance::setPropertyVariant(const QString &name, const QVariant &value)