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
qplatformcursor.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#ifndef QPLATFORMCURSOR_H
4#define QPLATFORMCURSOR_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is part of the QPA API and is not meant to be used
11// in applications. Usage of this API may make your code
12// source and binary incompatible with future versions of Qt.
13//
14
15#include <QtGui/qtguiglobal.h>
16#include <QtCore/QList>
17#include <QtGui/QImage>
18#include <QtGui/QMouseEvent>
19#include <QtCore/QWeakPointer>
20#include <QtCore/QObject>
21#include <qpa/qplatformscreen.h>
22#include <QtGui/QCursor>
23
25
26
27// Cursor graphics management
28class Q_GUI_EXPORT QPlatformCursorImage {
29public:
30 QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
31 { set(data, mask, width, height, hotX, hotY); }
32 QImage * image() { return &cursorImage; }
33 QPoint hotspot() const { return hot; }
34 void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY);
35 void set(const QImage &image, int hx, int hy);
36 void set(Qt::CursorShape);
37private:
38 static void createSystemCursor(int id);
39 QImage cursorImage;
40 QPoint hot;
41};
42
43class Q_GUI_EXPORT QPlatformCursor : public QObject {
44public:
45 Q_DISABLE_COPY_MOVE(QPlatformCursor)
46
48 OverrideCursor = 0x1
49 };
50 Q_DECLARE_FLAGS(Capabilities, Capability)
51
53
54 // input methods
55 virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); }
56#ifndef QT_NO_CURSOR
57 virtual void changeCursor(QCursor * windowCursor, QWindow * window) = 0;
58 virtual void setOverrideCursor(const QCursor &);
59 virtual void clearOverrideCursor();
60#endif // QT_NO_CURSOR
61 virtual QPoint pos() const;
62 virtual void setPos(const QPoint &pos);
63 virtual QSize size() const;
64
65 static Capabilities capabilities() { return m_capabilities; }
66 static void setCapabilities(Capabilities c) { m_capabilities = c; }
67 static void setCapability(Capability c) { m_capabilities.setFlag(c); }
68
69private:
70 friend void qt_qpa_set_cursor(QWidget * w, bool force);
71 friend class QApplicationPrivate;
72
73 static Capabilities m_capabilities;
74};
75
76Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformCursor::Capabilities)
77
79
80#endif // QPLATFORMCURSOR_H
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition qcursor.h:45
\inmodule QtGui
Definition qimage.h:37
\inmodule QtGui
Definition qevent.h:196
\inmodule QtCore
Definition qobject.h:103
The QPlatformCursorImage class provides a set of graphics intended to be used as cursors.
QPoint hotspot() const
Return the cursor's hotspot.
QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
Sets the cursor image to the graphic represented by the combination of data and mask,...
QImage * image()
Return the cursor graphic as a pointer to a QImage.
The QPlatformCursor class provides information about pointer device events (movement,...
static void setCapability(Capability c)
virtual void changeCursor(QCursor *windowCursor, QWindow *window)=0
This method is called by Qt whenever the cursor graphic should be changed.
static Capabilities capabilities()
static void setCapabilities(Capabilities c)
virtual void pointerEvent(const QMouseEvent &event)
This method is called by Qt whenever a QMouseEvent is generated by the underlying pointer input.
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore
Definition qsize.h:25
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
\inmodule QtGui
Definition qwindow.h:63
Combined button and popup list for selecting options.
CursorShape
Definition image.cpp:4
void qt_qpa_set_cursor(QWidget *w, bool force)
Definition qwidget.cpp:5014
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
static void clearOverrideCursor(const QList< QScreen * > &screens)
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei width
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
struct _cl_event * event
const GLubyte * c
#define Q_UNUSED(x)
unsigned char uchar
Definition qtypes.h:32
QFuture< QSet< QChar > > set
[10]
rect setPos(100, 100)
aWidget window() -> setWindowTitle("New Window Title")
[2]