Mouse Press-Release Event

After the install events with this function:

 installEventFilter(this);

we can get the mouse press event like this example:

bool ExampleApplication::eventFilter(QObject *object, QEvent *ev)
{
      if (ev->type() == QEvent::MouseButtonPress)
      {
         lbl->setText("pressed");
      }
      else if (ev->type() == QEvent::MouseButtonRelease)
      {
          lbl->setText("released");
      }

       return false;
}

And it works!

Leave a Reply

Your email address will not be published. Required fields are marked *