QCursor Class Reference


This class provides a mouse cursor with arbitrary shape and color. (details) (complete member list)

#include <qcursor.h>

Public Members

Static Public Members

Related Functions

(Note that these are not member functions.)

Detailed Description

This class provides a mouse cursor with arbitrary shape and color.

The QCursor class represents the window system's mouse curor. There are a number of predefined cursor shapes:

arrowCursor
standard arrow cursor
upArrowCursor
upwards arrow
crossCursor
crosshair
hourGlassCursor
hourglass/watch
ibeamCursor
ibeam/text entry
sizeVerCursor
vertical resize
sizeHorCursor
horizontal resize
sizeBDiagCursor
diagonal resize (/)
sizeFDiagCursor
diagonal resize (\)
sizeAllCursor
all directions resize

It is also possible to define custom shapes.

Members are provided to change shape, get the cursor position and so on.


Member Function Documentation

QCursor::QCursor ()

Constructs a cursor with the default arrow shape.

QCursor::QCursor (int shape)

Constructor a cursor with the specified shape.

QCursor::QCursor (const QBitmap &bitmap, const QBitmap &mask, int hotX=-1, int hotY=-1)

Constructs a custom bitmap cursor.

Arguments:

QCursor::QCursor (const QCursor &c)

Constructs a copy of the cursor c.

QCursor::~QCursor ()

Dereferences the cursor and destroys the cursor data if it was the last reference.

QCursor QCursor::copy () const

Returns a deep copy of the cursor.

To do:

Cursor QCursor::handle () const

Warning: System dependent! Do not use this unless you have to.

This function returns the window system's handle to the current cursor. Rather than use it, you should tell us what the portable functions lack.

The return type for each window system is specified in qcursor.h.

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

Assigns c to this cursor and returns a reference to the cursor.

QPoint QCursor::pos ()

Returns the position of the cursor on the screen in the global coordinate system.

You can use QWidget::mapFromGlobal() to translate it to widget coordinates.

The return value is the coordinate of the hot spot.

See also: setPos(), QWidget::mapFromGlobal() and QWidget::mapToGlobal().

void QCursor::setPos (int x, int y)

Warps the cursor to the global screen position (x,y).

You can use QWidget::mapToGlobal() to translate widget coordinates to global screen coordinates.

See also: pos().

bool QCursor::setShape (int shape)

This function sets the cursor shape. If the argument isn't a valid shape number, an arrow cursor will be substituted.

int QCursor::shape () const

This function returns the cursor shape (one of the global cursors or one of the custom cursors.

void QCursor::update () const

.


Related Functions

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

Writes the cursor to the stream.

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

Reads the cursor from the stream.


This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.

It was generated from the following files:


Generated at 16:17, 1995/06/30 by the webmaster at Troll Tech