Answer the question
In order to leave comments, you need to log in
How to show full text if it is larger than Combobox size?
Such a problem is that if the length of the text exceeds the size of the Combobox, then it is displayed as "Example of ... text", is there any way to remove this ellipsis and make the text appear in full?
Answer the question
In order to leave comments, you need to log in
You can calculate the width, for example:
ui.qml:
property int minimumWidth: minimumWidth
ComboBox {
id: comboBox
width: minimumWidth
model: ["Пример очень длинного текста", "Текст 2"]
}
Component.onCompleted: minimumWidth = resizeComboBox(comboBox)
function resizeComboBox(id) {
var w = 0;
if(id.count === 0)
return id.width;
var original_index = id.currentIndex;
if(original_index < 0)
return id.width;
do {
w = Math.max(w, id.contentItem.contentWidth);
id.currentIndex = (id.currentIndex + 1) % id.count;
} while(id.currentIndex !== original_index)
return w + id.contentItem.leftPadding + id.contentItem.rightPadding + id.indicator.width;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question