[Qt-interest] Making part of QWebView as transaparent

Nitin Mahajan nitinm76 at yahoo.com
Mon Dec 21 05:54:42 CET 2009


Hello,

--- On Thu, 17/12/09, Samuel Rødal <sroedal at trolltech.com> wrote:

> From: Samuel Rødal <sroedal at trolltech.com>
> Subject: Re: [Qt-interest] Making part of QWebView as transaparent
> To: nitinm76 at yahoo.com
> Cc: qt-interest at trolltech.com
> Date: Thursday, 17 December, 2009, 5:10 PM
> >>> 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?
> 

When I run the same code on desktop, which runs a "qvfb", the mouse is rendered properly event in the transparent area.

Earlier I wasn running it on ARM based target with "linuxfb", and the display colormode changed to 32 bit.

regards

-Nitin



> --
> Samuel
> 


      Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com. 
http://mail.promotions.yahoo.com/newdomains/aa/




More information about the Qt-interest-old mailing list