Zalwou06
21st May 2012, 13:16
Hi all
I was wondering if there is any way to retrieve colors set by the stylesheet for different states of a listview item.
I am developing listviews and use an item delegate to paint my items.
Then I need to use brushes to paint the items according to their states and I wanted to retrieve the color set by my css file dynamically without having to use hard coded colors.
Any suggestions ?
thanks
Added after 14 minutes:
here is the css for the listview items
/* ----------------------------------------------------------------------------*/
/* QListView */
QListView
{
margin: 0px;
border: 0px;
padding: 0px;
background-color: none;
}
/* NORMAL STATE */
QListView::item
{
margin: 0px;
border: 0px;
padding: 0px;
background-color: rgb(249, 249, 246);
}
/* SELECTED STATE */
QListView::item:selected
{
background-color: rgb(235, 235, 234);
}
/* FOCUSED (or selected) STATE */
QListView::item:focus
{
background-color: rgb(235, 235, 234);
}
/* FOCUSED but hovering over STATE */
QListView::item:focus:hover
{
background-color: rgb(234, 234, 233);
}
/* SELECTED but hovering over STATE */
QListView::item:selected:hover
{
background-color: rgb(234, 234, 233);
}
/* HOVER only STATE */
QListView::item:hover
{
background-color: rgb(245, 245, 242);
}
I was wondering if there is any way to retrieve colors set by the stylesheet for different states of a listview item.
I am developing listviews and use an item delegate to paint my items.
Then I need to use brushes to paint the items according to their states and I wanted to retrieve the color set by my css file dynamically without having to use hard coded colors.
Any suggestions ?
thanks
Added after 14 minutes:
here is the css for the listview items
/* ----------------------------------------------------------------------------*/
/* QListView */
QListView
{
margin: 0px;
border: 0px;
padding: 0px;
background-color: none;
}
/* NORMAL STATE */
QListView::item
{
margin: 0px;
border: 0px;
padding: 0px;
background-color: rgb(249, 249, 246);
}
/* SELECTED STATE */
QListView::item:selected
{
background-color: rgb(235, 235, 234);
}
/* FOCUSED (or selected) STATE */
QListView::item:focus
{
background-color: rgb(235, 235, 234);
}
/* FOCUSED but hovering over STATE */
QListView::item:focus:hover
{
background-color: rgb(234, 234, 233);
}
/* SELECTED but hovering over STATE */
QListView::item:selected:hover
{
background-color: rgb(234, 234, 233);
}
/* HOVER only STATE */
QListView::item:hover
{
background-color: rgb(245, 245, 242);
}