使用的的类是QtGui.QCompleter
from PyQt4 import QtGui,QtCore str = QtCore.QStringList(['a','air','airbus'])#预先设置字典 lineEdit = QtGui.QLineEdit() lineEdit.setCompleter(QtGui.QCompleter(str)) #将字典加入到lineEdit中这样仅仅须要在lineEdit中输入‘a’,就会有下拉提示框出现了