Qt mousePressEvent left button
<p>I am using Qt but have run into a problem.</p>

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

<p>MyWidget.h</p>

<pre><code>protected:
    void mousePressEvent(QMouseEvent * event);
    void mouseReleaseEvent(QMouseEvent * event);
</code></pre>

<p>MyWidget.cpp</p>

<pre><code>void MyWidget::mousePressEvent(QMouseEvent *event)
{
    qDebug() &lt;&lt; "Pressed";
}

void MyWidget::mouseReleaseEvent(QMouseEvent *event)
{
    qDebug() &lt;&lt; "Released";
}
</code></pre>

<p>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.</p>

<p>What could be wrong? How can I register when the left button is pressed?</p>