[Qt-interest] Making part of QWebView as transaparent

Samuel Rødal sroedal at trolltech.com
Thu Dec 17 12:40:10 CET 2009


>>> I wrote the child widget's paint event like this, and
>> it does most of the job the way I wanted.
>>> void MyWidget::paintEvent(QPaintEvent *event)
>>> {
>>>       QWidget::paintEvent(event);
>>>       QPainter p(this);
>>>      
>> p.setCompositionMode(QPainter::CompositionMode_Source);
>>>       p.fillRect(rect(),
>> Qt::transparent);
>>> }
>>>
>>> Only problem is my mouse, which is a PNG image appears
>> with a very dirty square background in the transparent area.
>> Am I missing something here?
>>
>> Are you drawing the mouse pointer manually? Make sure it
>> has a sensible 
>> alpha channel and that you're using
>> CompositionMode_SourceOver and not 
>> CompositionMode_Source to draw it (source should only be
>> used for the 
>> background transparency).
> 
> I am changing the mouse image like this.
> 
> QImage image;
> image.load(abc.png);
> QScreenCursor *screen =  QScreenCursor::instance();
> screen->set(image, 18 ,18);

Hmm, sounds like a potential bug in the QScreenCursor blending then. 
What is the color depth or the display, 16 or 32 bit?

--
Samuel



More information about the Qt-interest-old mailing list