Fix that the placeholdertext of QCombobox is not drawn
If the current index is invalid,a placeholdertext will be displayed. Fixes: QTBUG-90595 Pick-to: 6.0 5.15.2 Change-Id: Id4c6b9c959242b96ee0944b8fc3131a9a2fdcccc Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>bb10
parent
f7f618b312
commit
6da6b6da44
|
|
@ -3028,8 +3028,10 @@ void QComboBox::paintEvent(QPaintEvent *)
|
|||
initStyleOption(&opt);
|
||||
painter.drawComplexControl(QStyle::CC_ComboBox, opt);
|
||||
|
||||
if (currentIndex() < 0)
|
||||
opt.palette.setBrush(QPalette::ButtonText, opt.palette.brush(QPalette::ButtonText).color().lighter());
|
||||
if (currentIndex() < 0 && !placeholderText().isEmpty()) {
|
||||
opt.palette.setBrush(QPalette::ButtonText, opt.palette.placeholderText());
|
||||
opt.currentText = placeholderText();
|
||||
}
|
||||
|
||||
// draw the icon and text
|
||||
painter.drawControl(QStyle::CE_ComboBoxLabel, opt);
|
||||
|
|
|
|||
Loading…
Reference in New Issue