diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2012-01-17 17:06:08 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-07 14:04:37 +0100 |
commit | 5cc1870d2084f4f9a291d92d3ccd99f2c18d6fca (patch) | |
tree | b135d347d1349a79926f98e1a9c89450708fd616 /src/quick | |
parent | b057ac0a3f1bae9620f238363310a262b247e291 (diff) |
Allow Item components to be assigned to Item.layer.effect.
Some complex effects are easier to implement as Items using
ShaderEffects internally rather than with a top-level ShaderEffect.
Auto-tests added.
Change-Id: I4b99811b87e7ca5054bf119b99207b7f5a7c666e
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 7 | ||||
-rw-r--r-- | src/quick/items/qquickitem_p.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 7195e8ab00..3e59bee180 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -5497,9 +5497,9 @@ void QQuickItemLayer::activateEffect() Q_ASSERT(!m_effect); QObject *created = m_effectComponent->create(); - m_effect = qobject_cast<QQuickShaderEffect *>(created); + m_effect = qobject_cast<QQuickItem *>(created); if (!m_effect) { - qWarning("Item: layer.effect is not a ShaderEffect."); + qWarning("Item: layer.effect is not a QML Item."); delete created; return; } @@ -5527,7 +5527,8 @@ void QQuickItemLayer::deactivateEffect() Holds the effect that is applied to this layer. - The effect must be a \l ShaderEffect. + The effect is typically a \l ShaderEffect component, although any \l Item component can be + assigned. The effect should have a source texture property with a name matching \l samplerName. \sa samplerName */ diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index 2383ae11ee..1f634bea21 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -225,7 +225,7 @@ private: QRectF m_sourceRect; QString m_name; QDeclarativeComponent *m_effectComponent; - QQuickShaderEffect *m_effect; + QQuickItem *m_effect; QQuickShaderEffectSource *m_effectSource; }; |