PDA

View Full Version : CSS Problem



WinchellChung
21st June 2007, 19:42
I'm using Qt 4.2.3 with MS Visual Studio 2005.

I have a nice style sheet I apply to my pushbuttons. Alas, while the sheet works just fine when I run my app within VS2005 IDE, it does not work at all in the stand-alone app.

In my QMainWindow's creator function I have the following:


setStyleSheet(
"QMainWindow {"
"background-color: #0C344B;"
"}"
"QFrame#navToolBox {"
"color: black;"
"font-size: 14pt;"
"font-style: bold;"
"background-color: #CCD4FF;"
"selection-color: white;"
"selection-background-color: #0C344B;"
"}"
"QSplitter {"
"background-color: #CCD4FF;"
"background-image: url(:/Mockup01/Resources/splitterControl.png);"
"background-repeat: no-repeat;"
"background-position: center;"
"}"
"QPushButton {"
"color: white;"
"background-color: #0C344B;"
"background-image: url(:/Mockup01/Resources/buttonGradient.png);"
"background-repeat: repeat-x;"
"border-style: outset;"
"border-width: 1px;"
"border-radius: 5px;"
"border-color: white;"
"padding-top: 6px;"
"padding-bottom: 6px;"
"padding-right: 30px;"
"padding-left: 30px;"
"font-size: 11pt;"
"}"
"QPushButton:checked {"
"border-width: 2px;"
"border-color: cyan;"
"}"
"QFrame#buttonFrame {"
"background-color: #0C344B;"
"}"
"QSlider {"
"color: white;"
"}"
);

In the IDE, the buttons have a nice white border with rounded corners, and a gradient filled background. In the stand-alone they look pretty much like standard Windows buttons. I cannot figure out why they work in the IDE but not stand alone.

I'm pretty sure I must be making a fairly fundamental newbie mistake, but I cannot seem to find it. Any ideas?

wysota
23rd June 2007, 16:43
Maybe the resource file is not created correctly? Try compiling with console support turned on and see if you get any warnings in the console.