forked from qt-creator/qt-creator
QmlDesigner: Split between bounding rectangle and painted bounding rectangle
In qml the interactive bounding rectangle is always QRectF(0, 0, width, height). The painted bounding rectangle can differ from this logical one. This change is much more near to the qml description. Change-Id: I139cb70512fa1ed003b28ca2ae512f4e33e915e5 Reviewed-on: http://codereview.qt.nokia.com/812 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
415680d6e8
commit
0fcc6afd8f
@@ -90,9 +90,6 @@ QmlGraphicsItemNodeInstance::Pointer QmlGraphicsItemNodeInstance::create(QObject
|
||||
instance->setHasContent(anyItemHasContent(qmlGraphicsItem));
|
||||
qmlGraphicsItem->setFlag(QGraphicsItem::ItemHasNoContents, false);
|
||||
|
||||
if (qmlGraphicsItem->inherits("QDeclarativeText"))
|
||||
instance->setResizable(false);
|
||||
|
||||
static_cast<QDeclarativeParserStatus*>(qmlGraphicsItem)->classBegin();
|
||||
|
||||
instance->populateResetValueHash();
|
||||
@@ -107,93 +104,11 @@ bool QmlGraphicsItemNodeInstance::isQmlGraphicsItem() const
|
||||
|
||||
QSizeF QmlGraphicsItemNodeInstance::size() const
|
||||
{
|
||||
if (isValid()) {
|
||||
double implicitWidth = qmlGraphicsItem()->implicitWidth();
|
||||
if (!m_hasWidth
|
||||
&& implicitWidth // WORKAROUND
|
||||
&& qmlGraphicsItem()->width() <= 0
|
||||
&& implicitWidth != qmlGraphicsItem()->width()
|
||||
&& !hasBindingForProperty("width")) {
|
||||
qmlGraphicsItem()->blockSignals(true);
|
||||
qmlGraphicsItem()->setWidth(implicitWidth);
|
||||
qmlGraphicsItem()->blockSignals(false);
|
||||
}
|
||||
|
||||
double implicitHeight = qmlGraphicsItem()->implicitHeight();
|
||||
if (!m_hasHeight
|
||||
&& implicitWidth // WORKAROUND
|
||||
&& qmlGraphicsItem()->height() <= 0
|
||||
&& implicitHeight != qmlGraphicsItem()->height()
|
||||
&& !hasBindingForProperty("height")) {
|
||||
qmlGraphicsItem()->blockSignals(true);
|
||||
qmlGraphicsItem()->setHeight(implicitHeight);
|
||||
qmlGraphicsItem()->blockSignals(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isRootNodeInstance()) {
|
||||
if (!m_hasWidth) {
|
||||
qmlGraphicsItem()->blockSignals(true);
|
||||
if (qmlGraphicsItem()->width() < 10.)
|
||||
qmlGraphicsItem()->setWidth(100.);
|
||||
qmlGraphicsItem()->blockSignals(false);
|
||||
}
|
||||
|
||||
if (!m_hasHeight) {
|
||||
qmlGraphicsItem()->blockSignals(true);
|
||||
if (qmlGraphicsItem()->height() < 10.)
|
||||
qmlGraphicsItem()->setHeight(100.);
|
||||
qmlGraphicsItem()->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
return QSizeF(qmlGraphicsItem()->width(), qmlGraphicsItem()->height());
|
||||
}
|
||||
|
||||
QRectF QmlGraphicsItemNodeInstance::boundingRect() const
|
||||
{
|
||||
if (isValid()) {
|
||||
double implicitWidth = qmlGraphicsItem()->implicitWidth();
|
||||
if (!m_hasWidth
|
||||
&& implicitWidth // WORKAROUND
|
||||
&& qmlGraphicsItem()->width() <= 0
|
||||
&& implicitWidth != qmlGraphicsItem()->width()
|
||||
&& !hasBindingForProperty("width")) {
|
||||
qmlGraphicsItem()->blockSignals(true);
|
||||
qmlGraphicsItem()->setWidth(implicitWidth);
|
||||
qmlGraphicsItem()->blockSignals(false);
|
||||
}
|
||||
|
||||
double implicitHeight = qmlGraphicsItem()->implicitHeight();
|
||||
if (!m_hasHeight
|
||||
&& implicitWidth // WORKAROUND
|
||||
&& qmlGraphicsItem()->height() <= 0
|
||||
&& implicitHeight != qmlGraphicsItem()->height()
|
||||
&& !hasBindingForProperty("height")) {
|
||||
qmlGraphicsItem()->blockSignals(true);
|
||||
qmlGraphicsItem()->setHeight(implicitHeight);
|
||||
qmlGraphicsItem()->blockSignals(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isRootNodeInstance()) {
|
||||
if (!m_hasWidth) {
|
||||
qmlGraphicsItem()->blockSignals(true);
|
||||
if (qmlGraphicsItem()->width() < 10.)
|
||||
qmlGraphicsItem()->setWidth(100.);
|
||||
qmlGraphicsItem()->blockSignals(false);
|
||||
}
|
||||
|
||||
if (!m_hasHeight) {
|
||||
qmlGraphicsItem()->blockSignals(true);
|
||||
if (qmlGraphicsItem()->height() < 10.)
|
||||
qmlGraphicsItem()->setHeight(100.);
|
||||
qmlGraphicsItem()->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (qmlGraphicsItem())
|
||||
return qmlGraphicsItem()->boundingRect();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user