Hello!
I ve an text Label with palette backgrounColor(default set the palette of parent)
I would like have a Label with not Color Font(tital opacity)
thanks
Hello!
I ve an text Label with palette backgrounColor(default set the palette of parent)
I would like have a Label with not Color Font(tital opacity)
thanks
Hm..can you give us extended explain?
Are you mean set foreground color for label?
As i know you can set opacity only for widget not for fonts
Also tell what version of Qt you use
a life without programming is like an empty bottle
hello
yes ,sure ,i mean foregroundColor of widget.
but the pb is palettebackgrouncolor:
So,opacity is for "font "not for widget(String)
then I would like have a widget label with total opacity of Font (or backgrpoundcolor).
Thanks
Huh... I might be misunderstanding the half of what you are trying to say, but...
Qt Code:
color.setAlpha(150); // set alpha level for text color (0-255) if (label->textFormat() == Qt::RichText) else pal.setColor(label.foregroundRole(), color); // otherwise if not using rich text label->setPalette(pal);To copy to clipboard, switch view to plain text mode
J-P Nurmi
Hello!
Thanks very match for your response.
Qt3 has not the method setAlpha:this is a problem!
So,
my code is:
void SAG_Text::SAG_text_afficher()
{
QRgb rgb,rgb1;
this->setGeometry(*text_rectangle);
rgb1=text_state.Text_IDLE.Font_Color;
QColor color1=QColor(rgb1,0xffffffff);
this->setPaletteForegroundColor(color1);
//this->setPaletteForegroundColor(*text_color_contents) ;
this->setFont(*text_font);
this->setText(*text_contents);
if(opacity==TRUE)
{
rgb=text_state.Text_IDLE.Background_Color;
QColor color=QColor(rgb,0xffffffff);
this->setPaletteBackgroundColor(color);
}
else
{
QPainter *p=new QPainter();
p->setBackgroundMode( Qt::TransparentMode );
this->drawFrame(p); }
this->show();
}
But ,no result!
Last edited by Stephano; 10th May 2006 at 09:51.
i would like have a text transparentTransparence of cadre of text,not of contents)the user of my application can choose between 2 choice:
- transparent
- opaque
So , qt 4 can resolve the pb with Qcolor.setAlpha(..);
But ,i have many pb of installation of Qt4.
then ,how can i ,for exemple ,use Qpainter (paintEvent...) to define a transparence.
If there are other solutions or explications, help me ,please!
My regards!
i would like have a text transparent :
Transparence of cadre of text,not of contents)
the user of my application can choose between 2 choice:
transparent
opaque
So , qt 4 can resolve the pb with Qcolor.setAlpha(..);
But ,i have many pb of installation of Qt4.
then ,how can i ,for exemple ,use Qpainter (paintEvent...) to define a transparence.
If there are other solutions or explications, help me ,please!
My regards!
Please, do not start multiple threads on the same subject! This is fourth or fifth thread you start about the same thing. Please use a single thread which is opened for discussion!
hello!
i wouls like draw a Qlabel.
i need choose between :
tansparence or no!
the pb is qthas not setAlpha!
so, how can i use Qpainter for exemple ,to have a backgroundColor of text transparent
.It s urgency!
Thanks!!!!
Please, don't start multiple threads on the same problem or else...
Sorry Mr.jacek ,
but it s very urgent!
Can u help me?
What about jpn's answer?
There are no urgent matters --- this is a community forum. People answer questions in their free time.Originally Posted by Stephano
What exactly do you want to achieve? What is under the label?Can u help me?
One of the QQ articles suggests three solutions:
We need a different approach if we want the parent widget's background to shine through. [...] In Qt 3, there are several ways to simulate this feature:
- You can use QPainter::redirect() and then call the parent widget's paintEvent() to have the parent draw itself onto the widget's background directly.
- You can set a transparency mask (QWidget::setMask()). The parent widget is aware of the child widget's mask and will paint all areas not covered by the mask.
- If the parent doesn't paint anything underneath the child widget other than its background, you can fill the child widget's background by inheriting the parent widget's brush and applying a suitable offset by calling QWidget::setBackgroundOrigin().
Stephano (17th May 2006)
thanks!very match
i would like a tewt Label
witch contents only the string
So the cadre of label must be transparent
Because the text will be draw in the bitmap(no backgroun color)
thanks
Is that bitmap the background of your window or is it displayed by some widget (for example a QLabel)?Originally Posted by Stephano
You might try to reimplement the paintEvent() for your widget and draw that text there.
i would like draw only the String of Qlabel
So ,how i implemente
paintEvent()
please?
can u give me an exemple!
Have you tried simply using QWidget::backgroundOrigin property? If you assign both your label and its parent the same bitmap as a background, it should be possible to blend them together.
Stephano (18th May 2006)
thanks
but,
to set the color of parent dont resolve the problem.
i neded a realy transparent label in my application
Bookmarks