forked from qt-creator/qt-creator
QmlDesigner: Render effected items with extra margin correctly
Replaced old hardcoding of 40px margin for effects with actual sourceRect of the layer. Also check for effect first before clip, as that clip doesn't actually affect the clipped item itself, it only affects the children of the clipped item. Fixes: QDS-12303 Change-Id: Ia962c74cdefb16ed17bea34f0fc50649256d78fe Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -280,10 +280,10 @@ static bool layerEnabledAndEffect(QQuickItem *item)
|
|||||||
QRectF QuickItemNodeInstance::boundingRect() const
|
QRectF QuickItemNodeInstance::boundingRect() const
|
||||||
{
|
{
|
||||||
if (quickItem()) {
|
if (quickItem()) {
|
||||||
if (quickItem()->clip()) {
|
if (layerEnabledAndEffect(quickItem())) {
|
||||||
return quickItem()->boundingRect();
|
|
||||||
} else if (layerEnabledAndEffect(quickItem())) {
|
|
||||||
return ServerNodeInstance::effectAdjustedBoundingRect(quickItem());
|
return ServerNodeInstance::effectAdjustedBoundingRect(quickItem());
|
||||||
|
} else if (quickItem()->clip()) {
|
||||||
|
return quickItem()->boundingRect();
|
||||||
} else {
|
} else {
|
||||||
QSize maximumSize(4000, 4000);
|
QSize maximumSize(4000, 4000);
|
||||||
auto isValidSize = [maximumSize] (const QRectF& rect) {
|
auto isValidSize = [maximumSize] (const QRectF& rect) {
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
|
|
||||||
#include <qmlprivategate.h>
|
#include <qmlprivategate.h>
|
||||||
|
|
||||||
|
#include <QtQuick/private/qquickitem_p.h>
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -116,8 +118,13 @@ bool ServerNodeInstance::isSubclassOf(QObject *object, const QByteArray &superTy
|
|||||||
|
|
||||||
QRectF ServerNodeInstance::effectAdjustedBoundingRect(QQuickItem *item)
|
QRectF ServerNodeInstance::effectAdjustedBoundingRect(QQuickItem *item)
|
||||||
{
|
{
|
||||||
if (item)
|
if (item) {
|
||||||
return item->boundingRect().adjusted(-40, -40, 40, 40);
|
QQuickItemPrivate *pItem = QQuickItemPrivate::get(item);
|
||||||
|
if (pItem && pItem->layer() && pItem->layer()->sourceRect().isValid())
|
||||||
|
return pItem->layer()->sourceRect();
|
||||||
|
else
|
||||||
|
return item->boundingRect();
|
||||||
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user