qcursor.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 260 行
HTML
260 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/kernel/qcursor.cpp:47 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QCursor Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QCursor Class Reference</h1><p>The QCursor class provides a mouse cursor with an arbitraryshape.<a href="#details">More...</a><p><tt>#include <<a href="qcursor-h.html">qcursor.h</a>></tt><p>Inherits <a href="qt.html">Qt</a>.<p><a href="qcursor-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QCursor"><b>QCursor</b></a> ()</div></li><li><div class=fn><a href="#QCursor-2"><b>QCursor</b></a> ( int shape )</div></li><li><div class=fn><a href="#QCursor-3"><b>QCursor</b></a> ( const QBitmap & bitmap, const QBitmap & mask, int hotX = -1, int hotY = -1 )</div></li><li><div class=fn><a href="#QCursor-4"><b>QCursor</b></a> ( const QPixmap & pixmap, int hotX = -1, int hotY = -1 )</div></li><li><div class=fn><a href="#QCursor-5"><b>QCursor</b></a> ( const QCursor & c )</div></li><li><div class=fn><a href="#~QCursor"><b>~QCursor</b></a> ()</div></li><li><div class=fn>QCursor & <a href="#operator-eq"><b>operator=</b></a> ( const QCursor & c )</div></li><li><div class=fn>int <a href="#shape"><b>shape</b></a> () const</div></li><li><div class=fn>void <a href="#setShape"><b>setShape</b></a> ( int shape )</div></li><li><div class=fn>const QBitmap * <a href="#bitmap"><b>bitmap</b></a> () const</div></li><li><div class=fn>const QBitmap * <a href="#mask"><b>mask</b></a> () const</div></li><li><div class=fn>QPoint <a href="#hotSpot"><b>hotSpot</b></a> () const</div></li><li><div class=fn>HCURSOR <b>handle</b> () const</div></li><li><div class=fn><a href="#QCursor-6"><b>QCursor</b></a> ( HCURSOR handle )</div></li><li><div class=fn>HANDLE <a href="#handle"><b>handle</b></a> () const</div></li></ul><h2>Static Public Members</h2><ul><li><div class=fn>QPoint <a href="#pos"><b>pos</b></a> ()</div></li><li><div class=fn>void <a href="#setPos"><b>setPos</b></a> ( int x, int y )</div></li><li><div class=fn>void <a href="#setPos-2"><b>setPos</b></a> ( const QPoint & )</div></li><li><div class=fn>void <a href="#initialize"><b>initialize</b></a> ()</div></li><li><div class=fn>void <a href="#cleanup"><b>cleanup</b></a> ()</div></li></ul><h2>Related Functions</h2><ul><li><div class=fn>QDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( QDataStream & s, const QCursor & c )</div></li><li><div class=fn>QDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( QDataStream & s, QCursor & c )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2><p> The QCursor class provides a mouse cursor with an arbitraryshape.<p> <p> This class is mainly used to create mouse cursors that areassociated with particular widgets and to get and set the positionof the mouse cursor.<p> Qt has a number of standard cursor shapes, but you can also makecustom cursor shapes based on a <a href="qbitmap.html">QBitmap</a>, a mask and a hotspot.<p> To associate a cursor with a widget, use <a href="qwidget.html#setCursor">QWidget::setCursor</a>(). Toassociate a cursor with all widgets (normally for a short periodof time), use <a href="qapplication.html#setOverrideCursor">QApplication::setOverrideCursor</a>().<p> To set a cursor shape use <a href="#setShape">QCursor::setShape</a>() or use the QCursorconstructor which takes the shape as argument, or you can use oneof the predefined cursors defined in the <a href="qt.html#CursorShape-enum">CursorShape</a> enum.<p> If you want to create a cursor with your own bitmap, either usethe QCursor constructor which takes a bitmap and a mask or theconstructor which takes a pixmap as arguments.<p> To set or get the position of the mouse cursor use the staticmethods <a href="#pos">QCursor::pos</a>() and <a href="#setPos">QCursor::setPos</a>().<p> <center><img src="cursors.png" alt="Cursor Shapes"></center> <p> <p>See also <a href="qwidget.html">QWidget</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Cursors</a>, <a href="appearance.html">Widget Appearance and Style</a> and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QCursor"></a>QCursor::QCursor ()</h3>Constructs a cursor with the default arrow shape.<h3 class=fn><a name="QCursor-2"></a>QCursor::QCursor ( int shape )</h3>Constructs a cursor with the specified <em>shape</em>.<p> See <a href="qt.html#CursorShape-enum">CursorShape</a> for a list of shapes.<p> <p>See also <a href="#setShape">setShape</a>().<h3 class=fn><a name="QCursor-3"></a>QCursor::QCursor ( const <a href="qbitmap.html">QBitmap</a> & bitmap, const <a href="qbitmap.html">QBitmap</a> & mask, int hotX = -1, int hotY = -1 )</h3>Constructs a custom bitmap cursor.<p> <em>bitmap</em> and<em>mask</em> make up the bitmap.<em>hotX</em> and<em>hotY</em> define the cursor's hot spot.<p> If <em>hotX</em> is negative, it is set to the <tt>bitmap().width()/2</tt>.If <em>hotY</em> is negative, it is set to the <tt>bitmap().height()/2</tt>.<p> The cursor <em>bitmap</em> (B) and <em>mask</em> (M) bits are combined like this:<ul><li> B=1 and M=1 gives black.<li> B=0 and M=1 gives white.<li> B=0 and M=0 gives transparent.<li> B=1 and M=0 gives an undefined result.</ul><p> Use the global color <tt>color0</tt> to draw 0-pixels and <tt>color1</tt> todraw 1-pixels in the bitmaps.<p> Valid cursor sizes depend on the display hardware (or theunderlying window system). We recommend using 32x32 cursors,because this size is supported on all platforms. Some platformsalso support 16x16, 48x48 and 64x64 cursors.<p> <p>See also <a href="qbitmap.html#QBitmap">QBitmap::QBitmap</a>() and <a href="qpixmap.html#setMask">QBitmap::setMask</a>().<h3 class=fn><a name="QCursor-4"></a>QCursor::QCursor ( const <a href="qpixmap.html">QPixmap</a> & pixmap, int hotX = -1, int hotY = -1 )</h3>Constructs a custom pixmap cursor.<p> <em>pixmap</em> is the image. It is usual to give it a mask (set using<a href="qpixmap.html#setMask">QPixmap::setMask</a>()). <em>hotX</em> and <em>hotY</em> define the cursor's hotspot.<p> If <em>hotX</em> is negative, it is set to the <tt>pixmap().width()/2</tt>.If <em>hotY</em> is negative, it is set to the <tt>pixmap().height()/2</tt>.<p> Valid cursor sizes depend on the display hardware (or theunderlying window system). We recommend using 32x32 cursors,because this size is supported on all platforms. Some platformsalso support 16x16, 48x48 and 64x64 cursors.<p> Currently, only black-and-white pixmaps can be used.<p> <p>See also <a href="qpixmap.html#QPixmap">QPixmap::QPixmap</a>() and <a href="qpixmap.html#setMask">QPixmap::setMask</a>().<h3 class=fn><a name="QCursor-5"></a>QCursor::QCursor ( const <a href="qcursor.html">QCursor</a> & c )</h3>Constructs a copy of the cursor <em>c</em>.<h3 class=fn><a name="QCursor-6"></a>QCursor::QCursor ( HCURSOR handle )</h3><p> Creates a cursor with the specified window system handle <em>handle</em>.<p> <b>Warning:</b>Portable in principle, but if you use it you are probably about todo something non-portable. Be careful.<h3 class=fn><a name="~QCursor"></a>QCursor::~QCursor ()</h3>Destroys the cursor.<h3 class=fn>const <a href="qbitmap.html">QBitmap</a> * <a name="bitmap"></a>QCursor::bitmap () const</h3>Returns the cursor bitmap, or 0 if it is one of the standardcursors.<h3 class=fn>void <a name="cleanup"></a>QCursor::cleanup ()<tt> [static]</tt></h3>Internal function that deinitializes the predefined cursors.This function is called from the <a href="qapplication.html">QApplication</a> destructor.<p> <p>See also <a href="#initialize">initialize</a>().<h3 class=fn>HANDLE <a name="handle"></a>QCursor::handle () const</h3>Returns the window system cursor handle.<p> <b>Warning:</b>Portable in principle, but if you use it you are probably about todo something non-portable. Be careful.<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="hotSpot"></a>QCursor::hotSpot () const</h3>Returns the cursor hot spot, or (0, 0) if it is one of thestandard cursors.<h3 class=fn>void <a name="initialize"></a>QCursor::initialize ()<tt> [static]</tt></h3>Internal function that initializes the predefined cursors.This function is called from the <a href="qapplication.html">QApplication</a> constructor.<p> <p>See also <a href="#cleanup">cleanup</a>().<h3 class=fn>const <a href="qbitmap.html">QBitmap</a> * <a name="mask"></a>QCursor::mask () const</h3>Returns the cursor bitmap mask, or 0 if it is one of the standardcursors.<h3 class=fn><a href="qcursor.html">QCursor</a> & <a name="operator-eq"></a>QCursor::operator= ( const <a href="qcursor.html">QCursor</a> & c )</h3>Assigns <em>c</em> to this cursor and returns a reference to thiscursor.<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="pos"></a>QCursor::pos ()<tt> [static]</tt></h3>Returns the position of the cursor (hot spot) in global screencoordinates.<p> You can call <a href="qwidget.html#mapFromGlobal">QWidget::mapFromGlobal</a>() to translate it to widgetcoordinates.<p> <p>See also <a href="#setPos">setPos</a>(), <a href="qwidget.html#mapFromGlobal">QWidget::mapFromGlobal</a>() and <a href="qwidget.html#mapToGlobal">QWidget::mapToGlobal</a>().<p>Examples: <a href="tutorial2-06.html#x2484">chart/canvasview.cpp</a> and <a href="fileiconview-example.html#x806">fileiconview/qfileiconview.cpp</a>.<h3 class=fn>void <a name="setPos"></a>QCursor::setPos ( int x, int y )<tt> [static]</tt></h3>Moves the cursor (hot spot) to the global screen position (<em>x</em>,<em>y</em>).<p> You can call <a href="qwidget.html#mapToGlobal">QWidget::mapToGlobal</a>() to translate widgetcoordinates to global screen coordinates.<p> <p>See also <a href="#pos">pos</a>(), <a href="qwidget.html#mapFromGlobal">QWidget::mapFromGlobal</a>() and <a href="qwidget.html#mapToGlobal">QWidget::mapToGlobal</a>().<h3 class=fn>void <a name="setPos-2"></a>QCursor::setPos ( const <a href="qpoint.html">QPoint</a> & )<tt> [static]</tt></h3>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.<p> <h3 class=fn>void <a name="setShape"></a>QCursor::setShape ( int shape )</h3>Sets the cursor to the shape identified by <em>shape</em>.<p> See <a href="qt.html#CursorShape-enum">CursorShape</a> for the list of cursor shapes.<p> <p>See also <a href="#shape">shape</a>().<h3 class=fn>int <a name="shape"></a>QCursor::shape () const</h3>Returns the cursor shape identifier. The return value is one ofthe <a href="qt.html#CursorShape-enum">CursorShape</a> enum values (cast to an int).<p> <p>See also <a href="#setShape">setShape</a>().<hr><h2>Related Functions</h2><h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">QDataStream</a> & s, const <a href="qcursor.html">QCursor</a> & c )</h3>Writes the cursor <em>c</em> to the stream <em>s</em>.<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.<h3 class=fn><a href="qdatastream.html">QDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">QDataStream</a> & s, <a href="qcursor.html">QCursor</a> & c )</h3>Reads a cursor from the stream <em>s</em> and sets <em>c</em> to the read data.<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright © 1995-2002<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright © 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?