Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qeglfscursor_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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// Qt-Security score:significant reason:default
4
5#ifndef QEGLFSCURSOR_H
6#define QEGLFSCURSOR_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include "qeglfsglobal_p.h"
20#include <qpa/qplatformcursor.h>
21#include <qpa/qplatformscreen.h>
22#include <QtOpenGL/QOpenGLShaderProgram>
23#include <QtGui/QMatrix4x4>
24#include <QtGui/private/qinputdevicemanager_p.h>
25
26#include <QtCore/qlist.h>
27
28QT_BEGIN_NAMESPACE
29
30class QOpenGLShaderProgram;
31class QEglFSCursor;
32class QEglFSScreen;
33
35{
37
38public:
40 bool hasMouse() const;
41
42public slots:
44
45private:
46 QEglFSCursor *m_cursor;
47};
48
49#if QT_CONFIG(opengl)
50
51struct QEglFSCursorData {
52 QScopedPointer<QOpenGLShaderProgram> program;
53 int textureEntry = 0;
54 int matEntry = 0;
55 uint customCursorTexture = 0;
56 uint atlasTexture = 0;
57 qint64 customCursorKey = 0;
58};
59
60class Q_EGLFS_EXPORT QEglFSCursor : public QPlatformCursor
61{
62 Q_OBJECT
63public:
64 QEglFSCursor(QPlatformScreen *screen);
65 ~QEglFSCursor();
66
67#ifndef QT_NO_CURSOR
68 void changeCursor(QCursor *cursor, QWindow *widget) override;
69#endif
70 void pointerEvent(const QMouseEvent &event) override;
71 QPoint pos() const override;
72 void setPos(const QPoint &pos) override;
73
74 QRect cursorRect() const;
75 void paintOnScreen();
76 void resetResources();
77
78 void updateMouseStatus();
79
80private:
81 bool event(QEvent *e) override;
82#ifndef QT_NO_CURSOR
83 bool setCurrentCursor(QCursor *cursor);
84#endif
85 void draw(const QRectF &rect);
86 void update(const QRect &rect, bool allScreens);
87 void createShaderPrograms();
88 void createCursorTexture(uint *texture, const QImage &image);
89 void initCursorAtlas();
90
91 // current cursor information
92 struct Cursor {
93 Cursor() : shape(Qt::BlankCursor), customCursorPending(false), customCursorKey(0), useCustomCursor(false) { }
94 Qt::CursorShape shape;
95 QRectF textureRect; // normalized rect inside texture
96 QSize size; // size of the cursor
97 QPoint hotSpot;
98 QImage customCursorImage;
99 QPoint pos; // current cursor position
100 bool customCursorPending;
101 qint64 customCursorKey;
102 bool useCustomCursor;
103 } m_cursor;
104
105 // cursor atlas information
106 struct CursorAtlas {
107 CursorAtlas() : cursorsPerRow(0), cursorWidth(0), cursorHeight(0) { }
108 int cursorsPerRow;
109 int width, height; // width and height of the atlas
110 int cursorWidth, cursorHeight; // width and height of cursors inside the atlas
111 QList<QPoint> hotSpots;
112 QImage image; // valid until it's uploaded
113 } m_cursorAtlas;
114
115 bool m_visible;
116 QEglFSScreen *m_screen;
117 QPlatformScreen *m_activeScreen;
118 QEglFSCursorDeviceListener *m_deviceListener;
119 bool m_updateRequested;
120 QMatrix4x4 m_rotationMatrix;
121};
122#endif // QT_CONFIG(opengl)
123
124QT_END_NAMESPACE
125
126#endif // QEGLFSCURSOR_H
\inmodule QtSql
Combined button and popup list for selecting options.
#define Q_EGLFS_EXPORT