Hi All,
I've two little trouble with my QComboBox that make me crazy.
The first one, is that i would like to right align the selected item text via CSS inside QComboBox.(like the behavior of the QSpinBox).
qcombo.png
I tried, more or less, everything inside my css but seems impossible to do.
This is my current CSS:
border: 1px solid darkgray;
border-radius: 0px;
padding-right: 20px;
min-width: 6em;
color: black;
}
selection-color: rgb(0, 150, 200);
background: white;
}
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
height: 30px;
border-width: 0px;
border-left-width: 1px;
border-left-color: darkgray;
border-left-style: solid; /* just a single line */
border-top-right-radius: 0px; /* same radius as the QComboBox */
border-bottom-right-radius: 0px;
}
image: url(:/images/icons/caret-down_262626_16.png);
}
top: 0px;
left: 0px;
background: rgb(0, 150, 200);
}
/* background-color: rgb(0, 150, 200);
border-radius: 0px;*/
selection-background-color:white ;
selection-color:rgb(0,150,200) ;
}
QComboBox {
border: 1px solid darkgray;
border-radius: 0px;
padding-right: 20px;
min-width: 6em;
color: black;
}
QComboBox:!editable, QComboBox::drop-down:editable {
selection-color: rgb(0, 150, 200);
background: white;
}
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 15px;
height: 30px;
border-width: 0px;
border-left-width: 1px;
border-left-color: darkgray;
border-left-style: solid; /* just a single line */
border-top-right-radius: 0px; /* same radius as the QComboBox */
border-bottom-right-radius: 0px;
}
QComboBox::down-arrow {
image: url(:/images/icons/caret-down_262626_16.png);
}
QComboBox::drop-down:on {
top: 0px;
left: 0px;
background: rgb(0, 150, 200);
}
QComboBox QAbstractItemView{
/* background-color: rgb(0, 150, 200);
border-radius: 0px;*/
selection-background-color:white ;
selection-color:rgb(0,150,200) ;
}
To copy to clipboard, switch view to plain text mode
The second question is regarding the items in the QComboBox list. Is possible, still through CSS, to set height of those items?
More in detail, i would like to increase the space between the items. How you can see from the picture below, the height is the same of each item.
height.png
Thanks a lot for any suggestion.
Bookmarks