[Qt-interest] QLayoutItem Color

Frank Lutz frank422542 at googlemail.com
Fri Sep 24 20:51:48 CEST 2010


On the main widget of the application you can
set stylesheets where you can declare colors for
qt classes.

QString stylesheet = "
QGridLayout{
background-color: red;
color: blue; }

QWidget{
background-color: white;
color: orange;
font-family: Monospace;
font-size: 16px;
font-weight: bold;
font-style: italic; };


Than you can out it to the mainwidget

mainwidget->setStyleSheet( stylesheet );

and the colors should be changed.
It do isn't tested, but that will the
way that it's work.

Do also take a look into:
http://doc.trolltech.com/4.3/stylesheet.html



More information about the Qt-interest-old mailing list