问题
I have an (existing) Widget that is composed of a QLineEdit and a QToolButton. The code I'm building upon can be found here: https://github.com/wbsoft/frescobaldi/blob/master/frescobaldi_app/widgets/urlrequester.py
I'm trying to add the editingFinished
signal to that composed widget, which works reasonably well by creating a new signal with editingFinished = pyqtSignal()
, connecting the line edit's signal to a local method and emit the custom signal from that.
However, I want to suppress that signal when the tool button is pressed. But obviously when pressing the tool button first the editingFinished
signal of the line edit is emitted and then the clicked
signal of the button.
Question: Is there any way to suppress the signal when it has been triggered by a specific cause (the button click). Or is there an information that tells me what the next element is that is going to get the focus? I'm thinking of checking which widget is about to get the focus, and if it's the tool button suppress the emission of the signal.
来源:https://stackoverflow.com/questions/44108178/suppress-qlineedit-editingfinished-signal-when-certain-button-is-clicked