PDA

View Full Version : How to change background and font color of QTreeView using HTML code



mcraellehs
7th April 2020, 21:48
Hi, i wanna know it it's possible to change background and font color of QTreeView using html code,
I know its possible using css like this


{background-color: yellow;}");

but, can it be done with html code something like this


<QTreeView style="background-color:grey;">

d_stranz
7th April 2020, 22:51
can it be done with html code something like this

No. Style sheets use css, not html. Maybe you are confusing this with the Rich Text HTML subset (https://doc.qt.io/qt-5/richtext.html) which is used to customize the text strings in QLineEdit, QTextEdit and other text-based widgets.

You could always define your own XML-based language for defining styles, but your software would have to parse that and translate it into Qt's variant of css before you could apply it as a widget style.