NComBox: added safe guards if not options or invalid option index
This commit is contained in:
parent
a57f2f5d68
commit
a01d730f3d
1 changed files with 2 additions and 6 deletions
|
|
@ -69,9 +69,7 @@ ColumnLayout {
|
||||||
font.pointSize: Style.fontSizeMedium * scaling
|
font.pointSize: Style.fontSizeMedium * scaling
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: {
|
text: (combo.currentIndex < root.optionsLabels.length) ? root.optionsLabels[combo.currentIndex] : "";
|
||||||
return root.optionsLabels[combo.currentIndex]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drop down indicator
|
// Drop down indicator
|
||||||
|
|
@ -110,9 +108,7 @@ ColumnLayout {
|
||||||
highlighted: combo.highlightedIndex === index
|
highlighted: combo.highlightedIndex === index
|
||||||
|
|
||||||
contentItem: NText {
|
contentItem: NText {
|
||||||
text: {
|
text: (combo.model.indexOf(modelData)< root.optionsLabels.length) ? root.optionsLabels[combo.model.indexOf(modelData)] : ""
|
||||||
return root.optionsLabels[combo.model.indexOf(modelData)]
|
|
||||||
}
|
|
||||||
font.pointSize: Style.fontSizeMedium * scaling
|
font.pointSize: Style.fontSizeMedium * scaling
|
||||||
color: highlighted ? Colors.backgroundPrimary : Colors.textPrimary
|
color: highlighted ? Colors.backgroundPrimary : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue