I want to achieve a blur effect using QML.
I found references about the “effect: Blur”(Example) but in Qt 4.8 this does not work.
As far as I know this is implemented with C++ code. But how?
I want to achieve a blur effect using QML. I found references about the
Share
The
effectattribute, wich all visual QML items have, accepts all the effects which are subclasses ofQGraphicsEffect. Qt 4.8 ships withQGraphicsBlurEffect,QGraphicsColorizeEffect,QGraphicsDropShadowEffect, andQGraphicsOpacityEffect. Originally these there all available in QML by default, but at one time in development (before the first public release of QtQuick) they were excluded for performance reasons. To make them work again, one has to include the following lines of code in the C++ part of his application, for instance in themainfunction:This make these classes available to QML so one can use them like:
This works, but in many case the resulting performance is really unacceptable. Then you should try to implement blurring with the help of
ShaderEffectItem. That way one can realize graphic effects with GLSL shader programs resulting in GPU rendering which is way faster than the oldQGraphicsEffect-based approach.