Make it visually clear which ComboBox item is the current item

Do as the Default style does and make the current item bold. If we
don't do this, it can be impossible to distinguish the current item
from the highlighted item, especially when the popup obscures the
button.

Change-Id: If40b9c73c207d07fb5669564cdcfcea29ebed2f1
Fixes: QTBUG-68794
Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
Mitch Curtis 2018-11-13 16:11:48 +01:00
parent 021c6064ad
commit b943bbf911
3 changed files with 3 additions and 0 deletions

View File

@ -57,6 +57,7 @@ T.ComboBox {
delegate: MenuItem {
width: parent.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled
}

View File

@ -61,6 +61,7 @@ T.ComboBox {
delegate: ItemDelegate {
width: parent.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled
}

View File

@ -58,6 +58,7 @@ T.ComboBox {
delegate: ItemDelegate {
width: parent.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
highlighted: control.highlightedIndex === index
hoverEnabled: control.hoverEnabled
}