Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1007

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/kernel/qcursor.cpp:48 -->
<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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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 arbitrary shape.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qcursor-h.html">qcursor.h</a>&gt;</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&nbsp;shape )</div></li>
<li><div class=fn><a href="#QCursor-3"><b>QCursor</b></a> ( const&nbsp;QBitmap&nbsp;&amp;&nbsp;bitmap, const&nbsp;QBitmap&nbsp;&amp;&nbsp;mask, int&nbsp;hotX = -1, int&nbsp;hotY = -1 )</div></li>
<li><div class=fn><a href="#QCursor-4"><b>QCursor</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, int&nbsp;hotX = -1, int&nbsp;hotY = -1 )</div></li>
<li><div class=fn><a href="#QCursor-5"><b>QCursor</b></a> ( const&nbsp;QCursor&nbsp;&amp;&nbsp;c )</div></li>
<li><div class=fn><a href="#~QCursor"><b>~QCursor</b></a> ()</div></li>
<li><div class=fn>QCursor &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QCursor&nbsp;&amp;&nbsp;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&nbsp;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&nbsp;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&nbsp;x, int&nbsp;y )</div></li>
<li><div class=fn>void <a href="#setPos-2"><b>setPos</b></a> ( const QPoint &amp; )</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 &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, const&nbsp;QCursor&nbsp;&amp;&nbsp;c )</div></li>
<li><div class=fn>QDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, QCursor&nbsp;&amp;&nbsp;c )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


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

<p> 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.
<p> Qt has a number of standard cursor shapes, but you can also make
custom 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>().  To
associate a cursor with all widgets (normally for a short period of
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 QCursor constructor
which takes the shape as argument, or you can use one of 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 use the
QCursor constructor which takes a bitmap and a mask or the
constructor which takes a pixmap as arguments.
<p> To set or get the position of the mouse cursor use the static methods
<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&nbsp;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&nbsp;<a href="qbitmap.html">QBitmap</a>&nbsp;&amp;&nbsp;bitmap, const&nbsp;<a href="qbitmap.html">QBitmap</a>&nbsp;&amp;&nbsp;mask, int&nbsp;hotX = -1, int&nbsp;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 hot spot of this cursor.
<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 this way:
<ol>
<li> B=1 and M=1 gives black.
<li> B=0 and M=1 gives white.
<li> B=0 and M=0 gives transparency.
<li> B=1 and M=0 gives an undefined result.
</ol>
<p> Use the global color <tt>color0</tt> to draw 0-pixels and <tt>color1</tt> to draw
1-pixels in the bitmaps.
<p> 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.
<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&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, int&nbsp;hotX = -1, int&nbsp;hotY = -1 )
</h3> Constructs a custom pixmap cursor.
<p> <em>pixmap</em> is the image
(usually it should have a mask (set using <a href="qpixmap.html#setMask">QPixmap::setMask</a>())
<em>hotX</em> and
<em>hotY</em> define the hot spot of this cursor.
<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 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.
<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&nbsp;<a href="qcursor.html">QCursor</a>&nbsp;&amp;&nbsp;c )
</h3>
Constructs a copy of the cursor <em>c</em>.

<h3 class=fn><a name="QCursor-6"></a>QCursor::QCursor ( HCURSOR&nbsp;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 to do
something non-portable. Be careful.

<h3 class=fn><a name="~QCursor"></a>QCursor::~QCursor ()
</h3>
Destroys the cursor.

<h3 class=fn>const&nbsp;<a href="qbitmap.html">QBitmap</a>&nbsp;* <a name="bitmap"></a>QCursor::bitmap () const
</h3>
Returns the cursor bitmap, or 0 if it is one of the standard cursors.

<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>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 to do
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 the standard 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>See also <a href="#cleanup">cleanup</a>().

<h3 class=fn>const&nbsp;<a href="qbitmap.html">QBitmap</a>&nbsp;* <a name="mask"></a>QCursor::mask () const
</h3>
Returns the cursor bitmap mask, or 0 if it is one of the standard cursors.

<h3 class=fn><a href="qcursor.html">QCursor</a>&nbsp;&amp; <a name="operator-eq"></a>QCursor::operator= ( const&nbsp;<a href="qcursor.html">QCursor</a>&nbsp;&amp;&nbsp;c )
</h3>
Assigns <em>c</em> to this cursor and returns a reference to this cursor.

<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 screen
coordinates.
<p> You can call <a href="qwidget.html#mapFromGlobal">QWidget::mapFromGlobal</a>() to translate it to widget
coordinates.
<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>Example: <a href="fileiconview-example.html#x1523">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn>void <a name="setPos"></a>QCursor::setPos ( int&nbsp;x, int&nbsp;y )<tt> [static]</tt>
</h3>
Moves the cursor (hot spot) to the global screen position <em>x</em> and <em>y</em>.
<p> You can call <a href="qwidget.html#mapToGlobal">QWidget::mapToGlobal</a>() to translate widget coordinates
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&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; )<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&nbsp;shape )
</h3>
Sets the cursor to the shape identified by <em>shape</em>.
<p> See <a href="qt.html#CursorShape-enum">CursorShape</a> for a list of 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 of
following values (casted to an int).
<p> See <a href="qt.html#CursorShape-enum">CursorShape</a> for a list of shapes.
<p> <p>See also <a href="#setShape">setShape</a>().

<hr><h2>Related Functions</h2>
<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="qcursor.html">QCursor</a>&nbsp;&amp;&nbsp;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>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, <a href="qcursor.html">QCursor</a>&nbsp;&amp;&nbsp;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 &copy; 1995-2001
<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 &copy; 2001 
<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.2</div>
</table></div></address></body>
</html>