Alex Rivera | Logout

Get a notification/event/signal when a Qt widget gets focus

Asked 2008-11-26T18:16:52.757
35

In Qt, when a widget receives focus, how can get a notification about it, so I can execute some custom code? Is there a signal or an event for that?

Edit
Report

2 Answers

7

The simplest way is to connect a slot to the QApplication::focusChanged signal.

answered 2008-12-02T14:43:54.120
0

QWidget::setFocus() is slot, not signal. You can check if QLineEdit is in focus with focus property. QLineEdit emits signals when text is changed or edited, see documentation.

answered 2008-11-27T01:19:10.923

Your Answer