forked from qt-creator/qt-creator
QmlDesigner: Fix getting the bounding rectangle for an effect
When getting the bounding rect for an effect we actually have to find the item with the effect first. Change-Id: I4e20f77c6b8dca9d58ccffb42d8b803f57317cb9 Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -277,11 +277,25 @@ static bool layerEnabledAndEffect(QQuickItem *item)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QRectF getBoundingRectForEffect(QQuickItem *item)
|
||||||
|
{
|
||||||
|
const auto siblings = item->parentItem()->childItems();
|
||||||
|
for (auto sibling : siblings) {
|
||||||
|
QQmlProperty prop(sibling, "__effect");
|
||||||
|
if (prop.read().toBool()) {
|
||||||
|
prop = QQmlProperty(sibling, "source");
|
||||||
|
if (prop.read().value<QQuickItem *>() == item)
|
||||||
|
return ServerNodeInstance::effectAdjustedBoundingRect(sibling);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ServerNodeInstance::effectAdjustedBoundingRect(item);
|
||||||
|
}
|
||||||
|
|
||||||
QRectF QuickItemNodeInstance::boundingRect() const
|
QRectF QuickItemNodeInstance::boundingRect() const
|
||||||
{
|
{
|
||||||
if (quickItem()) {
|
if (quickItem()) {
|
||||||
if (layerEnabledAndEffect(quickItem())) {
|
if (layerEnabledAndEffect(quickItem()) && quickItem()->parentItem()) {
|
||||||
return ServerNodeInstance::effectAdjustedBoundingRect(quickItem());
|
return getBoundingRectForEffect(quickItem());
|
||||||
} else if (quickItem()->clip()) {
|
} else if (quickItem()->clip()) {
|
||||||
return quickItem()->boundingRect();
|
return quickItem()->boundingRect();
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user