hi
In the following code ,the mousePressEvent is not executed.does this means that the events first goes to child widgets and then to parents.

Qt Code:
  1. #include <QtGui>
  2. class Widget : public QMainWindow
  3. {
  4. public:
  5. Widget()
  6. {
  7. QDirModel *model = new QDirModel;
  8. QListView *list =new QListView(this);
  9. list->setModel(model);
  10. this->setCentralWidget(list);
  11. }
  12.  
  13. protected:
  14. void mousePressEvent(QMouseEvent *event)
  15. {
  16. qDebug()<<"press";
  17. }
  18. };
  19. [CENTER][/CENTER]
  20. int main(int argc, char *argv[])
  21. {
  22. QApplication a(argc, argv);
  23. Widget w;
  24. w.show();
  25. return a.exec();
  26. }
To copy to clipboard, switch view to plain text mode