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
qcursor.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 QCURSOR_H
6#define QCURSOR_H
7
8#include <QtGui/qtguiglobal.h>
9#include <QtCore/qpoint.h>
10#include <QtGui/qwindowdefs.h>
11#include <QtGui/qbitmap.h>
12
13QT_BEGIN_NAMESPACE
14
15
16class QVariant;
17class QScreen;
18
19/*
20 ### The fake cursor has to go first with old qdoc.
21*/
22#ifdef QT_NO_CURSOR
23
24class Q_GUI_EXPORT QCursor
25{
26public:
27 static QPoint pos();
28 static QPoint pos(const QScreen *screen);
29 static void setPos(int x, int y);
30 static void setPos(QScreen *screen, int x, int y);
31 inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); }
32private:
33 QCursor();
34};
35
36#endif // QT_NO_CURSOR
37
38#ifndef QT_NO_CURSOR
39
40class QCursorData;
41class QBitmap;
42class QPixmap;
43
44
45class Q_GUI_EXPORT QCursor
46{
47public:
48 QCursor();
49 QCursor(Qt::CursorShape shape);
50 QCursor(const QBitmap &bitmap, const QBitmap &mask, int hotX=-1, int hotY=-1);
51 explicit QCursor(const QPixmap &pixmap, int hotX=-1, int hotY=-1);
52 QCursor(const QCursor &cursor);
53 ~QCursor();
54 QCursor &operator=(const QCursor &cursor);
55 QCursor(QCursor &&other) noexcept : d(std::exchange(other.d, nullptr)) {}
56 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCursor)
57
58 void swap(QCursor &other) noexcept { qt_ptr_swap(d, other.d); }
59
60 operator QVariant() const;
61
62 Qt::CursorShape shape() const;
63 void setShape(Qt::CursorShape newShape);
64
65#if QT_DEPRECATED_SINCE(6, 0)
66 QT_DEPRECATED_VERSION_X_6_0("Use the overload without argument instead.")
67 QBitmap bitmap(Qt::ReturnByValueConstant) const { return bitmap(); }
68 QT_DEPRECATED_VERSION_X_6_0("Use the overload without argument instead.")
69 QBitmap mask(Qt::ReturnByValueConstant) const { return mask(); }
70#endif // QT_DEPRECATED_SINCE(6, 0)
71 QBitmap bitmap() const;
72 QBitmap mask() const;
73
74 QPixmap pixmap() const;
75 QPoint hotSpot() const;
76
77 static QPoint pos();
78 static QPoint pos(const QScreen *screen);
79 static void setPos(int x, int y);
80 static void setPos(QScreen *screen, int x, int y);
81 inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); }
82 inline static void setPos(QScreen *screen, const QPoint &p) { setPos(screen, p.x(), p.y()); }
83
84private:
85 friend Q_GUI_EXPORT bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept;
86 friend inline bool operator!=(const QCursor &lhs, const QCursor &rhs) noexcept { return !(lhs == rhs); }
87 QCursorData *d;
88};
90
91/*****************************************************************************
92 QCursor stream functions
93 *****************************************************************************/
94#ifndef QT_NO_DATASTREAM
95Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor);
96Q_GUI_EXPORT QDataStream &operator>>(QDataStream &inS, QCursor &cursor);
97#endif
98
99#ifndef QT_NO_DEBUG_STREAM
100Q_GUI_EXPORT QDebug operator<<(QDebug, const QCursor &);
101#endif
102
103#endif // QT_NO_CURSOR
104
105QT_END_NAMESPACE
106
107#endif // QCURSOR_H
friend bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept
Returns true if lhs and rhs are equal, otherwise returns false.
Definition qbytearray.h:807
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition qcursor.h:46
\inmodule QtCore\reentrant
Definition qdatastream.h:50
\inmodule QtCore\reentrant
Definition qpoint.h:30
Combined button and popup list for selecting options.
QCursorData * qt_cursorTable[Qt::LastCursor+1]
Definition qcursor.cpp:660
QDataStream & operator>>(QDataStream &s, QKeyCombination &combination)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2582