Luis Zaldivar wrote:
> How do I detect when a QLineEdit gets focus?
> Seems like there is not focus signal for QLineEdit. It seems like it can 
> be emulated with eventfilter() and hasfocus() but is there an easier way?
> Sorry if it is a dumb question :)
>   
Hi, Luis.

QApplication has a signal called "focusChanged" which is emitted when 
the focus changes. It emits two arguments, the first being the widget 
losing focus and the second the one gaining focus. Either or both of 
these may be null. In order to connect to this signal, do something like 
the following:

    QApplication.instance().focusChanged.connect(myReceiver, 
"mySlot(QWidget, QWidget)");

You can also get this information from inside the widget, if you 
subclass it and override the focusInEvent() and focusOutEvent() methods.

-- Eskil


_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to