Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.3.0 RC1
-
None
Description
If I create events filter using QObject with eventFilter defined as below:
bool mouseEventsFilter::eventFilter(QObject *obj, QEvent *e) { static bool mousePressed = false; if(e->type() == QEvent::MouseMove && mousePressed) { QMouseEvent *event = static_cast<QMouseEvent*>(e); qDebug()<<"moved:"<<event->x(); } else if(e->type() == QEvent::MouseButtonPress) { qDebug()<<"pressed"; mousePressed = true; } else if(e->type() == QEvent::MouseButtonRelease) { qDebug()<<"released"; mousePressed = false; } return QObject::eventFilter(obj, e); }
and fill main.qml file with:
import QtQuick 2.2 import QtQuick.Window 2.1 Window { visible: true width: 360 height: 360 MouseArea { anchors.fill: parent } Text { text: qsTr("Hello World") anchors.centerIn: parent } }
then after single-click on Windows OS I can see:
pressed
pressed
released
released
Of course I can use mousePressed variable to avoid this situation by taking only first event of QEvent::MouseButtonPress/QEvent::MouseButtonRelease. But with move events it won't be so easy to determine which one needs to be handled or refused. They provide different mouseX/mouseY values depended (probably) on which Item can be found under mouse currently. The problem disappears after removing MouseArea from QML
On Android device similar code can gives me even 3 different entries after only one screen touch.
With previous Qt versions it behaves "normally"
Attachments
Issue Links
- replaces
-
QTBUG-39837 [Reg 5.2 -> 5.3] Single click produces two events for mouse press and release
-
- Closed
-