I have encountered some problems regarding using CSS to style the TreeView Widget. Maybe someone can help or has an idea why the problems appear.
1. Problem: Applying CSS to a widget changes more properties than expected.
1.1 I place a TREE widget on a panel and in a script I add some columns and items.
1.2 I apply the following CSS to the ".styleSheet" property of the object.
Code: Select all
QTreeView
{
color: oa-color(_WindowText);
}
Result: The height of the lines gets bigger. Not sure exactly what gets changed but the items take now more space on the screen.
It seem as if some extra styling gets applied to the Tree View.
2. Problem: Styling the "::item" sub-control is only possible if the QTreeView object is also changed.
2.1 I place a TREE widget on a panel and in a script I add some columns and items.
2.2 I apply the following CSS to the ".styleSheet" property of the object.
Code: Select all
QTreeView::item:hover
{
background-color: blue;
}
2.3 I apply the following CSS to the ".styleSheet" property of the object.
Code: Select all
QTreeView
{
color: oa-color(_WindowText);
}
QTreeView::item:hover
{
background-color: blue;
}
(Changing the color is only an example. Any valid CSS for the QTreeView will trigger the effect.)
Remarks:
- Version: WinCC OA 3.18 P012 (Qt 5.15.8)
- Using "TreeWidgetQT" instead of "QTreeView" does not change anything.
- I do not have any stylesheet.css file in my project (only the one from the installation folder).
BR
Dennis