Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QCursor Class Reference

List of all members.

Detailed Description

The QCursor class provides a mouse cursor with an arbitrary shape.

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.

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.

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().

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 Qt::CursorShape enum.

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.

To set or get the position of the mouse cursor use the static methods QCursor::pos() and QCursor::setPos().

{Note:} It is possible to create a QCursor before QApplication, but it is not useful except as a place-holder for a real QCursor created after QApplication. Attempting to use a QCursor that was created before QApplication will result in a crash.

Definition at line 85 of file qcursor.h.

Public Member Functions

const QBitmapbitmap () const
QPoint hotSpot () const
const QBitmapmask () const
 operator QVariant () const
QCursoroperator= (const QCursor &cursor)
QPixmap pixmap () const
 QCursor (const QCursor &cursor)
 QCursor (const QPixmap &pixmap, int hotX=-1, int hotY=-1)
 QCursor (const QBitmap &bitmap, const QBitmap &mask, int hotX=-1, int hotY=-1)
 QCursor (Qt::CursorShape shape)
 QCursor ()
void setShape (Qt::CursorShape newShape)
Qt::CursorShape shape () const
 ~QCursor ()

Static Public Member Functions

static QPoint pos ()
static void setPos (const QPoint &p)
static void setPos (int x, int y)

Private Attributes

QCursorData * d

Related Functions

(Note that these are not member functions.)

QDataStreamoperator<< (QDataStream &stream, const QCursor &cursor)
QDataStreamoperator>> (QDataStream &stream, QCursor &cursor)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index