diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-07-04 16:06:17 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-07-04 20:21:22 +0000 |
commit | 7f261437d6a60d1f53624b68ed88fb32bf8c5f1c (patch) | |
tree | fe7521cfb7f7d9dcac49894528ddca24eb258d5a /src/core/web_event_factory.cpp | |
parent | dee43c0084f5c8a241a9b67661868a70167f2e72 (diff) |
Fix regression in text selection
While 'button' should officially be none on mouse move events, the
aura and windows events set 'button' on mouse move, and selection code
appears to depend on it.
Change-Id: I49f84e6f9178c3b2cb0f2c2c8a7b1d30141d0b4e
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/web_event_factory.cpp')
-rw-r--r-- | src/core/web_event_factory.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 521a8b78e..d6b2f4ba9 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -489,6 +489,19 @@ static WebMouseEvent::Button mouseButtonForEvent(QMouseEvent *event) return WebMouseEvent::ButtonRight; else if (event->button() == Qt::MidButton) return WebMouseEvent::ButtonMiddle; + + if (event->type() != QEvent::MouseMove) + return WebMouseEvent::ButtonNone; + + // This is technically wrong, mouse move should always have ButtonNone, + // but it is consistent with aura and selection code depends on it: + if (event->buttons() & Qt::LeftButton) + return WebMouseEvent::ButtonLeft; + else if (event->buttons() & Qt::RightButton) + return WebMouseEvent::ButtonRight; + else if (event->buttons() & Qt::MidButton) + return WebMouseEvent::ButtonMiddle; + return WebMouseEvent::ButtonNone; } |