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

Qt-interest Archive, August 2005
Transperant background of textlabel


Message 1 in thread

Hi,

I have an pixmap in a widget(Dialog).
I want to put TextLabel on the widget.

How can I make the TextLabel background as transparent so that my text
only displayed on the pixmap of the widget.

Thanks for your replies.


Regards, 
Ramesh Melam



Confidentiality Notice

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@xxxxxxxxx immediately
and destroy all copies of this message and any attachments.


Message 2 in thread

    textLabel.setPaletteBackgroundPixmap("thePixmapOfTheDialog");
    textLabel.setBackgroundOrigin(QWidget::ParentOrigin);

The documentation is very clear about things like that :-)

melam.ramesh@xxxxxxxxx wrote:

>Hi,
>
>I have an pixmap in a widget(Dialog).
>I want to put TextLabel on the widget.
>
>How can I make the TextLabel background as transparent so that my text
>only displayed on the pixmap of the widget.
>
>Thanks for your replies.
>
>
>Regards, 
>Ramesh Melam
>
>
>
>Confidentiality Notice
>
>The information contained in this electronic message and any attachments to this message are intended
>for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
>you are not the intended recipient, please notify the sender at Wipro or Mailadmin@xxxxxxxxx immediately
>and destroy all copies of this message and any attachments.
>
>
>
>
>  
>

begin:vcard
begin:vcard
fn:Yorgos Pagles
n:Pagles;Yorgos
org:Intracom S.A.;Telecom Systems, Research and Development, Lottery Systems
adr:Peania;;19th Km of Markopoulou Ave;Athens;Attica;GR19002;Greece
email;internet:gpag@xxxxxxxxxxx
title:Gaming Applications Software Engineer
tel;work:++302106671242
tel;fax:++302106677180
x-mozilla-html:FALSE
url:http://www.intracom.gr/en/products/lottery_systems/start.htm
version:2.1
end:vcard


Message 3 in thread

Alternatively, you could draw your text on the pixmap.

    QPainter p( &pixmap );
    // set pen and brush if desired; Qt::NoBrush, perhaps?
    p.drawText( ... );

Nathan


On 8/24/05 2:31 AM, "Yorgos Pagles" <gpag@xxxxxxxxxxx> wrote:

>     textLabel.setPaletteBackgroundPixmap("thePixmapOfTheDialog");
>     textLabel.setBackgroundOrigin(QWidget::ParentOrigin);
> 
> The documentation is very clear about things like that :-)
> 
> melam.ramesh@xxxxxxxxx wrote:
> 
>> Hi,
>> 
>> I have an pixmap in a widget(Dialog).
>> I want to put TextLabel on the widget.
>> 
>> How can I make the TextLabel background as transparent so that my text
>> only displayed on the pixmap of the widget.
>> 
>> Thanks for your replies.
>> 
>> 
>> Regards, 
>> Ramesh Melam
>> 
>> 
>> 
>> Confidentiality Notice
>> 
>> The information contained in this electronic message and any attachments to
>> this message are intended
>> for the exclusive use of the addressee(s) and may contain confidential or
>> privileged information. If
>> you are not the intended recipient, please notify the sender at Wipro or
>> Mailadmin@xxxxxxxxx immediately
>> and destroy all copies of this message and any attachments.
>> 
>> 
>> 
>> 
>>  
>> 
> 

 
Nathan Carter
Mathematical Sciences Department
Bentley College
175 Forest St., Morison 319
Waltham, MA  02452
(781) 891-3171



Message 4 in thread

I've found the best solution is to subclass Qlabel (and set the autoMask
flag) and implement the updateMask method.
Draw your text into the widgets mask and now it's bg will be transparent
in any situation (esp. if the parent is a button which changes bg color
depending on it's out/over/down state.) Don';t forget to call updateMask
when your text value changes.

Cheers,
Ben 

-----Original Message-----
From: Nathan Carter [mailto:ncarter@xxxxxxxxxxx] 
Sent: Wednesday, August 24, 2005 9:42 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: Transperant background of textlabel


Alternatively, you could draw your text on the pixmap.

    QPainter p( &pixmap );
    // set pen and brush if desired; Qt::NoBrush, perhaps?
    p.drawText( ... );

Nathan


On 8/24/05 2:31 AM, "Yorgos Pagles" <gpag@xxxxxxxxxxx> wrote:

>     textLabel.setPaletteBackgroundPixmap("thePixmapOfTheDialog");
>     textLabel.setBackgroundOrigin(QWidget::ParentOrigin);
> 
> The documentation is very clear about things like that :-)
> 
> melam.ramesh@xxxxxxxxx wrote:
> 
>> Hi,
>> 
>> I have an pixmap in a widget(Dialog).
>> I want to put TextLabel on the widget.
>> 
>> How can I make the TextLabel background as transparent so that my 
>> text only displayed on the pixmap of the widget.
>> 
>> Thanks for your replies.
>> 
>> 
>> Regards,
>> Ramesh Melam
>> 
>> 
>> 
>> Confidentiality Notice
>> 
>> The information contained in this electronic message and any 
>> attachments to this message are intended for the exclusive use of the

>> addressee(s) and may contain confidential or privileged information. 
>> If you are not the intended recipient, please notify the sender at 
>> Wipro or Mailadmin@xxxxxxxxx immediately and destroy all copies of 
>> this message and any attachments.
>> 
>> 
>> 
>> 
>>  
>> 
> 

 
Nathan Carter
Mathematical Sciences Department
Bentley College
175 Forest St., Morison 319
Waltham, MA  02452
(781) 891-3171