Hello squidge!!!

1 year and a half later somebody can still fall in this difficulty... it annoyed me during the last 2 days... it was not really obvious to find it out. Unfortunately google doesn't really look inside qtcentre.org

This is the solution that worked for me...

Qt Code:
  1. class MouseReleaser : public QObject
  2. {
  3. Q_OBJECT
  4. public:
  5. MouseReleaser(QObject * parent) : QObject(parent){;}
  6. protected:
  7. bool eventFilter(QObject *obj, QEvent *ev)
  8. {
  9. if (ev->type()==QEvent::MouseButtonRelease)
  10. return true;
  11. else
  12. return QObject::eventFilter(obj, ev);
  13. }
  14. };
  15.  
  16. ...
  17.  
  18. MyTableView::MyTableView(QWidget *parent)
  19. :QTableView(parent)
  20. {
  21. MouseReleaser *mr = new MouseReleaser(this);
  22. horizontalHeader()->viewport()->installEventFilter(mr);
  23. verticalHeader()->viewport()->installEventFilter(mr);
  24. }
To copy to clipboard, switch view to plain text mode 


Thank you for the great job!