forked from qt-creator/qt-creator
QmlDesigner: Fix composed drop shadow effect resize
Source width/height changes were not listened for. Added connections for those. Note that Connections element was not used as it doesn't seem to work in puppet. Fixes: QDS-12395 Change-Id: I30abdfa3e7ea08b3f126fbafeab6cb522040f16b Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -805,10 +805,22 @@ R"(
|
|||||||
onExtraMarginChanged: setupSourceRect()
|
onExtraMarginChanged: setupSourceRect()
|
||||||
|
|
||||||
function setupSourceRect() {
|
function setupSourceRect() {
|
||||||
if (rootItem.source) {
|
if (source) {
|
||||||
var width = source.width + extraMargin * 2
|
var w = source.width + extraMargin * 2
|
||||||
var height = source.height + extraMargin * 2
|
var h = source.height + extraMargin * 2
|
||||||
source.layer.sourceRect = Qt.rect(-extraMargin, -extraMargin, width, height)
|
source.layer.sourceRect = Qt.rect(-extraMargin, -extraMargin, w, h)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function connectSource(enable) {
|
||||||
|
if (source) {
|
||||||
|
if (enable) {
|
||||||
|
source.widthChanged.connect(setupSourceRect)
|
||||||
|
source.heightChanged.connect(setupSourceRect)
|
||||||
|
} else {
|
||||||
|
source.widthChanged.disconnect(setupSourceRect)
|
||||||
|
source.heightChanged.disconnect(setupSourceRect)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)"
|
)"
|
||||||
@@ -837,7 +849,8 @@ R"(
|
|||||||
if (_oldParent && _oldParent !== parent) {
|
if (_oldParent && _oldParent !== parent) {
|
||||||
_oldParent.layer.enabled = false
|
_oldParent.layer.enabled = false
|
||||||
_oldParent.layer.effect = null
|
_oldParent.layer.effect = null
|
||||||
%2
|
%7
|
||||||
|
%4%2
|
||||||
_oldParent.update()
|
_oldParent.update()
|
||||||
_oldParent = null
|
_oldParent = null
|
||||||
}
|
}
|
||||||
@@ -847,8 +860,8 @@ R"(
|
|||||||
parent.layer.enabled = true
|
parent.layer.enabled = true
|
||||||
parent.layer.effect = effectComponent
|
parent.layer.effect = effectComponent
|
||||||
}
|
}
|
||||||
%1
|
%6
|
||||||
%3
|
%4%1%5%3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -856,36 +869,47 @@ R"(
|
|||||||
if (visible) {
|
if (visible) {
|
||||||
parent.layer.enabled = true
|
parent.layer.enabled = true
|
||||||
parent.layer.effect = effectComponent
|
parent.layer.effect = effectComponent
|
||||||
source = parent
|
%6
|
||||||
%3
|
%4%1%5%3
|
||||||
} else {
|
} else {
|
||||||
parent.layer.enabled = false
|
parent.layer.enabled = false
|
||||||
parent.layer.effect = null
|
parent.layer.effect = null
|
||||||
source = null
|
%8
|
||||||
|
%4%2
|
||||||
}
|
}
|
||||||
parent.update()
|
parent.update()
|
||||||
}
|
}
|
||||||
|
|
||||||
)"
|
)"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QString mipmap1;
|
||||||
|
QString mipmap2;
|
||||||
|
QString mipmap3;
|
||||||
if (m_shaderFeatures.enabled(ShaderFeatures::Mipmap)) {
|
if (m_shaderFeatures.enabled(ShaderFeatures::Mipmap)) {
|
||||||
QString mipmap1{
|
mipmap1 = QString {
|
||||||
R"(parent.layer.smooth = true
|
R"(parent.layer.smooth = true
|
||||||
parent.layer.mipmap = true
|
parent.layer.mipmap = true)"
|
||||||
%1)"
|
|
||||||
};
|
};
|
||||||
QString mipmap2{
|
mipmap2 = QString {
|
||||||
R"(_oldParent.layer.smooth = false
|
R"(_oldParent.layer.smooth = false
|
||||||
_oldParent.layer.mipmap = false
|
_oldParent.layer.mipmap = false)"
|
||||||
%2)"
|
};
|
||||||
|
mipmap3 = QString {
|
||||||
|
R"(parent.layer.smooth = false
|
||||||
|
parent.layer.mipmap = false)"
|
||||||
};
|
};
|
||||||
parentChanged = parentChanged.arg(mipmap1, mipmap2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_shaderFeatures.enabled(ShaderFeatures::Source)) {
|
if (m_shaderFeatures.enabled(ShaderFeatures::Source)) {
|
||||||
parentChanged = parentChanged.arg(QString("source = parent"),
|
parentChanged = parentChanged.arg(QString("source = parent"),
|
||||||
QString("source = null"),
|
QString("source = null"),
|
||||||
m_extraMargin ? QString("setupSourceRect()") : QString());
|
m_extraMargin ? QString(" setupSourceRect()") : QString(),
|
||||||
|
m_extraMargin ? QString("connectSource(false)\n ") : QString(),
|
||||||
|
m_extraMargin ? QString("\n connectSource(true)\n") : QString(),
|
||||||
|
mipmap1,
|
||||||
|
mipmap2,
|
||||||
|
mipmap3);
|
||||||
} else {
|
} else {
|
||||||
parentChanged = parentChanged.arg(QString(), QString(), QString());
|
parentChanged = parentChanged.arg(QString(), QString(), QString());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user