PDA

View Full Version : background color of QLineEdit



Seema Rao
2nd June 2006, 08:28
Hi all,

Can some body explain how to set the back ground color of QLineEdit? By default it appears white, how to change it to gray?

Thanks in advance,
Seema Rao

jpn
2nd June 2006, 08:34
Please try to search the forums before asking:
http://www.qtcentre.org/forum/showthread.php?t=2196#3

zlatko
2nd June 2006, 08:34
Play with setPalette and setBackgroundRole or search in forum, there were many threads alike this

Kananga
7th December 2006, 22:43
If you are using Qt 4.2 you can take advantage of the Qt Style Sheets:


ui.edtBox->setStyleSheet( QString( "background-color: gray"));


... and at least one of your concerns have been gone in a second ... :D

GreyGeek
11th December 2006, 20:40
Play with setPalette and setBackgroundRole or search in forum, there were many threads alike this

Just a heads up: I used the 4.1.3 and previous designers to set the pallete for about 40 lineedits. My problem was that when they were disabled the users were complaining that the content was hard to read. So, I set the "disabled" palette to show BLACK text, not grey. When I upgraded to 4.2.1 and then 4.2.2 I could no longer compile my app because I was generating errors:


"e:\hap2006\ui_homestead.h(6380):
fatal error C1509: compiler limit : too many exception handler states
in function 'Ui_homesteadUi::setupUi'. simplify function"


which support said was due to:


It is because in your ui file you change a lot of palettes and fonts and
the generated code creates a brush for each of the roles in the
palette. Since you change a lot of them it hits a limit with the
MSVC compiler which is why it does not build.


It seems that Trolltech was creating an entire palette set for each control, and when it got up to around 1600 sets MSVC++ 2003 couldn't handle it any more.

This has been posted with Qt and the support staff told me it would be in the next release: