DeliveryFeeCalc/src/kiprisEvent.py

17 lines
494 B
Python

from PyQt5.QtWidgets import QLineEdit
from PyQt5.QtCore import Qt
class LineEditWithHistory(QLineEdit):
def __init__(self, completer, parent=None):
super().__init__(parent)
self.completer = completer
def keyPressEvent(self, event):
if event.key() == Qt.Key_Down:
if self.completer.popup().isVisible():
event.ignore()
else:
self.completer.complete()
else:
super().keyPressEvent(event)