you can use QObject::installEventFilter for catching event from lineEdit. i.e. if you need to handle QFocusEvent you should do the following:
Qt Code:
  1. SomeClass::SomeClass(QWidget *parent): QWidget(parent)
  2. {
  3. ....
  4. lineEdit->installEventFilter(this);
  5. ...
  6. }
  7.  
  8. bool SomeClass::eventFilter(QObject *o, QEvent *e)
  9. {
  10. if (o && (o == lineEdit) && (e->type() == QEvent::FocusIn)) {
  11. //do what you need
  12. }
  13. return QWiget::eventFIlter(o, e);
  14. }
To copy to clipboard, switch view to plain text mode