Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowspointerhandler.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWINDOWSPOINTERHANDLER_H
5#define QWINDOWSPOINTERHANDLER_H
6
7#include "qtwindowsglobal.h"
8#include <QtCore/qt_windows.h>
9
10#include <QtCore/qpointer.h>
11#include <QtCore/qscopedpointer.h>
12#include <QtCore/qsharedpointer.h>
13#include <QtCore/qhash.h>
14#include <QtGui/qevent.h>
15#include <qpa/qwindowsysteminterface.h>
16
18
19class QWindow;
20class QPointingDevice;
21
23{
24 Q_DISABLE_COPY_MOVE(QWindowsPointerHandler)
25public:
26 using QPointingDevicePtr = QSharedPointer<QPointingDevice>;
27
30 bool translatePointerEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result);
31 bool translateMouseEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result);
32
33 const QPointingDevicePtr &touchDevice() const { return m_touchDevice; }
34 void setTouchDevice(const QPointingDevicePtr &d) { m_touchDevice = d; }
35 static QPointingDevicePtr createTouchDevice(bool mouseEmulation);
36
37 QWindow *windowUnderMouse() const { return m_windowUnderPointer.data(); }
38 void clearWindowUnderMouse() { m_windowUnderPointer = nullptr; }
39 void clearEvents();
40
41private:
42 bool translateTouchEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, PVOID vTouchInfo, unsigned int count);
43 bool translatePenEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, PVOID vPenInfo);
44 bool translateMouseWheelEvent(QWindow *window, QWindow *currentWindowUnderPointer, MSG msg, QPoint globalPos, Qt::KeyboardModifiers keyModifiers);
45 void handleCaptureRelease(QWindow *window, QWindow *currentWindowUnderPointer, HWND hwnd, QEvent::Type eventType, Qt::MouseButtons mouseButtons);
46 void handleEnterLeave(QWindow *window, QWindow *currentWindowUnderPointer, QPoint globalPos);
47#if QT_CONFIG(tabletevent)
49#endif
50
51 QPointingDevicePtr m_touchDevice;
52#if QT_CONFIG(tabletevent)
53 QList<QPointingDevicePtr> m_tabletDevices;
54 QPointingDevicePtr m_activeTabletDevice;
55#endif
56 QHash<int, QWindowSystemInterface::TouchPoint> m_lastTouchPoints;
57 QHash<DWORD, int> m_touchInputIDToTouchPointID;
58 QPointer<QWindow> m_windowUnderPointer;
59 QPointer<QWindow> m_currentWindow;
60 QWindow *m_previousCaptureWindow = nullptr;
61 bool m_needsEnterOnPointerUpdate = false;
62 QEvent::Type m_lastEventType = QEvent::None;
63 Qt::MouseButton m_lastEventButton = Qt::NoButton;
64 DWORD m_pointerType = 0;
65 static qint64 m_nextInputDeviceId; // workaround until we know how to get system device IDs
66};
67
69
70#endif // QWINDOWSPOINTERHANDLER_H
Type
This enum type defines the valid event types in Qt.
Definition qcoreevent.h:51
\inmodule QtCore\reentrant
Definition qpoint.h:25
T * data() const noexcept
Definition qpointer.h:73
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
PointerType
This enum represents what is interacting with the pointing device.
\inmodule QtGui
Definition qwindow.h:63
QWindow * windowUnderMouse() const
static QPointingDevicePtr createTouchDevice(bool mouseEmulation)
QWindowsPointerHandler()=default
const QPointingDevicePtr & touchDevice() const
bool translatePointerEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result)
bool translateMouseEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result)
QSharedPointer< QPointingDevice > QPointingDevicePtr
void setTouchDevice(const QPointingDevicePtr &d)
Combined button and popup list for selecting options.
WindowsEventType
Enumerations for WM_XX events.
MouseButton
Definition qnamespace.h:56
@ NoButton
Definition qnamespace.h:57
GLenum GLenum GLsizei count
GLuint64EXT * result
[6]
long long qint64
Definition qtypes.h:60
struct tagMSG MSG
static QPointingDevice::PointerType pointerType(unsigned currentCursor)
aWidget window() -> setWindowTitle("New Window Title")
[2]