1QCursor(3qt)                                                      QCursor(3qt)
2
3
4

NAME

6       QCursor - Mouse cursor with an arbitrary shape
7

SYNOPSIS

9       #include <qcursor.h>
10
11       Inherits Qt.
12
13   Public Members
14       QCursor ()
15       QCursor ( int shape )
16       QCursor ( const QBitmap & bitmap, const QBitmap & mask, int hotX = -1,
17           int hotY = -1 )
18       QCursor ( const QPixmap & pixmap, int hotX = -1, int hotY = -1 )
19       QCursor ( const QCursor & c )
20       ~QCursor ()
21       QCursor & operator= ( const QCursor & c )
22       int shape () const
23       void setShape ( int shape )
24       const QBitmap * bitmap () const
25       const QBitmap * mask () const
26       QPoint hotSpot () const
27       HCURSOR handle () const
28       QCursor ( HCURSOR handle )
29       HANDLE handle () const
30
31   Static Public Members
32       QPoint pos ()
33       void setPos ( int x, int y )
34       void setPos ( const QPoint & )
35       void initialize ()
36       void cleanup ()
37
39       QDataStream & operator<< ( QDataStream & s, const QCursor & c )
40       QDataStream & operator>> ( QDataStream & s, QCursor & c )
41

DESCRIPTION

43       The QCursor class provides a mouse cursor with an arbitrary shape.
44
45       This class is mainly used to create mouse cursors that are associated
46       with particular widgets and to get and set the position of the mouse
47       cursor.
48
49       Qt has a number of standard cursor shapes, but you can also make custom
50       cursor shapes based on a QBitmap, a mask and a hotspot.
51
52       To associate a cursor with a widget, use QWidget::setCursor(). To
53       associate a cursor with all widgets (normally for a short period of
54       time), use QApplication::setOverrideCursor().
55
56       To set a cursor shape use QCursor::setShape() or use the QCursor
57       constructor which takes the shape as argument, or you can use one of
58       the predefined cursors defined in the CursorShape enum.
59
60       If you want to create a cursor with your own bitmap, either use the
61       QCursor constructor which takes a bitmap and a mask or the constructor
62       which takes a pixmap as arguments.
63
64       To set or get the position of the mouse cursor use the static methods
65       QCursor::pos() and QCursor::setPos().
66
67       <center>
68                                   [Image Omitted]
69
70       </center>
71
72       See also QWidget, GUI Design Handbook: Cursors, Widget Appearance and
73       Style, and Implicitly and Explicitly Shared Classes.
74
75       On X11, Qt supports the Xcursor library, which allows for full color
76       icon themes. The table below shows the cursor name used for each
77       Qt::CursorShape value. If a cursor cannot be found using the name shown
78       below, a standard X11 cursor will be used instead. Note: X11 does not
79       provide appropriate cursors for all possible Qt::CursorShape values. It
80       is possible that some cursors will be taken from the Xcursor theme,
81       while others will use an internal bitmap cursor.
82
83       <center>.nf
84
85       </center>
86

MEMBER FUNCTION DOCUMENTATION

QCursor::QCursor ()

89       Constructs a cursor with the default arrow shape.
90

QCursor::QCursor ( int shape )

92       Constructs a cursor with the specified shape.
93
94       See CursorShape for a list of shapes.
95
96       See also setShape().
97

QCursor::QCursor ( const QBitmap & bitmap, const QBitmap & mask, int hotX =

99       -1, int hotY = -1 )
100       Constructs a custom bitmap cursor.
101
102       bitmap and mask make up the bitmap. hotX and hotY define the cursor's
103       hot spot.
104
105       If hotX is negative, it is set to the bitmap().width()/2. If hotY is
106       negative, it is set to the bitmap().height()/2.
107
108       The cursor bitmap (B) and mask (M) bits are combined like this:
109
110       B=1 and M=1 gives black.
111
112       B=0 and M=1 gives white.
113
114       B=0 and M=0 gives transparent.
115
116       B=1 and M=0 gives an undefined result.
117
118       Use the global Qt color color0 to draw 0-pixels and color1 to draw
119       1-pixels in the bitmaps.
120
121       Valid cursor sizes depend on the display hardware (or the underlying
122       window system). We recommend using 32x32 cursors, because this size is
123       supported on all platforms. Some platforms also support 16x16, 48x48
124       and 64x64 cursors.
125
126       See also QBitmap::QBitmap() and QBitmap::setMask().
127

QCursor::QCursor ( const QPixmap & pixmap, int hotX = -1, int hotY = -1 )

129       Constructs a custom pixmap cursor.
130
131       pixmap is the image. It is usual to give it a mask (set using
132       QPixmap::setMask()). hotX and hotY define the cursor's hot spot.
133
134       If hotX is negative, it is set to the pixmap().width()/2. If hotY is
135       negative, it is set to the pixmap().height()/2.
136
137       Valid cursor sizes depend on the display hardware (or the underlying
138       window system). We recommend using 32x32 cursors, because this size is
139       supported on all platforms. Some platforms also support 16x16, 48x48
140       and 64x64 cursors.
141
142       Currently, only black-and-white pixmaps can be used.
143
144       See also QPixmap::QPixmap() and QPixmap::setMask().
145

QCursor::QCursor ( const QCursor & c )

147       Constructs a copy of the cursor c.
148

QCursor::QCursor ( HCURSOR handle )

150       Creates a cursor with the specified window system handle handle.
151
152       Warning: Portable in principle, but if you use it you are probably
153       about to do something non-portable. Be careful.
154

QCursor::~QCursor ()

156       Destroys the cursor.
157

const QBitmap * QCursor::bitmap () const

159       Returns the cursor bitmap, or 0 if it is one of the standard cursors.
160

void QCursor::cleanup () [static]

162       Internal function that deinitializes the predefined cursors. This
163       function is called from the QApplication destructor.
164
165       See also initialize().
166

HANDLE QCursor::handle () const

168       Returns the window system cursor handle.
169
170       Warning: Portable in principle, but if you use it you are probably
171       about to do something non-portable. Be careful.
172

QPoint QCursor::hotSpot () const

174       Returns the cursor hot spot, or (0, 0) if it is one of the standard
175       cursors.
176

void QCursor::initialize () [static]

178       Internal function that initializes the predefined cursors. This
179       function is called from the QApplication constructor.
180
181       See also cleanup().
182

const QBitmap * QCursor::mask () const

184       Returns the cursor bitmap mask, or 0 if it is one of the standard
185       cursors.
186

QCursor & QCursor::operator= ( const QCursor & c )

188       Assigns c to this cursor and returns a reference to this cursor.
189

QPoint QCursor::pos () [static]

191       Returns the position of the cursor (hot spot) in global screen
192       coordinates.
193
194       You can call QWidget::mapFromGlobal() to translate it to widget
195       coordinates.
196
197       See also setPos(), QWidget::mapFromGlobal(), and
198       QWidget::mapToGlobal().
199
200       Examples:
201

void QCursor::setPos ( int x, int y ) [static]

203       Moves the cursor (hot spot) to the global screen position (x, y).
204
205       You can call QWidget::mapToGlobal() to translate widget coordinates to
206       global screen coordinates.
207
208       See also pos(), QWidget::mapFromGlobal(), and QWidget::mapToGlobal().
209

void QCursor::setPos ( const QPoint & ) [static]

211       This is an overloaded member function, provided for convenience. It
212       behaves essentially like the above function.
213

void QCursor::setShape ( int shape )

215       Sets the cursor to the shape identified by shape.
216
217       See CursorShape for the list of cursor shapes.
218
219       See also shape().
220

int QCursor::shape () const

222       Returns the cursor shape identifier. The return value is one of the
223       CursorShape enum values (cast to an int).
224
225       See also setShape().
226

QDataStream & operator<< ( QDataStream & s, const QCursor & c )

229       Writes the cursor c to the stream s.
230
231       See also Format of the QDataStream operators.
232

QDataStream & operator>> ( QDataStream & s, QCursor & c )

234       Reads a cursor from the stream s and sets c to the read data.
235
236       See also Format of the QDataStream operators.
237
238

SEE ALSO

240       http://doc.trolltech.com/qcursor.html
241       http://www.trolltech.com/faq/tech.html
242
244       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
245       license file included in the distribution for a complete license
246       statement.
247

AUTHOR

249       Generated automatically from the source code.
250

BUGS

252       If you find a bug in Qt, please report it as described in
253       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
254       help you. Thank you.
255
256       The definitive Qt documentation is provided in HTML format; it is
257       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
258       web browser. This man page is provided as a convenience for those users
259       who prefer man pages, although this format is not officially supported
260       by Trolltech.
261
262       If you find errors in this manual page, please report them to qt-
263       bugs@trolltech.com.  Please include the name of the manual page
264       (qcursor.3qt) and the Qt version (3.3.8).
265
266
267
268Trolltech AS                    2 February 2007                   QCursor(3qt)
Impressum