Multiple GraphicEffects on QLabel
How can i combine multiple QGraphics*******Effects?
When i apply more effects on a label only the last one do something.
Code:
blurEffect=new QGraphicsBlurEffect();
blurEffect->setBlurRadius(5);
blurEffect->setEnabled(true);
dropShadowEffect=new QGraphicsDropShadowEffect();
dropShadowEffect->setBlurRadius(5);
dropShadowEffect->setEnabled(true);
l->setGraphicsEffect(blurEffect);
l->setGraphicsEffect(dropShadowEffect);
Re: Multiple GraphicEffects on QLabel
Did you read the documentation for QGraphicsItem::setGraphicsEffect()?
Quote:
void QGraphicsItem::setGraphicsEffect(QGraphicsEffect * effect)
Sets effect as the item's effect. If there already is an effect installed on this item, QGraphicsItem will delete the existing effect before installing the new effect. You can delete an existing effect by calling setGraphicsEffect(0).
If effect is the installed effect on a different item, setGraphicsEffect() will remove the effect from the item and install it on this item.
If you want to combine effects, then you will have to derive your own class from QGraphicsEffect and reimplement the draw() method, as it also says in the docs:
Quote:
To create your own custom effect, create a subclass of QGraphicsEffect (or any other existing effects) and reimplement the virtual function draw(). This function is called whenever the effect needs to redraw. The draw() function takes the painter with which to draw as an argument. For more information, refer to the documenation for draw(). In the draw() function you can call sourcePixmap() to get a pixmap of the graphics effect source which you can then process.
Re: Multiple GraphicEffects on QLabel
Oh ty! I feel so stupid ... i didn´t find the method it in the QLabel class, before i searched for image/effects in qt and found something.
Another question: how can i change the brightness/contrast/hue of an image?
Re: Multiple GraphicEffects on QLabel
can you give me an example of how to use it? do i need to create the effect on my own then(using patiners)?
Re: Multiple GraphicEffects on QLabel
Qt has no image transformation tools other than the 4 graphics effects in the library. If you want to do other image processing, you will have to research the algorithms on your own and implement them as classes derived from the graphics effect base class. If you want to create an image processing pipeline, then I'd suggest you create another class derived from QGraphicsEffect that implements the pipeline and provides methods for layering effects as you wish. Install your pipeline class as the graphics effect that will be used by the QLabel.