On Fri, Feb 3, 2012 at 6:46 PM, Bart Kelsey <elba...@gmail.com> wrote:
> Greets! > > I'd like to use ShaderEffectItem on a QML widget to have that widget > affect the appearance of everything underneath it. For instance, it would > be nice to be able to use a shader to blur and desaturate the area > underneath a semi-transparent widget. This is proving difficult, though, > as there's no obvious way for me to access anything on the screen below the > widget in question. The documentation says: > > It is possible to define one or more ShaderEffectItems to be a >> ShaderEffectSource<http://developer.qt.nokia.com/doc/qt-4.8/qml-shadereffectsource.html>for >> other ShaderEffectItems, but ShaderEffectItem should never be declared >> as a child element of its source item(s) because it would cause circular >> loop in the painting. >> > > Any idea if there's a way to hack around this? Having a widget that can > affect the pixels underneath it (with more than just alpha blending) would > allow for some pretty neat effects. > I don't know much about the implementation of the ShaderEffectItem, but I would assume that it doesn't create a deep cache image of the item. One way to achieve what you want is to create an extended C++ component that uses internally a QGraphicsEffect in order to take a snapshot of the item and its children. You can expose this Snapshot component to qml and apply the effect on this element instead. Notice that this deep cache operation is an expensive one, so the effect should not be active all the time for performance reasons. Br, Adriano
_______________________________________________ Qt-qml mailing list Qt-qml@qt.nokia.com http://lists.qt.nokia.com/mailman/listinfo/qt-qml