Вот такой код
MyWidget::MyWidget(QWidget* parent)
{
...
m_button[2]->setGeometry(QRect(QPoint(50, 450), QSize(100, 50)));
m_button[2]->installEventFilter(this);
...
}
bool MyWidget::eventFilter(QObject* watched, QEvent* event)
{
if (watched == m_button[2])
{
if (event->type() == QEvent::MouseButtonPress)
{
/*Mouse down button event */
qDebug() << tr("Monitor button event, button press event");
return true;
}
}
}
m_button[2]->installEventFilter(this);