diff options
Diffstat (limited to 'src/effects/private/qgfxsourceproxy.cpp')
-rw-r--r-- | src/effects/private/qgfxsourceproxy.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/effects/private/qgfxsourceproxy.cpp b/src/effects/private/qgfxsourceproxy.cpp index 88e2780..cf64807 100644 --- a/src/effects/private/qgfxsourceproxy.cpp +++ b/src/effects/private/qgfxsourceproxy.cpp @@ -74,8 +74,18 @@ void QGfxSourceProxy::setInput(QQuickItem *input) { if (m_input == input) return; + + if (m_input != nullptr) + disconnect(m_input, nullptr, this, nullptr); m_input = input; polish(); + if (m_input != nullptr) { + if (QQuickImage *image = qobject_cast<QQuickImage *>(m_input)) { + connect(image, &QQuickImage::sourceSizeChanged, this, &QGfxSourceProxy::repolish); + connect(image, &QQuickImage::fillModeChanged, this, &QGfxSourceProxy::repolish); + } + connect(m_input, &QQuickItem::childrenChanged, this, &QGfxSourceProxy::repolish); + } emit inputChanged(); } @@ -117,6 +127,11 @@ void QGfxSourceProxy::useProxy() setOutput(m_proxy); } +void QGfxSourceProxy::repolish() +{ + polish(); +} + QObject *QGfxSourceProxy::findLayer(QQuickItem *item) { if (!item) @@ -177,7 +192,7 @@ void QGfxSourceProxy::updatePolish() if (shaderSource->sourceRect() == m_sourceRect || m_sourceRect.isEmpty()) direct = true; - } else if (!padded && ((image && image->fillMode() == QQuickImage::Stretch) + } else if (!padded && ((image && image->fillMode() == QQuickImage::Stretch && !image->sourceSize().isNull()) || (!image && m_input->isTextureProvider()) ) ) { |