В моем приложении pyqt
я посылаю другой сигнал после нажатия отдельных клавиш, например:
def keyPressEvent(self, event):
"""
keyboard events that enable actions
. starts single correction mode
m stats multiple correction mode
\ starts zeroing
ESC stops any action
s starts suggestion mode
n starts neutralisation mode
:param event: keyboard event
:return:
"""
if event.key() == Qt.Key_Period:
logger.log(5, "{} has been pressed".format(event.text()))
self.single_correction.emit() # single correction mode
if event.key() == Qt.Key_M:
logger.log(5, "{} has been pressed".format(event.text()))
self.multiple_correction.emit() # multiple correction mode
if event.key() == Qt.Key_S: # m key
logger.log(5, " {} has been pressed".format(event.text()))
self.suggested_correction.emit() # suggestion mode
if event.key() == Qt.Key_N:
logger.log(5, " {} has been pressed".format(event.text()))
self.neutralisation_mode.emit() # neutralisation mode
if event.key() == Qt.Key_Backslash:
logger.log(5, " {} has been pressed".format(event.text()))
self.zeroing.emit() # zeroing
if event.key() == Qt.Key_Return:
logger.log(5, " {} has been pressed".format(event.text()))
self.unzeroing.emit() # unzeroring
if event.key() == Qt.Key_Escape: # esc key
logger.log(5, " {} has been pressed".format(event.text()))
self.stop.emit() #stop
, тогда у меня есть другая функция, которая связывает каждый сигнал с действием
def create_connections(self):
"""
function that handles connections
when a signal is emitted it connects to the appropriate action
:return:
"""
self.lineEdit_mancorr.signal_evoke_kb.connect(self.show_kb)
self.single_correction.connect(self.singlecorrection)
self.multiple_correction.connect(self.multiplecorrection)
self.zeroing.connect(self.zeroingcorrection)
self.unzeroing.connect(self.unzeroingcorrection)
self.stop.connect(self.stopcorrection)
self.neutralisation_mode.connect(self.neutralisatecorrections)
self.suggested_correction.connect(self.suggestcorrection)
Я хотел бы понять, есть ли способ проверить с помощью оператора if, был ли сигнал испущен или нет.