Make shader effects visible even if source is initially empty
authorGunnar Sletta <gunnar.sletta@nokia.com>
Mon, 14 Nov 2011 15:14:22 +0000 (16:14 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 14 Nov 2011 15:39:25 +0000 (16:39 +0100)
Task-number: QTBUG-21343

Change-Id: Iaa34d74d2458f0a9dc94c96ee13d3406e1d8f1cb
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
src/declarative/items/qquickshadereffectsource.cpp

index 351ea34..252c0ba 100644 (file)
@@ -582,8 +582,11 @@ void QQuickShaderEffectSource::setSourceItem(QQuickItem *item)
 {
     if (item == m_sourceItem)
         return;
-    if (m_sourceItem)
+    if (m_sourceItem) {
         QQuickItemPrivate::get(m_sourceItem)->derefFromEffectItem(m_hideSource);
+        disconnect(m_sourceItem, SIGNAL(widthChanged()), this, SLOT(update()));
+        disconnect(m_sourceItem, SIGNAL(heightChanged()), this, SLOT(update()));
+    }
     m_sourceItem = item;
     if (m_sourceItem) {
         // TODO: Find better solution.
@@ -595,6 +598,8 @@ void QQuickShaderEffectSource::setSourceItem(QQuickItem *item)
             m_sourceItem->setVisible(false);
         }
         QQuickItemPrivate::get(m_sourceItem)->refFromEffectItem(m_hideSource);
+        connect(m_sourceItem, SIGNAL(widthChanged()), this, SLOT(update()));
+        connect(m_sourceItem, SIGNAL(heightChanged()), this, SLOT(update()));
     }
     update();
     emit sourceItemChanged();