The QCursor class provides a mouse cursor with an arbitrary shape.
.PP
This class is mainly used to create mouse cursors that are associated with particular widgets and to get and set the position of the mouse cursor.
.PP
Qt has a number of standard cursor shapes, but you can also make custom cursor shapes based on a QBitmap, a mask and a hotspot.
.PP
To associate a cursor with a widget, use QWidget::setCursor(). To associate a cursor with all widgets (normally for a short period of time), use QApplication::setOverrideCursor().
.PP
To set a cursor shape use QCursor::setShape() or use the QCursor constructor which takes the shape as argument, or you can use one of the predefined cursors defined in the CursorShape enum.
.PP
If you want to create a cursor with your own bitmap, either use the QCursor constructor which takes a bitmap and a mask or the constructor which takes a pixmap as arguments.
.PP
To set or get the position of the mouse cursor use the static methods QCursor::pos() and QCursor::setPos().
.PP
<center>
.ce 1
.B "[Image Omitted]"
.PP
</center>
.PP
See also QWidget, GUI Design Handbook: Cursors, Widget Appearance and Style, and Implicitly and Explicitly Shared Classes.
On X11, TQt supports the Xcursor library, which allows for full color icon themes. The table below shows the cursor name used for each Qt::CursorShape value. If a cursor cannot be found using the name shown below, a standard X11 cursor will be used instead. Note: X11 does not provide appropriate cursors for all possible Qt::CursorShape values. It is possible that some cursors will be taken from the Xcursor theme, while others will use an internal bitmap cursor.
Valid cursor sizes depend on the display hardware (or the underlying window system). We recommend using 32x32 cursors, because this size is supported on all platforms. Some platforms also support 16x16, 48x48 and 64x64 cursors.
.PP
See also QBitmap::QBitmap() and QBitmap::setMask().
.SH "QCursor::QCursor ( const QPixmap & pixmap, int hotX = -1, int hotY = -1 )"
Constructs a custom pixmap cursor.
.PP
\fIpixmap\fR is the image. It is usual to give it a mask (set using QPixmap::setMask()). \fIhotX\fR and \fIhotY\fR define the cursor's hot spot.
.PP
If \fIhotX\fR is negative, it is set to the \fCpixmap().width()/2\fR. If \fIhotY\fR is negative, it is set to the \fCpixmap().height()/2\fR.
.PP
Valid cursor sizes depend on the display hardware (or the underlying window system). We recommend using 32x32 cursors, because this size is supported on all platforms. Some platforms also support 16x16, 48x48 and 64x64 cursors.
.PP
Currently, only black-and-white pixmaps can be used.
.PP
See also QPixmap::QPixmap() and QPixmap::setMask().
.SH "QCursor::QCursor ( const QCursor & c )"
Constructs a copy of the cursor \fIc\fR.
.SH "QCursor::QCursor ( HCURSOR handle )"
Creates a cursor with the specified window system handle \fIhandle\fR.
.PP
\fBWarning:\fR Portable in principle, but if you use it you are probably about to do something non-portable. Be careful.
.SH "QCursor::~QCursor ()"
Destroys the cursor.
.SH "const QBitmap * QCursor::bitmap () const"
Returns the cursor bitmap, or 0 if it is one of the standard cursors.
.SH "void QCursor::cleanup ()\fC [static]\fR"
Internal function that deinitializes the predefined cursors. This function is called from the QApplication destructor.
.PP
See also initialize().
.SH "HANDLE QCursor::handle () const"
Returns the window system cursor handle.
.PP
\fBWarning:\fR Portable in principle, but if you use it you are probably about to do something non-portable. Be careful.
.SH "QPoint QCursor::hotSpot () const"
Returns the cursor hot spot, or (0, 0) if it is one of the standard cursors.
.SH "void QCursor::initialize ()\fC [static]\fR"
Internal function that initializes the predefined cursors. This function is called from the QApplication constructor.
.PP
See also cleanup().
.SH "const QBitmap * QCursor::mask () const"
Returns the cursor bitmap mask, or 0 if it is one of the standard cursors.
.SH "QCursor & QCursor::operator= ( const QCursor & c )"
Assigns \fIc\fR to this cursor and returns a reference to this cursor.
.SH "QPoint QCursor::pos ()\fC [static]\fR"
Returns the position of the cursor (hot spot) in global screen coordinates.
.PP
You can call QWidget::mapFromGlobal() to translate it to widget coordinates.
.PP
See also setPos(), QWidget::mapFromGlobal(), and QWidget::mapToGlobal().
.PP
Examples:
.)l chart/canvasview.cpp, fileiconview/qfileiconview.cpp, and menu/menu.cpp.
.SH "void QCursor::setPos ( int x, int y )\fC [static]\fR"
Moves the cursor (hot spot) to the global screen position (\fIx\fR, \fIy\fR).
.PP
You can call QWidget::mapToGlobal() to translate widget coordinates to global screen coordinates.
.PP
See also pos(), QWidget::mapFromGlobal(), and QWidget::mapToGlobal().