Suppress QLineEdit editingFinished signal when certain button is clicked

眉间皱痕 提交于 2019-12-24 09:31:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!