In Pyside how to is there a signal when focus is changed from QLineEdit to another element
-
I have a QLineEdit element on tabbing or clicking on some other element the focus is changed to next element. Is there a signal for QLineEdit so that when focus is moved away from the element a signal is sent?
currently there is only for returnPressed
self.MyQLineEdit.returnPressed.connect(
self.checkExistingWeight)I am looking for something like this.
self.MyQLineEdit.focusChanged.connect(
self.checkExistingWeight) -
I have a QLineEdit element on tabbing or clicking on some other element the focus is changed to next element. Is there a signal for QLineEdit so that when focus is moved away from the element a signal is sent?
currently there is only for returnPressed
self.MyQLineEdit.returnPressed.connect(
self.checkExistingWeight)I am looking for something like this.
self.MyQLineEdit.focusChanged.connect(
self.checkExistingWeight)@kumar80 Use the focusChanged signal from QApplication: https://doc.qt.io/qt-5/qapplication.html#focusChanged
QApplication.instance().focusChanged.connect(self.handle_focus_changed) def handle_focus_changed(self, old_widget, now_widget): if self.MyQLineEdit is old_widget: print("MyQLineEdit lost focus")