CRightClickEnabler: Prevent duplicate events for right click and tap and hold on Linux

pull/2017/head
Jon Beniston 2024-03-12 14:03:51 +00:00
rodzic eb68c058b3
commit 6336767097
1 zmienionych plików z 7 dodań i 9 usunięć

Wyświetl plik

@ -38,21 +38,18 @@ bool CRightClickEnabler::eventFilter(QObject *obj, QEvent *event)
{
auto mouseEvent = (QMouseEvent*) event;
if (mouseEvent->source() == Qt::MouseEventNotSynthesized) {
m_mousePressed = true;
} else {
m_mousePressed = false; // Mouse event generated from touch event
}
if (mouseEvent->button() == Qt::RightButton)
{
emit rightClick(mouseEvent->globalPos());
mouseEvent->setAccepted(true);
return true;
}
if (mouseEvent->button() == Qt::LeftButton)
{
if (mouseEvent->source() == Qt::MouseEventNotSynthesized) {
m_mousePressed = true;
} else {
m_mousePressed = false; // Mouse event generated from touch event
}
}
}
else if (event->type() == QEvent::MouseButtonRelease)
{
@ -61,6 +58,7 @@ bool CRightClickEnabler::eventFilter(QObject *obj, QEvent *event)
if (mouseEvent->button() == Qt::RightButton)
{
mouseEvent->setAccepted(true);
m_mousePressed = false;
return true;
}