Emulate a javascript function in a qss stylesheet
-
I've been creating some stylesheets for an open source cad software called Qcad which is QT based. The stylesheets allow the user different themes for Qcad. One element of Qcad is a history window - QTextBrowser#History that displays three different colors using rich text. This is done by a javascript file that I am not able edit. I do know that the javascript I'm interested in is the first line of the following snippet....
EcmaScriptShell.col = "#000"; EcmaScriptShell.colWarning = "#cc0000"; EcmaScriptShell.colPrompt = "#0000cc";
this turns the font color black in certain parts of the history window, I want that font to be white. So what I'm asking is, is there any way at all to emulate the above snippet in a sylesheet. I've tried the obvious....
QTextBrowser#History { color: #fff; }
..and it has no effect at all, I've tried variations on the above but nothing works. I did think about running a javascript file from the stylesheet, but soon found out that wasn't possible.
I'm beginning to think that it's just not possible in a stylesheet. -
@PeteVick
Cannot be done from stylesheet. CSS/QSS and JS have no relationship. And even if you could their JS script would like overwrite your efforts anyway. But if their thing is JS, it shouldn't be being executed in aQWebBrowser
anyway....You have to go to
QWebEnginePage
if you want to play with JS. -
If I get it right, you can try CSS-like states (or pseudo-classes).
For example, consider a button with the next style:QToolButton#MyBtn { background-color: #000; } QToolButton#MyBtn:hovered { background-color: #FFF; }
It is black by default and white when hovered.