TextFieldWithCompleter {
id: _textField
anchors.top:parent.top
anchors.left:parent.left
anchors.right:parent.right
height:30
completerModel: SuggestionsModel
popupPadding: 1
onTextModified: {
console.log("modified")
}
onCompleterPrefixChanged: {
completerModel.setFilterWildcard(prefixText + '*');
}
// Delegate for the row in popup model
completerRowDelegate : MenuItem {
text: rowText
width: 300
background: Rectangle {
color : (pressed ? "green" : (bCurrentRow ? "lightblue" : "white"))
}
onTriggered: {
_textField.complete(text);
}
}
// Delegate for popup background
completerBackgroundDelegate: Rectangle {
border.width: 1
color: "white"
border.color: "black"
height: contentHeight
width: 300 + 2
}
}
QML-TextField-Completer.zip-互联网文档类资源-CSDN下载