Customization QTreeView with CSS

Find and share HowTos to various installations / configurations!
8 posts • Page 1 of 1
alexxs
Posts:2
Joined: Fri Aug 25, 2017 10:20 am

Customization QTreeView with CSS

Post by alexxs »

Hello,
I'm using css code in stylesheet.css file:

Code: Select all

QTreeView {
    show-decoration-selected: 1;
}
QTreeView::item {
     border: 1px solid #000;
}
QTreeView::item:hover {
    background: red;
    border: 1px solid #bfcde4;
}
QTreeView::item:selected {
    border: 1px solid #567dbc;
}
QTreeView::item:selected:active{
    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);
}
QTreeView::item:selected:!active {
    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf);
}
--------------------------

Image

CSS not work in .pnl, why?

Thank. https://www.winccoa.com/fileadmin/image ... es/css.png
Attachments
css.png

schneebergera
Posts:89
Joined: Sun Apr 03, 2016 5:52 pm

Re: Customization QTreeView with CSS

Post by schneebergera »

Hello,
at the moment not all CSS properties can be set onto the TreeWidget (QTreeView).
This is a known issue on development side.
The changes properties of the CSS will affect the tree view of the gedi but not the treeview in the testpanel.
But some attributes could be changed as well, like

QTreeView
{
font: 18px "Comic Sans MS";
color: red;
}


regards,
Andreas Schneeberger

schneebergera
Posts:89
Joined: Sun Apr 03, 2016 5:52 pm

Re: Customization QTreeView with CSS

Post by schneebergera »

Dear Alexey Xaxulin,

I want to inform you that there was a correction according this issue.
Now, a Tree [QTreeView] could be styled with the mentioned code above.
Within next summary patch 3.15 (actual version) it works in proper form.

regards,
Andreas

alexxs
Posts:2
Joined: Fri Aug 25, 2017 10:20 am

Re: Customization QTreeView with CSS

Post by alexxs »

Hi Andreas. Great job, done quickly, I'm impressed.It is very important to me. I use a version 3.14, are you planning to include the fix in the following patch to version 3.14 ?

Best regards,
Alexey

joost.lijster@siemens.com
Posts:19
Joined: Wed Sep 21, 2016 1:51 pm

Re: Customization QTreeView with CSS

Post by joost.lijster@siemens.com »

Hi Andreas, Alexey,

I have a question that has to do with the same subject, so if you do not mind, I would like to hijack this thread for a minute ;)

A few months ago, I had a similar issue regarding the table (Click here). Hence, my question: does the fix also cover other widgets, such as the Table?

Kind regards,

Joost

schneebergera
Posts:89
Joined: Sun Apr 03, 2016 5:52 pm

Re: Customization QTreeView with CSS

Post by schneebergera »

Hello,

@ Alexey,
a task for development was already created. It is not clear right now that a fix for 3.14 will be delivered, too.

@ Joost,
this is belonging to the other thread. Here we are talking about QTreeView.
But also onto tables some corrections (hover, margin, padding) were applied.
The following code (example) is working fine with upcoming patch (see attachment).

QTableView[type = "test"]
{
background: rgb(237,239,241);
border: 1px solid rgb(80,90,100);
color:rgb(80,90,100);
}
QTableView[type = "test"]:!enabled
{
border: 1px solid rgba(80,90,100,80);
}
QTableView[type = "test"]::item:hover {
background-color: red;
}
QTableView[type = "test"]
{
selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,
stop: 0 #FF92BB, stop: 1 white);
}



best regards,
Andreas Image
Attachments
QTableView.png

schneebergera
Posts:89
Joined: Sun Apr 03, 2016 5:52 pm

Re: Customization QTreeView with CSS

Post by schneebergera »

Dear Alexey,

we want to inform you that there was a correction according the tree-widget (QTreeView), also in version 3.14.
Your above-mentioned example code is working fine within next patch WinCC_OA 3.14 P014.
best regards,
Andreas

24mjorky24
Posts:1
Joined: Fri Oct 14, 2016 3:03 pm

Re: Customization QTreeView with CSS

Post by 24mjorky24 »

Hi,

I tried your code with WINCC OA 3.14 patch P014. Background color and border for whole table worked fine, but "hover" and "selection-background-color" still not working. Is there need to somehow change Table properties (i.e. tableMode) or it should work with default settings?

For QHeaderView it is nice and simple to configure each item but is there any way to work with cell in the same way as it is possible with headers (e.g. to change height of rows, use padding, etc.)?

Thank you.
Miroslav.

8 posts • Page 1 of 1