QPixmap::grabWidget and QWidget::render loose alpha
I'm doing transparency on my widget and when trying to render it in a QPixmap or QImage, the alpha is lost. QPixmap::hasAlphaChannel returns true but the actual alpha channel is full opaque.
The transparency works for the widget on the screen but not in the QPixmap.
Any hint ?
Re: QPixmap::grabWidget and QWidget::render loose alpha
erm.... you render the image into a pixmap. the widget itself has no background, with which it coul be transpariced(haha, dont know if this word exists, hope you understand what i mean).
if you want transparency, render the parent widget and draw the child onto it.
Re: QPixmap::grabWidget and QWidget::render loose alpha
Yeah it makes sense however it doesn't work. In fact if I only render the region of the parent widget that shows my widget, the transparency gets applied in the child widget but the alpha channel of the resulting pixmap is still full opaque.
I wouldn't mind if the actual rendering was full opaque but would like to get my alpha channel good.
Re: QPixmap::grabWidget and QWidget::render loose alpha
Well ... I finally made it. It appears that (I still don't know why though) QPixmap can't do it but using a QImage with Format_ARGB32 format, the widget renders opaque but the alpha channel it returns is the right one.
Re: QPixmap::grabWidget and QWidget::render loose alpha
hm... could you attach some code?
i would like to test it here.
Re: QPixmap::grabWidget and QWidget::render loose alpha
hi,
i think you just need no prepare a pixmap on which you are drawing widgets
If you are drawing items with transparency on something that is non transparent you'll see parts of old images contents on places where widgets are transparent so you need to draw them on transparent pixmap.