QComboBox style for choosen item in drop-down list
Ok after lot of struggle I made some workaround.. its not best, its not proper, but it looks ok..
I added the bold effect in this way (it affect other widgets like checkable menu items, but I can live with that):
QWidget:item:selected
{
border: 0px solid #999900;
background: transparent;
}
QWidget:item:checked
{
font-weight: bold;
}
Then when I am adding items I am prepending spaces into their text in order to shift it to the right.. I was trying so many things, but nothing affected the QAbstractItemView inside.
This is the result:
I had success with less specific stylesheet selectors and "padding-left":
QComboBox:item {
padding-left: 20px; /* move text right to make room for tick mark */
}
QComboBox:item:selected {
padding-left: 20px; /* move text right to make room for tick mark */
border: 2px solid black;
}
QComboBox:item:checked {
padding-left: 20px; /* move text right to make room for tick mark */
font-weight: bold;
}
(probably some unnecessary duplication in that, too!)
I know it's really late, but for people having the same problem: I found this at another question here: Not able to hide Choice-Indicator of the QComboBox
This should hide the indicator/tick:
QComboBox::indicator{
background-color:transparent;
selection-background-color:transparent;
color:transparent;
selection-color:transparent;
}