[RESOLVED] StyleSheet file... it's possible?
-
@
QFile fileDark(":/qss/vc2.qss");
fileDark.open(QFile::ReadOnly);
app.setStyleSheet(fileDark.readAll());
@qss is a css file, it is embedded as qresource
-
[quote author="Andre" date="1347370510"][quote author="broadpeak" date="1347370429"]@
...[/quote]
You're spoiling all the "this is left as an excersise for the reader" fun! ;-)[/quote]
Ahhhhhhhhhh! Sorry :) I will never.... :)
-
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.