Solved setStyleSheet() error help
-
Hi
me neither but if Q CSS is a true subset, any css validator will work :)
Never got around to test it though.Sounds like something to check. You are right that it can say it found error for some Object but
it lacks even the basic info on what object so i don't have high hopes.
But ill cross fingers you find something interesting :) -
@mrjj said in setStyleSheet() error help:
Hi
me neither but if Q CSS is a true subset, any css validator will work :)No, because the full CSS validator would allow through loads of things which the subset does not. And if Q CSS were a superset, it would object to stuff which was allowed. :)
-
@JNBarchan
Just tested it and its not a true subset.
it had syntaxes the validator clearly didn't like even if valid for Qt.
So it was just a pipe dream. -
@JNBarchan said in setStyleSheet() error help:
Presumably he has in mind that I write the lex/yacc rules... ;-)
well i've posted the rules along with my post?!
I've written a QSS parser myself based on common CSS lex/yacc rules found in some github repository. And it worked pretty well. It's of course also capable of showing you the exact line of the error and what it expected instead of the error.And the hardest part of lex/yacc is the writing of the rules, which you can take over. The C harness is mostly the same all the time and can be found in many examples on the web.
QSS is not compatible to CSS. It just uses most of it's syntax ;)
But actually this is just some adaption of the rules which shouldn't also be a big issue once you get used to the rules syntax.And also as a side note, the QSS parser has some issues/bugs and is by far not perfect. This results in that syntactically QSS is not parsed entirely.
-
@raven-worx
Ohh, that i completely miss. (and poster to)
Thank you. That makes far easier. The rules can be used as is, or need some fiddling ?
I had hoped QSS was a CSS subset as to cheat at bit :) -
@mrjj said in setStyleSheet() error help:
The rules can be used as is, or need some fiddling ?
they should be possible to use right away. But some parts might be missing, like the pseudo-control names and pseudo-states of the QWidget controls. And also the property selector for string-lists
~=
is not part of CSS IIRC. -
@raven-worx said in setStyleSheet() error help:
@JNBarchan said in setStyleSheet() error help:
Presumably he has in mind that I write the lex/yacc rules... ;-)
well i've posted the rules along with my post?!
I too missed that --- I assumed your hyperlinks on
lex/yacc
pointed to help for lex & yacc, now I see they are the rule files for Q CSS, got it!Now I presume that Qt is actually using that lex/yacc to do its parsing. I believe that when lex/yacc fails to parse the input and falls into error case --- which I assume is where the
qDebug()
is in source code --- it does include filename/line number/context in input where failure occurred. It would be nice if theqDebug()
message included that, it's all I need. This probably isn't the place to ask for that, just wondered if you can do magic and make it happen... :) -
@JNBarchan
those are the rule files for CSS 2.1, not directly for QSS. And Qt doesn't use lex/yacc internally AFAIK.
See my previous post. -
@raven-worx
Ah I see, again I misunderstood! Thanks. -
I'd be interested in a way to get more helpful error messages as well.