Hello friends,

I have a subclassed qtextedit in a QMAinwindow. So my target is to achieve that the key events from textedit
are handled in Mainwindow event system. so when I make this:
Qt Code:
  1. //**************************************************************************
  2. class keyPressCatcher:public QObject
  3. //**************************************************************************
  4. {
  5. public:
  6. keyPressCatcher():QObject()
  7. {};
  8. ~keyPressCatcher()
  9. {};
  10.  
  11. bool eventFilter(QObject* object,QEvent* event)
  12. {
  13. if (event->type() == QEvent::KeyPress)
  14. {
  15. QKeyEvent *keyEvent = dynamic_cast<QKeyEvent *>(event);
  16.  
  17. std::cout << "You Pressed " << keyEvent->text().toStdString() << "\n";
  18. return true;
  19. }
  20. else
  21. {
  22. // standard event processing
  23. return QObject::eventFilter(object, event);
  24. }
  25.  
  26.  
  27.  
  28. };
  29.  
  30.  
  31. };
To copy to clipboard, switch view to plain text mode 

and install the eventfilter

Qt Code:
  1. this->installEventFilter(new keyPressCatcher());
  2.  
  3. and textedit->installEventFilter(this);
To copy to clipboard, switch view to plain text mode 

nothing appears.

So my question is what the the basic step to achieve this functionality?

Thanx in advance