kopia lustrzana https://github.com/f4exb/sdrangel
CRightClickEnabler: Prevent duplicate events for right click and tap and hold on Linux
rodzic
eb68c058b3
commit
6336767097
|
@ -38,21 +38,18 @@ bool CRightClickEnabler::eventFilter(QObject *obj, QEvent *event)
|
||||||
{
|
{
|
||||||
auto mouseEvent = (QMouseEvent*) 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)
|
if (mouseEvent->button() == Qt::RightButton)
|
||||||
{
|
{
|
||||||
emit rightClick(mouseEvent->globalPos());
|
emit rightClick(mouseEvent->globalPos());
|
||||||
mouseEvent->setAccepted(true);
|
mouseEvent->setAccepted(true);
|
||||||
return 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)
|
else if (event->type() == QEvent::MouseButtonRelease)
|
||||||
{
|
{
|
||||||
|
@ -61,6 +58,7 @@ bool CRightClickEnabler::eventFilter(QObject *obj, QEvent *event)
|
||||||
if (mouseEvent->button() == Qt::RightButton)
|
if (mouseEvent->button() == Qt::RightButton)
|
||||||
{
|
{
|
||||||
mouseEvent->setAccepted(true);
|
mouseEvent->setAccepted(true);
|
||||||
|
m_mousePressed = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue