mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 23:55:13 -05:00
CRightClickEnabler: Prevent duplicate events for right click and tap and hold on Linux
This commit is contained in:
parent
eb68c058b3
commit
6336767097
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user