Hello everyone,
i'm not new to Qt, however i'm very new to applying stylesheets to widgets. That's why i'm posting in this topic. If you feel that i should be posting in the "Programming" section, tell me and i'll delete this post and create it later.
So basically, i have a QTextEdit widget on a dialog, and i'm trying to apply a stylesheet on it. My stylesheet is in a resource file, and contains this:
Code:
* { margin: 0; padding: 0; color: Black; white-space: normal; font-family: Arial; font-size: 10px; font-weight: normal; } h1 { color: Red; font-size: 11px; } h2 { color: Red; font-size: 10px; } h3 { color: Red; font-size: 10px; }
Then on my dialog constructor, i do:
Code:
// Set up stylesheet on slip summary widget. _ui.txtSlipSummary->setStyleSheet(fStyle.readAll()); fStyle.close();
My main problem is that no titles are being shown in red. If i put the "color: red" on the first "*" selector, everything turns red, but no luck with the individual selectors... What can be the problem?
Related to styling widgets, i have a question. Lets say a QTextEdit base contents is set to:
Then would it be possible to set a stylesheet which would be in a QRC file like this within the <head /> tag:Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html> <head> <meta name="qrichtext" content="1" /> </head> <body> <h1>Test</h1> <h2>Foo</h2> <p>Bar</p> </body> </html>
Code:
<LINK href=":/Resources/CSS/Main.css" rel="stylesheet" type="text/css">
Thanks a lot for your help,
Pierre.