QmlDesigner: Support transparent border for effects

If an effect uses transparent border int paints outside of the item.
Without this patch the item is only rendered inside the bounds of the item.
This patch always adds 40px to the bounding rectangle if an effect is
detected. This is done by effectAdjustedBoundingRect().
The 40px should be sufficient for every realistic case.

Task-number: QDS-3576
Change-Id: I82af0ea66c79039dcae92a88a5954b49de6d944f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Thomas Hartmann
2021-11-25 20:59:01 +01:00
parent 0dcbe6077b
commit 3ee0b55b7a
4 changed files with 21 additions and 1 deletions
@@ -329,11 +329,23 @@ QRectF QuickItemNodeInstance::contentItemBoundingBox() const
return QRectF();
}
static bool layerEnabledAndEffect(QQuickItem *item)
{
QQuickItemPrivate *pItem = QQuickItemPrivate::get(item);
if (pItem && pItem->layer() && pItem->layer()->enabled() && pItem->layer()->effect())
return true;
return false;
}
QRectF QuickItemNodeInstance::boundingRect() const
{
if (quickItem()) {
if (quickItem()->clip()) {
return quickItem()->boundingRect();
} else if (layerEnabledAndEffect(quickItem())) {
return ServerNodeInstance::effectAdjustedBoundingRect(quickItem());
} else {
return boundingRectWithStepChilds(quickItem());
}