'\" t .TH TQCursor 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. .\" .ad l .nh .SH NAME TQCursor \- Mouse cursor with an arbitrary shape .SH SYNOPSIS \fC#include \fR .PP Inherits Qt. .PP .SS "Public Members" .in +1c .ti -1c .BI "\fBTQCursor\fR ()" .br .ti -1c .BI "\fBTQCursor\fR ( int shape )" .br .ti -1c .BI "\fBTQCursor\fR ( const TQBitmap & bitmap, const TQBitmap & mask, int hotX = -1, int hotY = -1 )" .br .ti -1c .BI "\fBTQCursor\fR ( const TQPixmap & pixmap, int hotX = -1, int hotY = -1 )" .br .ti -1c .BI "\fBTQCursor\fR ( const TQCursor & c )" .br .ti -1c .BI "\fB~TQCursor\fR ()" .br .ti -1c .BI "TQCursor & \fBoperator=\fR ( const TQCursor & c )" .br .ti -1c .BI "int \fBshape\fR () const" .br .ti -1c .BI "void \fBsetShape\fR ( int shape )" .br .ti -1c .BI "const TQBitmap * \fBbitmap\fR () const" .br .ti -1c .BI "const TQBitmap * \fBmask\fR () const" .br .ti -1c .BI "TQPoint \fBhotSpot\fR () const" .br .ti -1c .BI "HCURSOR \fBhandle\fR () const" .br .ti -1c .BI "\fBTQCursor\fR ( HCURSOR handle )" .br .ti -1c .BI "HANDLE \fBhandle\fR () const" .br .in -1c .SS "Static Public Members" .in +1c .ti -1c .BI "TQPoint \fBpos\fR ()" .br .ti -1c .BI "void \fBsetPos\fR ( int x, int y )" .br .ti -1c .BI "void \fBsetPos\fR ( const TQPoint & )" .br .ti -1c .BI "void \fBinitialize\fR ()" .br .ti -1c .BI "void \fBcleanup\fR ()" .br .in -1c .SH RELATED FUNCTION DOCUMENTATION .in +1c .ti -1c .BI "TQDataStream & \fBoperator<<\fR ( TQDataStream & s, const TQCursor & c )" .br .ti -1c .BI "TQDataStream & \fBoperator>>\fR ( TQDataStream & s, TQCursor & c )" .br .in -1c .SH DESCRIPTION The TQCursor 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 TQBitmap, a mask and a hotspot. .PP To associate a cursor with a widget, use TQWidget::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 TQCursor::setShape() or use the TQCursor 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 TQCursor 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 TQCursor::pos() and TQCursor::setPos(). .PP
.ce 1 .B "[Image Omitted]" .PP
.PP See also TQWidget, GUI Design Handbook: Cursors, Widget Appearance and Style, and Implicitly and Explicitly Shared Classes. .PP On X11, TQt supports the Xcursor library, which allows for full color icon themes. The table below shows the cursor name used for each TQt::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 TQt::CursorShape values. It is possible that some cursors will be taken from the Xcursor theme, while others will use an internal bitmap cursor. .PP
.nf .TS l - l. TQt::CursorShape Values Cursor Names TQt::ArrowCursor left_ptr TQt::UpArrowCursor up_arrow TQt::CrossCursor cross TQt::WaitCursor wait TQt::BusyCursor left_ptr_watch TQt::IbeamCursor ibeam TQt::SizeVerCursor size_ver TQt::SizeHorCursor size_hor TQt::SizeBDiagCursor size_bdiag TQt::SizeFDiagCursor size_fdiag TQt::SizeAllCursor size_all TQt::SplitVCursor split_v TQt::SplitHCursor split_h TQt::PointingHandCursor pointing_hand TQt::ForbiddenCursor forbidden TQt::WhatsThisCursor .TE .fi
.SH MEMBER FUNCTION DOCUMENTATION .SH "TQCursor::TQCursor ()" Constructs a cursor with the default arrow shape. .SH "TQCursor::TQCursor ( int shape )" Constructs a cursor with the specified \fIshape\fR. .PP See CursorShape for a list of shapes. .PP See also setShape(). .SH "TQCursor::TQCursor ( const TQBitmap & bitmap, const TQBitmap & mask, int hotX = -1, int hotY = -1 )" Constructs a custom bitmap cursor. .PP \fIbitmap\fR and \fImask\fR make up the bitmap. \fIhotX\fR and \fIhotY\fR define the cursor's hot spot. .PP If \fIhotX\fR is negative, it is set to the \fCbitmap().width()/2\fR. If \fIhotY\fR is negative, it is set to the \fCbitmap().height()/2\fR. .PP The cursor \fIbitmap\fR (B) and \fImask\fR (M) bits are combined like this: .TP B=1 and M=1 gives black. .TP B=0 and M=1 gives white. .TP B=0 and M=0 gives transparent. .TP B=1 and M=0 gives an undefined result. .PP Use the global TQt color \fCcolor0\fR to draw 0-pixels and \fCcolor1\fR to draw 1-pixels in the bitmaps. .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 See also TQBitmap::TQBitmap() and TQBitmap::setMask(). .SH "TQCursor::TQCursor ( const TQPixmap & 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 TQPixmap::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 TQPixmap::TQPixmap() and TQPixmap::setMask(). .SH "TQCursor::TQCursor ( const TQCursor & c )" Constructs a copy of the cursor \fIc\fR. .SH "TQCursor::TQCursor ( 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 "TQCursor::~TQCursor ()" Destroys the cursor. .SH "const TQBitmap * TQCursor::bitmap () const" Returns the cursor bitmap, or 0 if it is one of the standard cursors. .SH "void TQCursor::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 TQCursor::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 "TQPoint TQCursor::hotSpot () const" Returns the cursor hot spot, or (0, 0) if it is one of the standard cursors. .SH "void TQCursor::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 TQBitmap * TQCursor::mask () const" Returns the cursor bitmap mask, or 0 if it is one of the standard cursors. .SH "TQCursor & TQCursor::operator= ( const TQCursor & c )" Assigns \fIc\fR to this cursor and returns a reference to this cursor. .SH "TQPoint TQCursor::pos ()\fC [static]\fR" Returns the position of the cursor (hot spot) in global screen coordinates. .PP You can call TQWidget::mapFromGlobal() to translate it to widget coordinates. .PP See also setPos(), TQWidget::mapFromGlobal(), and TQWidget::mapToGlobal(). .PP Examples: .)l chart/canvasview.cpp, fileiconview/tqfileiconview.cpp, and menu/menu.cpp. .SH "void TQCursor::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 TQWidget::mapToGlobal() to translate widget coordinates to global screen coordinates. .PP See also pos(), TQWidget::mapFromGlobal(), and TQWidget::mapToGlobal(). .SH "void TQCursor::setPos ( const TQPoint & )\fC [static]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .SH "void TQCursor::setShape ( int shape )" Sets the cursor to the shape identified by \fIshape\fR. .PP See CursorShape for the list of cursor shapes. .PP See also shape(). .SH "int TQCursor::shape () const" Returns the cursor shape identifier. The return value is one of the CursorShape enum values (cast to an int). .PP See also setShape(). .SH RELATED FUNCTION DOCUMENTATION .SH "TQDataStream & operator<< ( TQDataStream & s, const TQCursor & c )" Writes the cursor \fIc\fR to the stream \fIs\fR. .PP See also Format of the TQDataStream operators. .SH "TQDataStream & operator>> ( TQDataStream & s, TQCursor & c )" Reads a cursor from the stream \fIs\fR and sets \fIc\fR to the read data. .PP See also Format of the TQDataStream operators. .SH "SEE ALSO" .BR http://doc.trolltech.com/tqcursor.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. .SH AUTHOR Generated automatically from the source code. .SH BUGS If you find a bug in Qt, please report it as described in .BR http://doc.trolltech.com/bughowto.html . Good bug reports help us to help you. Thank you. .P The definitive TQt documentation is provided in HTML format; it is located at $TQTDIR/doc/html and can be read using TQt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. .P If you find errors in this manual page, please report them to .BR qt-bugs@trolltech.com . Please include the name of the manual page (tqcursor.3qt) and the Qt version (3.3.8).