qplatformcursor.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformcursor.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33#include "qplatformcursor.h"-
34-
35#include <QPainter>-
36#include <QBitmap>-
37#include <QGuiApplication>-
38#include <QScreen>-
39#include <qpa/qplatformscreen.h>-
40#include <private/qguiapplication_p.h>-
41-
42#include <QDebug>-
43-
44QT_BEGIN_NAMESPACE-
45-
46QList<QPlatformCursor *> QPlatformCursorPrivate::getInstances()-
47{-
48 QList<QPlatformCursor *> result;-
49 foreach (const QScreen *screen, QGuiApplicationPrivate::screen_list)-
50 if (QPlatformCursor *cursor = screen->handle()->cursor())
QPlatformCurso...le()->cursor()Description
TRUEnever evaluated
FALSEnever evaluated
0
51 result.push_back(cursor);
never executed: result.push_back(cursor);
0
52 return result;
never executed: return result;
0
53}-
54-
55/*!-
56 \class QPlatformCursor-
57 \since 5.0-
58 \internal-
59 \preliminary-
60 \ingroup qpa-
61-
62 \brief The QPlatformCursor class provides information about-
63 pointer device events (movement, buttons), and requests to change-
64 the currently displayed cursor.-
65-
66 Note that QPlatformCursor does not include any graphics for-
67 display. An application that sets a QCursor may provide its own-
68 graphics.-
69-
70 \sa QPlatformCursorImage-
71*/-
72-
73/*!-
74 \fn virtual void QPlatformCursor::pointerEvent(const QMouseEvent & event)-
75-
76 This method is called by Qt whenever a QMouseEvent is generated by the-
77 underlying pointer input. \a event is a reference to the QMouseEvent in-
78 question. A default do-nothing implementation is provided.-
79*/-
80-
81/*!-
82 \fn virtual void QPlatformCursor::changeCursor(QCursor * windowCursor, QWindow * window)-
83-
84 \brief This method is called by Qt whenever the cursor graphic should be changed.-
85-
86 Implementation of this method is mandatory for a subclass of QPlatformCursor.-
87-
88 \a windowCursor is a pointer to the QCursor that should be displayed.-
89-
90 To unset the cursor of \a window, 0 is passed. This means \a window does not have-
91 a cursor set and the cursor of a the first parent window which has a cursor explicitly-
92 set or the system default cursor should take effect.-
93-
94 \a window is a pointer to the window currently displayed at QCursor::pos(). Note-
95 that this may be 0 if the current position is not occupied by a displayed widget.-
96-
97 \sa QCursor::pos()-
98*/-
99-
100/*!-
101 \fn QPlatformCursor::QPlatformCursor()-
102-
103 Constructs a QPlatformCursor.-
104*/-
105QPlatformCursor::QPlatformCursor()-
106{-
107}-
108-
109QPoint QPlatformCursor::pos() const-
110{-
111 // As a fallback return the last mouse position seen by QGuiApplication.-
112 return QGuiApplicationPrivate::lastCursorPosition.toPoint();
never executed: return QGuiApplicationPrivate::lastCursorPosition.toPoint();
0
113}-
114-
115void QPlatformCursor::setPos(const QPoint &pos)-
116{-
117 static bool firstCall = true;-
118 if (firstCall) {
firstCallDescription
TRUEnever evaluated
FALSEnever evaluated
0
119 firstCall = false;-
120 qWarning("This plugin does not support QCursor::setPos()"-
121 "; emulating movement within the application.");-
122 }
never executed: end of block
0
123 QWindowSystemInterface::handleMouseEvent(0, pos, pos, Qt::NoButton);-
124}
never executed: end of block
0
125-
126// End of display and pointer event handling code-
127// Beginning of built-in cursor graphics-
128// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp-
129-
130/*!-
131 \class QPlatformCursorImage-
132 \since 5.0-
133 \internal-
134 \preliminary-
135 \ingroup qpa-
136-
137 \brief The QPlatformCursorImage class provides a set of graphics-
138 intended to be used as cursors.-
139-
140 \sa QPlatformCursor-
141*/-
142-
143static QPlatformCursorImage *systemCursorTable[Qt::LastCursor+1];-
144static bool systemCursorTableInit = false;-
145-
146// 16 x 16-
147static const uchar cur_arrow_bits[] = {-
148 0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08,-
149 0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22,-
150 0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 };-
151static const uchar mcur_arrow_bits[] = {-
152 0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f,-
153 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e,-
154 0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 };-
155-
156static const unsigned char cur_up_arrow_bits[] = {-
157 0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04,-
158 0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,-
159 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01};-
160static const unsigned char mcur_up_arrow_bits[] = {-
161 0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07,-
162 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,-
163 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01};-
164-
165static const unsigned char cur_cross_bits[] = {-
166 0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,-
167 0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,-
168 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00};-
169static const unsigned char mcur_cross_bits[] = {-
170 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,-
171 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,-
172 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00};-
173-
174static const uchar cur_ibeam_bits[] = {-
175 0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,-
176 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,-
177 0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 };-
178static const uchar mcur_ibeam_bits[] = {-
179 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,-
180 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,-
181 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 };-
182-
183static const uchar cur_ver_bits[] = {-
184 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,-
185 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f,-
186 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 };-
187static const uchar mcur_ver_bits[] = {-
188 0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f,-
189 0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f,-
190 0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 };-
191-
192static const uchar cur_hor_bits[] = {-
193 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18,-
194 0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08,-
195 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
196static const uchar mcur_hor_bits[] = {-
197 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c,-
198 0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c,-
199 0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 };-
200static const uchar cur_bdiag_bits[] = {-
201 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e,-
202 0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00,-
203 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
204static const uchar mcur_bdiag_bits[] = {-
205 0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f,-
206 0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01,-
207 0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 };-
208static const uchar cur_fdiag_bits[] = {-
209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00,-
210 0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c,-
211 0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 };-
212static const uchar mcur_fdiag_bits[] = {-
213 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00,-
214 0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e,-
215 0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 };-
216-
217// 20 x 20-
218static const uchar forbidden_bits[] = {-
219 0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01,-
220 0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06,-
221 0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03,-
222 0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 };-
223-
224static const uchar forbiddenm_bits[] = {-
225 0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03,-
226 0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f,-
227 0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07,-
228 0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00};-
229-
230// 32 x 32-
231static const uchar wait_data_bits[] = {-
232 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
233 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00,-
234 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00,-
235 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00,-
236 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00,-
237 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00,-
238 0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00,-
239 0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00,-
240 0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,-
241 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
242 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
243static const uchar wait_mask_bits[] = {-
244 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00,-
246 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00,-
247 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,-
248 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00,-
249 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00,-
250 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,-
251 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00,-
252 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,-
253 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
254 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
255-
256static const uchar hsplit_bits[] = {-
257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
258 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
259 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,-
260 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,-
261 0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03,-
262 0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00,-
263 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,-
264 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,-
265 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
266 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
267 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
268static const uchar hsplitm_bits[] = {-
269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
271 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,-
272 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00,-
273 0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07,-
274 0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00,-
275 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,-
276 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,-
277 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
280static const uchar vsplit_bits[] = {-
281 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
282 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
283 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,-
284 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,-
285 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,-
286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,-
287 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,-
288 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00,-
289 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
291 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
292static const uchar vsplitm_bits[] = {-
293 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
294 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,-
295 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00,-
296 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,-
297 0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,-
298 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,-
299 0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,-
300 0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00,-
301 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00,-
302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
303 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
304static const uchar phand_bits[] = {-
305 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,-
306 0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00,-
307 0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00,-
308 0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00,-
309 0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,-
310 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
312 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
313 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
314 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
315 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
316static const uchar phandm_bits[] = {-
317 0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,-
318 0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00,-
319 0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00,-
320 0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00,-
321 0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,-
322 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
323 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
324 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
328-
329static const uchar size_all_data_bits[] = {-
330 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
332 0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,-
333 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,-
334 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00,-
335 0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00,-
336 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,-
337 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00,-
338 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
340 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
341static const uchar size_all_mask_bits[] = {-
342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,-
344 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00,-
345 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00,-
346 0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01,-
347 0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00,-
348 0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00,-
349 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00,-
350 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
352 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };-
353-
354static const uchar whatsthis_bits[] = {-
355 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00,-
356 0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00,-
357 0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00,-
358 0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00,-
359 0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00,-
360 0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00,-
361 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
362 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
363 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };-
366static const uchar whatsthism_bits[] = {-
367 0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00,-
368 0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00,-
369 0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00,-
370 0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00,-
371 0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00,-
372 0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00,-
373 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
375 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
377 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };-
378-
379static const uchar busy_bits[] = {-
380 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,-
381 0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,-
382 0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00,-
383 0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00,-
384 0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00,-
385 0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00,-
386 0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00,-
387 0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,-
388 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
389 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
390 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};-
391static const uchar busym_bits[] = {-
392 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,-
393 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,-
394 0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00,-
395 0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00,-
396 0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00,-
397 0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00,-
398 0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00,-
399 0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,-
400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
401 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,-
402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};-
403-
404// 16 x 16-
405static const uchar openhand_bits[] = {-
406 0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92,-
407 0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20,-
408 0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00};-
409static const uchar openhandm_bits[] = {-
410 0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff,-
411 0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f,-
412 0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00};-
413static const uchar closedhand_bits[] = {-
414 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50,-
415 0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10,-
416 0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00};-
417static const uchar closedhandm_bits[] = {-
418 0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f,-
419 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f,-
420 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00};-
421-
422void QPlatformCursorImage::createSystemCursor(int id)-
423{-
424 if (!systemCursorTableInit) {
!systemCursorTableInitDescription
TRUEnever evaluated
FALSEnever evaluated
0
425 for (int i = 0; i <= Qt::LastCursor; i++)
i <= Qt::LastCursorDescription
TRUEnever evaluated
FALSEnever evaluated
0
426 systemCursorTable[i] = 0;
never executed: systemCursorTable[i] = 0;
0
427 systemCursorTableInit = true;-
428 }
never executed: end of block
0
429 switch (id) {-
430 // 16x16 cursors-
431 case Qt::ArrowCursor:
never executed: case Qt::ArrowCursor:
0
432 systemCursorTable[Qt::ArrowCursor] =-
433 new QPlatformCursorImage(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0);-
434 break;
never executed: break;
0
435-
436 case Qt::UpArrowCursor:
never executed: case Qt::UpArrowCursor:
0
437 systemCursorTable[Qt::UpArrowCursor] =-
438 new QPlatformCursorImage(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0);-
439 break;
never executed: break;
0
440-
441 case Qt::CrossCursor:
never executed: case Qt::CrossCursor:
0
442 systemCursorTable[Qt::CrossCursor] =-
443 new QPlatformCursorImage(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7);-
444 break;
never executed: break;
0
445-
446 case Qt::IBeamCursor:
never executed: case Qt::IBeamCursor:
0
447 systemCursorTable[Qt::IBeamCursor] =-
448 new QPlatformCursorImage(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7);-
449 break;
never executed: break;
0
450-
451 case Qt::SizeVerCursor:
never executed: case Qt::SizeVerCursor:
0
452 systemCursorTable[Qt::SizeVerCursor] =-
453 new QPlatformCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7);-
454 break;
never executed: break;
0
455-
456 case Qt::SizeHorCursor:
never executed: case Qt::SizeHorCursor:
0
457 systemCursorTable[Qt::SizeHorCursor] =-
458 new QPlatformCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7);-
459 break;
never executed: break;
0
460-
461 case Qt::SizeBDiagCursor:
never executed: case Qt::SizeBDiagCursor:
0
462 systemCursorTable[Qt::SizeBDiagCursor] =-
463 new QPlatformCursorImage(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7);-
464 break;
never executed: break;
0
465-
466 case Qt::SizeFDiagCursor:
never executed: case Qt::SizeFDiagCursor:
0
467 systemCursorTable[Qt::SizeFDiagCursor] =-
468 new QPlatformCursorImage(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7);-
469 break;
never executed: break;
0
470-
471 case Qt::BlankCursor:
never executed: case Qt::BlankCursor:
0
472 systemCursorTable[Qt::BlankCursor] =-
473 new QPlatformCursorImage(0, 0, 0, 0, 0, 0);-
474 break;
never executed: break;
0
475-
476 // 20x20 cursors-
477 case Qt::ForbiddenCursor:
never executed: case Qt::ForbiddenCursor:
0
478 systemCursorTable[Qt::ForbiddenCursor] =-
479 new QPlatformCursorImage(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10);-
480 break;
never executed: break;
0
481-
482 // 32x32 cursors-
483 case Qt::WaitCursor:
never executed: case Qt::WaitCursor:
0
484 systemCursorTable[Qt::WaitCursor] =-
485 new QPlatformCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15);-
486 break;
never executed: break;
0
487-
488 case Qt::SplitVCursor:
never executed: case Qt::SplitVCursor:
0
489 systemCursorTable[Qt::SplitVCursor] =-
490 new QPlatformCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15);-
491 break;
never executed: break;
0
492-
493 case Qt::SplitHCursor:
never executed: case Qt::SplitHCursor:
0
494 systemCursorTable[Qt::SplitHCursor] =-
495 new QPlatformCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15);-
496 break;
never executed: break;
0
497-
498 case Qt::SizeAllCursor:
never executed: case Qt::SizeAllCursor:
0
499 systemCursorTable[Qt::SizeAllCursor] =-
500 new QPlatformCursorImage(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15);-
501 break;
never executed: break;
0
502-
503 case Qt::PointingHandCursor:
never executed: case Qt::PointingHandCursor:
0
504 systemCursorTable[Qt::PointingHandCursor] =-
505 new QPlatformCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0);-
506 break;
never executed: break;
0
507-
508 case Qt::WhatsThisCursor:
never executed: case Qt::WhatsThisCursor:
0
509 systemCursorTable[Qt::WhatsThisCursor] =-
510 new QPlatformCursorImage(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0);-
511 break;
never executed: break;
0
512 case Qt::BusyCursor:
never executed: case Qt::BusyCursor:
0
513 systemCursorTable[Qt::BusyCursor] =-
514 new QPlatformCursorImage(busy_bits, busym_bits, 32, 32, 0, 0);-
515 break;
never executed: break;
0
516-
517 case Qt::OpenHandCursor:
never executed: case Qt::OpenHandCursor:
0
518 systemCursorTable[Qt::OpenHandCursor] =-
519 new QPlatformCursorImage(openhand_bits, openhandm_bits, 16, 16, 8, 8);-
520 break;
never executed: break;
0
521 case Qt::ClosedHandCursor:
never executed: case Qt::ClosedHandCursor:
0
522 systemCursorTable[Qt::ClosedHandCursor] =-
523 new QPlatformCursorImage(closedhand_bits, closedhandm_bits, 16, 16, 8, 8);-
524 break;
never executed: break;
0
525 default:
never executed: default:
0
526 qWarning("Unknown system cursor %d", id);-
527 }
never executed: end of block
0
528}-
529-
530/*!-
531 \fn void QPlatformCursorImage::set(Qt::CursorShape id)-
532-
533 \brief Calling this method sets the cursor image to the specified shape-
534-
535 \a id is one of the defined Qt::CursorShape values.-
536-
537 If id is invalid, Qt::BitmapCursor, or unknown by the implementation,-
538 Qt::ArrowCursor is used instead.-
539*/-
540-
541void QPlatformCursorImage::set(Qt::CursorShape id)-
542{-
543 QPlatformCursorImage *cursor = 0;-
544 if (id >= 0 && id <= Qt::LastCursor) {
id >= 0Description
TRUEnever evaluated
FALSEnever evaluated
id <= Qt::LastCursorDescription
TRUEnever evaluated
FALSEnever evaluated
0
545 if (!systemCursorTable[id])
!systemCursorTable[id]Description
TRUEnever evaluated
FALSEnever evaluated
0
546 createSystemCursor(id);
never executed: createSystemCursor(id);
0
547 cursor = systemCursorTable[id];-
548 }
never executed: end of block
0
549-
550 if (cursor == 0) {
cursor == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
551 if (!systemCursorTable[Qt::ArrowCursor])
!systemCursorT...::ArrowCursor]Description
TRUEnever evaluated
FALSEnever evaluated
0
552 createSystemCursor(Qt::ArrowCursor);
never executed: createSystemCursor(Qt::ArrowCursor);
0
553 cursor = systemCursorTable[Qt::ArrowCursor];-
554 }
never executed: end of block
0
555 cursorImage = cursor->cursorImage;-
556 hot = cursor->hot;-
557}
never executed: end of block
0
558-
559/*!-
560 Sets the cursor image to the given \a image, with the hotspot at the-
561 point specified by (\a hx, \a hy).-
562*/-
563-
564void QPlatformCursorImage::set(const QImage &image, int hx, int hy)-
565{-
566 hot.setX(hx);-
567 hot.setY(hy);-
568 cursorImage = image;-
569}
never executed: end of block
0
570-
571/*!-
572 \fn void QPlatformCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy)-
573-
574 Sets the cursor image to the graphic represented by the combination of-
575 \a data and \a mask, with dimensions given by \a width and \a height and a-
576 hotspot at the point specified by (\a hx, \a hy).-
577-
578 The image data specified by \a data must be supplied in the format-
579 described by QImage::Format_Indexed8.-
580-
581 The corresponding mask data specified by \a mask must be supplied in a-
582 character array containing packed 1 bit per pixel format data, with any-
583 padding bits at the end of the array. Bits of value 0 represent transparent-
584 pixels in the image data.-
585*/-
586void QPlatformCursorImage::set(const uchar *data, const uchar *mask,-
587 int width, int height, int hx, int hy)-
588{-
589 hot.setX(hx);-
590 hot.setY(hy);-
591-
592 cursorImage = QImage(width,height, QImage::Format_Indexed8);-
593-
594 if (!width || !height || !data || !mask || cursorImage.isNull())
!widthDescription
TRUEnever evaluated
FALSEnever evaluated
!heightDescription
TRUEnever evaluated
FALSEnever evaluated
!dataDescription
TRUEnever evaluated
FALSEnever evaluated
!maskDescription
TRUEnever evaluated
FALSEnever evaluated
cursorImage.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
595 return;
never executed: return;
0
596-
597 cursorImage.setColorCount(3);-
598 cursorImage.setColor(0, 0xff000000);-
599 cursorImage.setColor(1, 0xffffffff);-
600 cursorImage.setColor(2, 0x00000000);-
601-
602 int bytesPerLine = (width + 7) / 8;-
603 int p = 0;-
604 int d, m;-
605-
606 int x = -1, w = 0;-
607-
608 uchar *cursor_data = cursorImage.bits();-
609 int bpl = cursorImage.bytesPerLine();-
610 for (int i = 0; i < height; i++)
i < heightDescription
TRUEnever evaluated
FALSEnever evaluated
0
611 {-
612 for (int j = 0; j < bytesPerLine; j++, data++, mask++)
j < bytesPerLineDescription
TRUEnever evaluated
FALSEnever evaluated
0
613 {-
614 for (int b = 0; b < 8 && j*8+b < width; b++)
b < 8Description
TRUEnever evaluated
FALSEnever evaluated
j*8+b < widthDescription
TRUEnever evaluated
FALSEnever evaluated
0
615 {-
616 d = *data & (1 << b);-
617 m = *mask & (1 << b);-
618 if (d && m) p = 0;
never executed: p = 0;
dDescription
TRUEnever evaluated
FALSEnever evaluated
mDescription
TRUEnever evaluated
FALSEnever evaluated
0
619 else if (!d && m) p = 1;
never executed: p = 1;
!dDescription
TRUEnever evaluated
FALSEnever evaluated
mDescription
TRUEnever evaluated
FALSEnever evaluated
0
620 else p = 2;
never executed: p = 2;
0
621 cursor_data[j*8+b] = p;-
622-
623 // calc region-
624 if (x < 0 && m)
x < 0Description
TRUEnever evaluated
FALSEnever evaluated
mDescription
TRUEnever evaluated
FALSEnever evaluated
0
625 x = j*8+b;
never executed: x = j*8+b;
0
626 else if (x >= 0 && !m) {
x >= 0Description
TRUEnever evaluated
FALSEnever evaluated
!mDescription
TRUEnever evaluated
FALSEnever evaluated
0
627 x = -1;-
628 w = 0;-
629 }
never executed: end of block
0
630 if (m)
mDescription
TRUEnever evaluated
FALSEnever evaluated
0
631 w++;
never executed: w++;
0
632 }
never executed: end of block
0
633 }
never executed: end of block
0
634 if (x >= 0) {
x >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
635 x = -1;-
636 w = 0;-
637 }
never executed: end of block
0
638 cursor_data += bpl;-
639 }
never executed: end of block
0
640-
641}
never executed: end of block
0
642-
643/*!-
644 \fn QPlatformCursorImage::QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)-
645-
646 Sets the cursor image to the graphic represented by the combination of-
647 \a data and \a mask, with dimensions given by \a width and \a height and a-
648 hotspot at the point specified by (\a hotX, \a hotY).-
649-
650 \sa set()-
651*/-
652-
653/*!-
654 \fn QImage *QPlatformCursorImage::image()-
655-
656 \brief Return the cursor graphic as a pointer to a QImage-
657*/-
658-
659/*!-
660 \fn QPoint QPlatformCursorImage::hotspot() const-
661-
662 \brief Return the cursor's hotspot-
663*/-
664-
665QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9