I've tried to install the event filter:
// i install it in the MainWindow's constructor
playerWnd->installEventFilter(this); // this = MainWindow that contains playerWnd (QFrame)
// the event filter function:
{
if (watched
== playbar
&& event
->type
() == QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent
= static_cast<QMouseEvent
*>
(event
);
if (mouseEvent->button() == Qt::LeftButton)
QMessageBox::warning(this,
"title",
"this is VLC popup menu, don't you believe?");
}
}
// i install it in the MainWindow's constructor
playerWnd->installEventFilter(this); // this = MainWindow that contains playerWnd (QFrame)
// the event filter function:
bool MainWindow::eventFilter(QObject *watched, QEvent *event)
{
if (watched == playbar && event->type() == QEvent::MouseButtonPress)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
if (mouseEvent->button() == Qt::LeftButton)
QMessageBox::warning(this, "title", "this is VLC popup menu, don't you believe?");
}
return QMainWindow::eventFilter(watched, event);
}
To copy to clipboard, switch view to plain text mode
Bookmarks