I'm trying to get the hover highlight color I set on a QListView
applied to the items' icons. Right now it only applies to the surroundings (the image has an alpha channel which is 0 where there is white background):
You can see clearly that the 3D model itself is not affected by the highlight color. When I select the item it the image gets the selection color:
And after being selected it is also affected by the highlight color (i.e. that's the result I want to produce by only hovering over the item):
The stylesheet I use is the following:
QListView::item {
color: #000000;
background-color:transparent;
}
QListView::item:hover:!pressed {
padding: -1px;
border: 1px solid #75c1ff;
border-radius: 2px;
background-color: #c6e5ff;
}
QListView::item:selected {
padding: -1px;
border: 1px solid #5eb6ff;
border-radius: 2px;
background-color: #9ed2ff;
}
This is how I'm returning the image in the data
method of the item model of the list view:
return QIcon(QPixmap::fromImage(m_renderedObjectsModels.value(objectModel.path())));
I tried to add multiple QPixmap
s there for the different states (like suggested here) but none are applied to only hovering (at least I didn't find a state that I could add a pixmap for that would make it work).