I want to register when the mouse is pressed and released on a QTableWidget. There are signals only for pressed, not released. Therefore I use mousePressEvent and mouseReleaseEvent instead.

MyWidget.h
Qt Code:
  1. protected:
  2. void mousePressEvent(QMouseEvent * event);
  3. void mouseReleaseEvent(QMouseEvent * event);
To copy to clipboard, switch view to plain text mode 

MyWidget.cpp
Qt Code:
  1. void MyWidget::mousePressEvent(QMouseEvent *event)
  2. {
  3. qDebug() << "Pressed";
  4. }
  5.  
  6. void MyWidget::mouseReleaseEvent(QMouseEvent *event)
  7. {
  8. qDebug() << "Released";
  9. }
To copy to clipboard, switch view to plain text mode 

It prints "Released" when the left, right or middle mouse button is released over the table. However, it prints "Pressed" only when the right or middle button is pressed.

What could be wrong? How can I register when the left button is pressed?