vql
29th April 2008, 10:56
Hello.
I have a small problem about mouse button event. This is a simple program:
// ...
void MyWidget::mousePressEvent(QMouseEvent *e)
{
qWarning("mousePressEvent");
QWidget::mousePressEvent(e);
}
void MyWidget::mouseReleaseEvent(QMouseEvent *e)
{
qWarning("mouseReleaseEvent");
QWidget::mouseReleaseEvent(e);
}
// ...
When I press a left mouse button, and keep it. I drag to another position and press the middle the button (at this time, both left and middle mouse button are pressed because left mouse button is kept before), and after that, I release the left mouse button.
But why the system only write the message output:
mousePressEvent
It is mean that the mouseReleaseEvent isn't catched.
Please tell me how to solve this problem how to catch mouseReleaseEvent in this case. Thanks.
I have a small problem about mouse button event. This is a simple program:
// ...
void MyWidget::mousePressEvent(QMouseEvent *e)
{
qWarning("mousePressEvent");
QWidget::mousePressEvent(e);
}
void MyWidget::mouseReleaseEvent(QMouseEvent *e)
{
qWarning("mouseReleaseEvent");
QWidget::mouseReleaseEvent(e);
}
// ...
When I press a left mouse button, and keep it. I drag to another position and press the middle the button (at this time, both left and middle mouse button are pressed because left mouse button is kept before), and after that, I release the left mouse button.
But why the system only write the message output:
mousePressEvent
It is mean that the mouseReleaseEvent isn't catched.
Please tell me how to solve this problem how to catch mouseReleaseEvent in this case. Thanks.