1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 06:45:45 +02:00

combobox: allow an invalid current model index

This will definitely be the case when filtering out the currently
selected item. I don't understand how this worked before SFPM.

GitLab: #890
Change-Id: Ib3e6945d2384707e128a52ab06457c157b2c7d0b
This commit is contained in:
Andreas Traczyk 2022-11-09 16:50:08 -05:00 committed by Sébastien Blin
parent ad3e02f5ef
commit 8b93dfe44e

View file

@ -37,10 +37,15 @@ ComboBox {
delay: Qt.styleHints.mousePressAndHoldInterval delay: Qt.styleHints.mousePressAndHoldInterval
} }
displayText: currentIndex !== -1 ? displayText: {
currentSelectionText : (placeholderText !== "" ? // If the index is -1 and the model is empty, display the placeholder text.
placeholderText : // The placeholder text is either the placeholderText property or a default text.
JamiStrings.notAvailable) // Otherwise, display the currentSelectionText property.
if (currentIndex < 0 && !count) {
return placeholderText !== "" ? placeholderText : JamiStrings.notAvailable
}
return currentSelectionText
}
delegate: ItemDelegate { delegate: ItemDelegate {
width: root.width width: root.width