NComboBox: better safe guards
This commit is contained in:
parent
a01d730f3d
commit
07b29ee873
1 changed files with 4 additions and 2 deletions
|
|
@ -69,7 +69,8 @@ ColumnLayout {
|
||||||
font.pointSize: Style.fontSizeMedium * scaling
|
font.pointSize: Style.fontSizeMedium * scaling
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: (combo.currentIndex < root.optionsLabels.length) ? root.optionsLabels[combo.currentIndex] : "";
|
text: (combo.currentIndex >= 0
|
||||||
|
&& combo.currentIndex < root.optionsLabels.length) ? root.optionsLabels[combo.currentIndex] : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drop down indicator
|
// Drop down indicator
|
||||||
|
|
@ -108,7 +109,8 @@ ColumnLayout {
|
||||||
highlighted: combo.highlightedIndex === index
|
highlighted: combo.highlightedIndex === index
|
||||||
|
|
||||||
contentItem: NText {
|
contentItem: NText {
|
||||||
text: (combo.model.indexOf(modelData)< root.optionsLabels.length) ? root.optionsLabels[combo.model.indexOf(modelData)] : ""
|
text: (combo.model.indexOf(modelData) >= 0 && combo.model.indexOf(
|
||||||
|
modelData) < root.optionsLabels.length) ? 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