[RESOLVED] StyleSheet file... it's possible?
-
Hi guys, I'm again...
Well, I'm trying to decorate my application with CSS.
I want to set a style for all buttons, for every element of my application, but I was thinking to use a file "mystyle.css" for example to put all CSS codes inside read this file and set this styles on my application... This is possible?I'm reading the docs and at least I don't found nothing about this... I will keep reading...
Thanks all...
-
By the way: note that your (broadpeak) method has a potential danger. You implicitly cast a QByteArray to a QString: QFile::readAll() returns a QByteArray, while setStyleSheet takes a QString. That means that you assume that the .css file will be ASCII (see the docs for QString). That might or might not be a valid assumption... I prefer to use a [[doc:QTextStream]] to read a text file instead.
-
[quote author="Andre" date="1347371510"]...that you assume that the .css file will be ASCII ... That might or might not be a valid assumption... I prefer to use a [[doc:QTextStream]] to read a text file instead.
[/quote]Yes, of course, you are right (as usual :))!
But I always use simple ASCII editor for css editing, because I never have special character in my qss file.