Hi,
I have a subclassed QLineEdit added to a GraphicsScene and a focusInEvent associated to it.
However the focusInEvent is never called. I tried adding an event filter, but without success.
.h
Qt Code:
  1. class myQLineEditClass : public QLineEdit
  2. {
  3. Q_OBJECT
  4. public:
  5. myQLineEditClass();
  6. virtual ~myQLineEditClass() {};
  7.  
  8. protected:
  9. void focusInEvent(QFocusEvent *e);
  10. void focusOutEvent(QFocusEvent *e);
  11. bool eventFilter(QObject *obj, QEvent *event);
  12. };
To copy to clipboard, switch view to plain text mode 

.cpp:
Qt Code:
  1. bool myQLineEditClass::eventFilter(QObject *obj, QEvent *event)
  2. {
  3. MGlobal::displayInfo(MQtUtil::toMString(QString().sprintf("EVENT FILTER")));
  4.  
  5. if (event->type() == QEvent::FocusIn)
  6. {
  7. return true;
  8. }
  9.  
  10. return QObject::eventFilter(obj, event);
  11. }
  12. void myQLineEditClass::focusInEvent(QFocusEvent *e)
  13. {
  14. MGlobal::displayInfo(MQtUtil::toMString(QString().sprintf("FOCUS IN")));
  15. QLineEdit::focusInEvent(e);
  16. }
  17.  
  18. void myQLineEditClass::focusOutEvent(QFocusEvent *e)
  19. {
  20. MGlobal::displayInfo(MQtUtil::toMString(QString().sprintf("FOCUS OUT")));
  21. QLineEdit::focusOutEvent(e);
  22. }
  23.  
  24. /.../
  25. myQLineEditClass *qledit=new myQLineEditClass(oneNode);
  26. scene()->addWidget(qledit);
  27. qledit->installEventFilter(oneNode);
To copy to clipboard, switch view to plain text mode 

However neither EVENT FILTER, nor FOCUS IN, nor FOCUS OUT are ever called with I double-click on the QLineEdit. How come ?
Thanks.