Fix key modifiers in mouse wheel events on Windows.
The Windows platform plugin was not checking for the control or shift keyboard modifiers when processing mouse wheel events. Added a function to convert Windows wheel events to Qt::KeyboardModifiers and passed this through the event chain. Task-number: QTBUG-25754 Change-Id: I6551e98b4eaebad5704058bddfb06502ded5155d Reviewed-by: Martin Jones <martin.jones@nokia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
parent
6481218da1
commit
4a8d9eed87
@ -196,6 +196,8 @@ bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND,
|
||||
MSG msg, LRESULT *)
|
||||
{
|
||||
const Qt::MouseButtons buttons = keyStateToMouseButtons((int)msg.wParam);
|
||||
const Qt::KeyboardModifiers mods = keyStateToModifiers((int)msg.wParam);
|
||||
|
||||
int delta;
|
||||
if (msg.message == WM_MOUSEWHEEL || msg.message == WM_MOUSEHWHEEL)
|
||||
delta = (short) HIWORD (msg.wParam);
|
||||
@ -224,7 +226,7 @@ bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND,
|
||||
QWindowSystemInterface::handleWheelEvent(receiver,
|
||||
QWindowsGeometryHint::mapFromGlobal(receiver, globalPos),
|
||||
globalPos,
|
||||
delta, orientation);
|
||||
delta, orientation, mods);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@ public:
|
||||
LRESULT *result);
|
||||
|
||||
static inline Qt::MouseButtons keyStateToMouseButtons(int);
|
||||
static inline Qt::KeyboardModifiers keyStateToModifiers(int);
|
||||
static inline int mouseButtonsToKeyState(Qt::MouseButtons);
|
||||
|
||||
QWindow *windowUnderMouse() const { return m_windowUnderMouse.data(); }
|
||||
@ -96,6 +97,16 @@ Qt::MouseButtons QWindowsMouseHandler::keyStateToMouseButtons(int wParam)
|
||||
return mb;
|
||||
}
|
||||
|
||||
Qt::KeyboardModifiers QWindowsMouseHandler::keyStateToModifiers(int wParam)
|
||||
{
|
||||
Qt::KeyboardModifiers mods(Qt::NoModifier);
|
||||
if (wParam & MK_CONTROL)
|
||||
mods |= Qt::ControlModifier;
|
||||
if (wParam & MK_SHIFT)
|
||||
mods |= Qt::ShiftModifier;
|
||||
return mods;
|
||||
}
|
||||
|
||||
int QWindowsMouseHandler::mouseButtonsToKeyState(Qt::MouseButtons mb)
|
||||
{
|
||||
int result = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user