Solved How to custom QComboBox
-
Hello!!
Anybody knows where can I consult how can I custom a QComboBox setting the stylesheet?
I want, for example, change the font size displayed. I want to know the different parts of the QComboBox, etc.Thank you very much!!
-
Hi,
The Qt Style Sheets Reference and the Qt Style Sheets Examples chapter of Qt's documentation.
-
Thank you very much but, for example, I have created a QComboBox with a 12pt font size. When I push the QComboBox, the different entries have 8pt font sizes. How can I change it?
-
Hi,
The customization of the llist is the second part of the example (even if it is really short). In fact you have to customize QComboBox QAbstractItemView that corresponds to the list. You might have to add the ::item to customize the items of the list. -
@ivanicy
Hi,try by following code and change the properties with your appropriate inputs.
QComboBox {
border: 1px solid #333333;
border-radius: 3px;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #797979, stop:0.48 #696969, stop:0.52 #5e5e5e, stop:1 #4f4f4f);
padding: 1px 23px 1px 3px;
min-width: 6em;
color: #ffffff;
}
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 20px;border-top-right-radius: 3px; border-bottom-right-radius: 3px;
}
QComboBox::down-arrow {
image: url(:/images/combobox-arrow.png);
}QComboBox QAbstractView{
background-color: #4f4f4f;
color: #999999;selection-background-color: #999999; selection-color: #4f4f4f;
}
-
@Venkatesh-V
Hi
Its not really changing the items fonts but good start
-
@mrjj
Hi,there i have not assign any value to font item so...