forked from qt-creator/qt-creator
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:
committed by
Thomas Hartmann
parent
bc6879cbc8
commit
a49b85eac5
@@ -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)
|
||||
|
Reference in New Issue
Block a user