diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2021-11-25 20:59:01 +0100 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2021-11-26 10:26:31 +0000 |
commit | 3ee0b55b7a7397da2eba12cbb09e3aad8cb7764b (patch) | |
tree | fcb080d8462ce426b4b6265ea1488dd62ce84e7d /share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | |
parent | 0dcbe6077bf5f1fc52ff3c6eb6fc12a14dcd5202 (diff) |
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>
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp')
-rw-r--r-- | share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp index 403ba9fbe9..4399f669c7 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/quickitemnodeinstance.cpp @@ -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()); } |