PYQT5(3-3)QCompleter实现自动联想
作者:
弗兰克万岁 | 来源:发表于
2019-12-27 21:16 被阅读0次 def init_lineedit(self,items_list):
# 增加自动补全
a=[]
for i in items_list:
print(i['code'])
a.append(i['code'])
self.completer = QCompleter(a)
# 设置匹配模式 有三种: Qt.MatchStartsWith 开头匹配(默认) Qt.MatchContains 内容匹配 Qt.MatchEndsWith 结尾匹配
self.completer.setFilterMode(Qt.MatchContains)
# 设置补全模式 有三种: QCompleter.PopupCompletion(默认)QCompleter.InlineCompletion QCompleter.UnfilteredPopupCompletion
self.completer.setCompletionMode(QCompleter.PopupCompletion)
# 给lineedit设置补全器
self.pid_edit.setCompleter(self.completer)
本文标题:PYQT5(3-3)QCompleter实现自动联想
本文链接:https://www.haomeiwen.com/subject/apcjoctx.html
网友评论