How to set Stylesheet for an application?
-
Hi!
I set a stylesheet to an application. I defined a general look for QPushButton and some styles for QPushbutton#name. The problem is...if i set a generic style for QPushButton, the style for QPushbutton#name is not set. The QPushbutton#name looks exactly like the general style for QPushButton. What is the error?
Here's the style:
@MainWidget {
min-width: 1024px;
min-height: 768px;
border: 1px solid rgba(0, 0, 0, 255);
background-image: url(styles/default/images/bgmain.jpg);
}BackgroundPanel {
background-image: url(styles/default/images/head_tile.bmp);
min-height: 60px;
max-height: 60px;
margin: 0px;
spacing: 0px;
}QStatusBar {
background-image: url(styles/default/images/head_tile.bmp);
min-height: 30px;
max-height: 30px;
margin-right: 0px;
margin-left: 0px;
margin-bottom: 0px;
}MainCentralWidget {
}
QPushButton {
color: white;
font: bold 10pt;
border-image: url(styles/default/images/button_normal.png) 4 4 4 4;
border-width: 4px 4px 4px 4px;
}QPushButton:hover {
border-image: url(styles/default/images/button_hover.png);
}QPushButton:pressed {
border-image: url(styles/default/images/button_active.png);
}/QPushButton:active {
color: white;
font: bold 10pt;
/background-color : red;/
border-image: url(styles/default/images/button_active.png) 4;
}/QPushButton#closeButton {
border-image: url(styles/default/images/but_close_normal.png) 0;
border-width: 0px;
max-width: 50px;
max-height: 21px;
min-width: 50px;
min-height: 21px;
margin-top: 0px;
}QPushButton#closeButton:hover {
border-image: url(styles/default/images/but_close_hover.png);
}QPushButton#maximizeButton {
border-image: url(styles/default/images/but_close_normal.png) 0;
border-width: 0px;
max-width: 50px;
max-height: 21px;
min-width: 50px;
min-height: 21px;
margin-top: 0px;
}QPushButton#maximizeButton:hover {
border-image: url(styles/default/images/but_maximize_hover.png);
}QPushButton#maximizeButton:disabled {
border-image: url(styles/default/images/but_maximize_disabled.png);
}QPushButton#minimizeButton {
border-image: url(styles/default/images/but_minimize.png);
border-width: 0px
max-width: 27px;
max-height: 21px;
}QPushButton#minimizeButton:hover {
border-image: url(styles/default/images/but_minimize_hover.png);
}QLabel#logoLabel {
background-image: url(styles/default/images/logo.png);
min-height: 60px;
max-height: 60px;
min-width: 172px;
max-width: 172px;
background-color: #FF0000;}
@In the constructor i set the objectname via setObjectName("name"). But it looks like the general QPushButton style and not with the #name in stylesheet?
Any ideas?
Thank you very much!
-
it seems the problem is this:
@
/QPushButton:active {
color: white;
font: bold 10pt;
/background-color : red;/
border-image: url(styles/default/images/button_active.png) 4;
}/
@
which will generate a parser error. So the parser will stop there and not apply the lines after.
The code highlighting here shows it clearly ;)