6.0.0-rc4Source

QCursor Class

The QCursor class provides a mouse cursor with one of the standard shapes. More…

Header#include <QCursor>
CMaketarget_link_libraries(app PRIVATE Nt::Gui)
ModuleNt GUI C++ Classes

List of all members, including inherited members

Public Functions

QCursor()
QCursor(Qt::CursorShape shape)
Qt::CursorShapeshape() const
voidsetShape(Qt::CursorShape newShape)
voidswap(QCursor &other)

Static Public Members

QPointpos()
QPointpos(const QScreen *screen)
voidsetPos(int x, int y)
voidsetPos(const QPoint &p)
voidsetPos(QScreen *screen, int x, int y)
voidsetPos(QScreen *screen, const QPoint &p)

Detailed Description

A QCursor says what the mouse cursor looks like. Give one to QWidget::setCursor() or QWindow::setCursor() for the cursor over a widget or a window, or to QGuiApplication::setOverrideCursor() for the whole application, while it is busy for example:

label->setCursor(Qt::PointingHandCursor);

QGuiApplication::setOverrideCursor(Qt::WaitCursor);
loadEverything();
QGuiApplication::restoreOverrideCursor();

The static functions pos() and setPos() read and move the cursor of the screen.

See also QWidget::setCursor() and QGuiApplication::setOverrideCursor().

Differences from Qt

A cursor has one of the shapes of Qt::CursorShape: there are no cursors made of a pixmap or a bitmap, and so no pixmap(), bitmap(), mask() or hotSpot(). On X11 the shapes are those of the cursor font of the X server, not those of the cursor theme of the desktop; shapes that the font does not have are shown as the nearest one that it has. With the offscreen platform, pos() is where setPos() or the last mouse event put the cursor.

Member Function Documentation

QCursor::QCursor()

Constructs a cursor with the shape of the standard arrow.

QCursor::QCursor(Qt::CursorShape shape)

Constructs a cursor with the shape shape.

[static] QPoint QCursor::pos()

Returns the position of the mouse cursor, in the coordinates of the desktop.

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

[static] QPoint QCursor::pos(const QScreen *screen)

This is an overloaded function.

Returns the position of the mouse cursor. Nt has one desktop, so screen makes no difference.

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

Moves the mouse cursor to the position (x, y) of the desktop. Moving the cursor away from where the user put it is rarely welcome.

See also pos().

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

This is an overloaded function.

Moves the mouse cursor to the position p of the desktop.

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

This is an overloaded function.

Moves the mouse cursor to (x, y). Nt has one desktop, so screen makes no difference.

[static] void QCursor::setPos(QScreen *screen, const QPoint &p)

This is an overloaded function.

Moves the mouse cursor to p; screen makes no difference.

void QCursor::setShape(Qt::CursorShape newShape)

Sets the shape of the cursor to newShape.

See also shape().

Qt::CursorShape QCursor::shape() const

Returns the shape of the cursor.

See also setShape().

void QCursor::swap(QCursor &other)

Swaps this cursor with other.