Solved QLineEdit focus Event
-
How do I capture QlineEdit Focus
Anybody Give me Python Code to Capture Focus Event -
@ArunBm You can subclass QLineEdit and reimplement https://doc.qt.io/qt-5/qwidget.html#focusInEvent
-
cant be simple like
self.btnClose.clicked.connect ( handler)
like in case of QPushButton click Handler ? -
@ArunBm
sadly a focusIn event is only available for QML objects, not QWidgets -
Hi,
No, as @jsulm wrote and as explained in the documentation, you have to re-implement that method in a subclass. Or depending on what you want to do, an event filter might be enough.
-
-
Do you mean subclass QLineEdit ?
-
yes @SGaist
-
@ArunBm said in QLineEdit focus Event:
Is it possible to subclass and use it in Ui ?
Yes, it is.
Subclass it, add normal QLineEdit and then promote your own subclass.
https://doc.qt.io/archives/qt-4.8/designer-using-custom-widgets.html