如何限制PyQt QCompleter中显示的行数。例如,如果有10个匹配项,我将如何限制。这是我的代码:
from PyQt5.QtWidgets import *
from PyQt5 import QtCore
import sys
class Window(QWidget):
def __init__(self):
QWidget.__init__(self)
layout = QGridLayout()
self.setLayout(layout)
names = ["Apple", "Alps", "August", "Alpha", "Ate", "A""Berry", "Cherry" ]
completer = QCompleter(names)
self.lineedit = QLineEdit()
self.lineedit.setCompleter(completer)
layout.addWidget(self.lineedit, 0, 0)
app = QApplication(sys.argv)
screen = Window()
screen.show()
sys.exit(app.exec_())
我确实试着看了看,但一点也不懂。当我试图设置模型时,我不断地出错
如果要在QCompleter中设置最大可见元素数,则必须使用^{} 属性:
相关问题 更多 >
编程相关推荐