Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, September 2007
QGraphicsItem semi-transparent


Message 1 in thread

Anybody know if there is a way to make a QGraphicsItem (and in particular a QGraphicsPixmapItem) semi-transparent?

I can't found a way to change the opacity of an item...

Thanks!


------------------------------------------------------
Leggi GRATIS le tue mail con il telefonino i-mode? di Wind
http://i-mode.wind.it/


--
 [ signature omitted ] 

Message 2 in thread

1. Get the brush of the item.
2. Set the color with alpha value (0-255)in the brush.

This will give you transparency! 

-----Original Message-----
From: fabiodago@xxxxxxxxx [mailto:fabiodago@xxxxxxxxx] 
Sent: Tuesday, September 04, 2007 7:08 PM
To: qt qt
Subject: QGraphicsItem semi-transparent

Anybody know if there is a way to make a QGraphicsItem (and in
particular a QGraphicsPixmapItem) semi-transparent?

I can't found a way to change the opacity of an item...

Thanks!


------------------------------------------------------
Leggi GRATIS le tue mail con il telefonino i-mode(tm) di Wind
http://i-mode.wind.it/


--
 [ signature omitted ] 

Message 3 in thread

You can inherit from the item you want (pixmap in your case) and override
the paint() method to set the opacity of the painter before doing the real
painting.
Something like this:

void paint(QPainter * painter, const QStyleOptionGraphicsItem* option,
QWidget* widget)
{
  painter->setOpacity(0.5);
  QGraphicsPixmapItem::paint(painter, option, widget);
  painter->setOpacity(1.0);
}

I hope this helps.

Sebastien Grignard


"fabiodago@xxxxxxxxx" <fabiodago@xxxxxxxxx> a Ãcrit sur 04/09/2007 15:38:29
:

> Anybody know if there is a way to make a QGraphicsItem (and in
> particular a QGraphicsPixmapItem) semi-transparent?
>
> I can't found a way to change the opacity of an item...
>
> Thanks!
>
>
> ------------------------------------------------------
> Leggi GRATIS le tue mail con il telefonino i-modeâ di Wind
> http://i-mode.wind.it/
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
> with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
********************************************************************************
The information contained in this communication is confidential, may be
attorney-client privileged, may constitute inside information, and is intended
only for the use of the addressee. It is the property of the company of the
sender of this e-mail. Unauthorized use, disclosure, or copying of this
communication or any part thereof is strictly prohibited and may be unlawful.
If you have received this communication in error, please notify us immediately
by return e-mail and destroy this communication and all copies thereof,
including all attachments.
********************************************************************************


Message 4 in thread

And how I can get the brush of a QGrapicsItem?


---------- Initial Header -----------

From      : "Prateek Tiwari" ptiwari@xxxxxxxxxxx
To          : fabiodago@xxxxxxxxx,"qt qt" qt-interest@xxxxxxxxxxxxx
Cc          :
Date      : Wed, 5 Sep 2007 10:01:12 +0530
Subject : RE: QGraphicsItem semi-transparent







> 1. Get the brush of the item.
> 2. Set the color with alpha value (0-255)in the brush.
>
> This will give you transparency!
>
> -----Original Message-----
> From: fabiodago@xxxxxxxxx [mailto:fabiodago@xxxxxxxxx]
> Sent: Tuesday, September 04, 2007 7:08 PM
> To: qt qt
> Subject: QGraphicsItem semi-transparent
>
> Anybody know if there is a way to make a QGraphicsItem (and in
> particular a QGraphicsPixmapItem) semi-transparent?
>
> I can't found a way to change the opacity of an item...
>
> Thanks!
>
>
> ------------------------------------------------------
> Leggi GRATIS le tue mail con il telefonino i-mode(tm) di Wind
> http://i-mode.wind.it/
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
> 


------------------------------------------------------
Leggi GRATIS le tue mail con il telefonino i-mode? di Wind
http://i-mode.wind.it/


--
 [ signature omitted ] 

Message 5 in thread

fabiodago@xxxxxxxxx skrev:
> And how I can get the brush of a QGrapicsItem?
>   
I think what he was trying to say is that you have to make sure the 
colors used to paint the item are semitransparent. There is no way to 
add transparency on an item, you have to do it with the painting.

Bo.

>
> ---------- Initial Header -----------
>
> From      : "Prateek Tiwari" ptiwari@xxxxxxxxxxx
> To          : fabiodago@xxxxxxxxx,"qt qt" qt-interest@xxxxxxxxxxxxx
> Cc          : 
> Date      : Wed, 5 Sep 2007 10:01:12 +0530
> Subject : RE: QGraphicsItem semi-transparent
>
>
>
>
>
>
>
>   
>> 1. Get the brush of the item.
>> 2. Set the color with alpha value (0-255)in the brush.
>>
>> This will give you transparency! 
>>
>> -----Original Message-----
>> From: fabiodago@xxxxxxxxx [mailto:fabiodago@xxxxxxxxx] 
>> Sent: Tuesday, September 04, 2007 7:08 PM
>> To: qt qt
>> Subject: QGraphicsItem semi-transparent
>>
>> Anybody know if there is a way to make a QGraphicsItem (and in
>> particular a QGraphicsPixmapItem) semi-transparent?
>>
>> I can't found a way to change the opacity of an item...
>>
>> Thanks!
>>
>>
>> ------------------------------------------------------
>> Leggi GRATIS le tue mail con il telefonino i-mode(tm) di Wind
>> http://i-mode.wind.it/
>>
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>> "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>>     
>
>
> ------------------------------------------------------
> Leggi GRATIS le tue mail con il telefonino i-mode™ di Wind
> http://i-mode.wind.it/
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>   

--
 [ signature omitted ]