Python——pyqt5——智能提示(lineEdit/conmbobox)

一、文本框智能补全

completer = QtWidgets.QCompleter(data)
completer.setCompletionMode(QtWidgets.QCompleter.PopupCompletion)
lineEdit_2.setCompleter(self.c_completer(data))

 

二、下拉列表框智能补全

        #增加选项元素
        for i in range(len(items_list)):
            combobox.addItem(items_list[i])
        conmbobox.setCurrentIndex(-1)
        #增加自动补全
        complter = QCompleter(items_list)
        completer.setCompletionMode(QCompleter.PopupCompletion)
        combobox.setCompleter(completer)        

 

转载于:https://www.cnblogs.com/cxys85/p/10774722.html

你可能感兴趣的:(Python——pyqt5——智能提示(lineEdit/conmbobox))