Qt-interest Archive, November 2007
lcd color
Message 1 in thread
Hi,
i want change text color of LCDNnumber in red (i don't like gray), i try it:
QPalette lcdpalette;
lcdNumber->setSegmentStyle( QLCDNumber::Filled );
lcdpalette.setColor(QPalette::WindowText, QColor( 170, 0, 0 ));
lcdNumber->setPalette( lcdpalette );
lcdNumber->display(100);
but this don't functcion. Where is error? i have tried also with
setColorQPalette::ButtonText, QColor( 170, 0, 0 )); but i see gray lcd
number.
Thanks
Nicola
--
[ signature omitted ]
Message 2 in thread
Hi,
> i want change text color of LCDNnumber in red (i don't like gray), i try it:
>
> QPalette lcdpalette;
> lcdNumber->setSegmentStyle( QLCDNumber::Filled );
> lcdpalette.setColor(QPalette::WindowText, QColor( 170, 0, 0 ));
Experiment with QPalette::Light, QPalette::Dark and QPalette::Foreground,
instead of QPalette::WindowText.
--
[ signature omitted ]
Message 3 in thread
Dimitri wrote:
> Hi,
>
>> i want change text color of LCDNnumber in red (i don't like gray), i
>> try it:
>>
>> QPalette lcdpalette;
>> lcdNumber->setSegmentStyle( QLCDNumber::Filled );
>> lcdpalette.setColor(QPalette::WindowText, QColor( 170, 0, 0 ));
>
> Experiment with QPalette::Light, QPalette::Dark and
> QPalette::Foreground, instead of QPalette::WindowText.
>
> --
> Dimitri
In designer, change WindowText to the color you want.
--
[ signature omitted ]
Message 4 in thread
Hi,
> In designer, change WindowText to the color you want.
Both within Designer and when directly modifying the palette, WindowText won't
work.
The LCD Number widget relies on: Light, Dark, Foreground.
--
[ signature omitted ]
Message 5 in thread
Hi,
> Hi,
>
> > In designer, change WindowText to the color you want.
>
> Both within Designer and when directly modifying the palette, WindowText
> won't work.
>
> The LCD Number widget relies on: Light, Dark, Foreground.
>
i have a problem with LCDNumber change color, when i add lcdnumber in
MainWindow in Qt Designer (in layer and hboxLayaout). If i create LCDNumber
in MainWindow constructor i change color. But i need layout! :(
Nicola
--
[ signature omitted ]
Message 6 in thread
Hi,
> i have a problem with LCDNumber change color, when i add lcdnumber in
> MainWindow in Qt Designer (in layer and hboxLayaout). If i create LCDNumber
> in MainWindow constructor i change color. But i need layout! :(
If I understand correctly, you're able to change colors within Qt Designer,
but not outside Qt Designer. It shouldn't be too difficult to change colors
outside of Qt Designer, just modify the palette as described here:
http://doc.trolltech.com/4.3/qpalette.html#details
Use the Light, Dark, Foreground color roles.
Now if you're creating a QLCDNumber within a widget in Qt Designer, you will
indeed probably need a layout. Why is this a problem?
--
[ signature omitted ]
Message 7 in thread
Hi,
>
> > i have a problem with LCDNumber change color, when i add lcdnumber in
> > MainWindow in Qt Designer (in layer and hboxLayaout). If i create
> > LCDNumber in MainWindow constructor i change color. But i need layout! :(
>
> If I understand correctly, you're able to change colors within Qt Designer,
no, i create LCDNumber within Qt Designer, but if i want change color within
my code.
> but not outside Qt Designer. It shouldn't be too difficult to change colors
> outside of Qt Designer, just modify the palette as described here:
> http://doc.trolltech.com/4.3/qpalette.html#details
> Use the Light, Dark, Foreground color roles.
>
> Now if you're creating a QLCDNumber within a widget in Qt Designer, you
> will indeed probably need a layout. Why is this a problem?
>
If i create LCDNumber within Qt Designer and change color changing palette
within my code, the change failure; but if i do lcdNumber->setParent(this)
(within my MainWindow constructor) and after changing palette, the change is
ok, but obviously lose layout. This is the problem.
Thanks
Nicola
--
[ signature omitted ]
Message 8 in thread
Hi,
> If i create LCDNumber within Qt Designer and change color changing palette
> within my code, the change failure; but if i do lcdNumber->setParent(this)
How do you change the palette?
> (within my MainWindow constructor) and after changing palette, the change is
> ok, but obviously lose layout. This is the problem.
I don't understand why you need to call lcdNumber->setParent(this). It's hard
to tell what could be going wrong without more details or some code.
--
[ signature omitted ]