Hi all,
I dont use any QWidget in my project (use QTimer and QSocket)
How to handel keyboard.
i use Qt 2.3.0

Qt Code:
  1. class clMyObject : public QObject
  2. {
  3. public:
  4. clMyObject(QObject *parent=0, const char *name) : QObject(parent, name) {};
  5. //
  6. bool event(QEvent * e)
  7. {
  8. if (e->type == QEvent::KeyPress)
  9. {
  10. qDebug("Key press");
  11. }
  12. else
  13. {
  14. qDebug("no Key press event %d", e->type());
  15. }
  16. //
  17. return QObject::event();
  18. };
  19. };
  20.  
  21. int main(int argc, char **argv)
  22. {
  23. QAplication a(argc, argv, false);
  24. //
  25. clMyObject MyObject(a);
  26. //
  27. return a.exec();
  28. }
To copy to clipboard, switch view to plain text mode