close notifications with mouse right click

This commit is contained in:
Martin Rotter 2023-11-03 10:37:39 +01:00
parent 919547e586
commit 81c5a06bc9

View file

@ -79,10 +79,18 @@ bool BaseToastNotification::eventFilter(QObject* watched, QEvent* event) {
setupTimedClosing(); setupTimedClosing();
} }
if (event->type() == QEvent::Type::MouseButtonPress) {
if (dynamic_cast<QMouseEvent*>(event)->button() == Qt::MouseButton::RightButton) {
close();
}
}
return QDialog::eventFilter(watched, event); return QDialog::eventFilter(watched, event);
} }
void BaseToastNotification::closeEvent(QCloseEvent* event) { void BaseToastNotification::closeEvent(QCloseEvent* event) {
Q_UNUSED(event)
stopTimedClosing(); stopTimedClosing();
emit closeRequested(this); emit closeRequested(this);
} }