PDA

View Full Version : variable



Atuti2009
18th November 2009, 07:58
hello,

I have designed an int variable which has a value.
The button where this variable is going to see is transparent, so when I run the application it doesn't apreciate.

I have tryed with setPalette, QPen, QColor... but as I thought it doesn't work,due to a variable doesn't have this property.

How can i solve it?

squidge
18th November 2009, 08:02
post some code

Atuti2009
18th November 2009, 08:08
FIRST::FIRST(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
aldaInt= 40;

ui.pushButton->setText(qstr.number(aldaInt,10));
}



this pushButton is transparent and I want to change the color from black to white of the variable "aldaInt".

Lykurg
18th November 2009, 08:12
since you use designer, change the palette there (ButtonText). There is also a preview that you can check your changes. Or set a style sheet with color: #FFFFFF;

Atuti2009
18th November 2009, 08:15
sorry?i don't understand you!

Lykurg
18th November 2009, 08:19
ui.pushButton->setText(QString::number(aldaInt,10));
ui.pushButton->setStyleSheet("color: #ffffff;");
now the text of your button is white. (I thought this is what you want.)

Atuti2009
18th November 2009, 08:32
yes but no!

my button must be transparent and the text white.
If I do as you told me , both of them are white.

Lykurg
18th November 2009, 08:47
If I do as you told me , both of them are white. What windowstyle do you use? You also can specify the background color using qss:
ui.pushButton->setStyleSheet("color: #fff; background-color: transparent;")

Atuti2009
18th November 2009, 09:04
oh!thanks!

I forgot declaring the background color!!!