pyqt5的QCompleter自动补全 使用模板
相关说明 使用QCompleter类,就可以实现自动补全功能,效果图如下: 对应的代码很简单 def init_lineedit(self): # 增加自动补全 self.completer = QCompleter(items_list) # 设置匹配模式 有三种: Qt.MatchStartsWith 开头匹配(默认) Qt.MatchContains 内容匹配 Qt.MatchEndsWith 结尾匹配 self.completer.setFilterMode(Qt.MatchContains) # 设置补全模式 有三种: QCompleter.PopupCompletion(默认) QCompleter.InlineCompletion QCompleter.UnfilteredPopupCompletion self.completer.setCompletionMode(QCompleter.PopupCompletion) # 给lineedit设置补全器 self.lineedit.setCompleter(self.completer) def init_combob...