You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
481 lines
26 KiB
481 lines
26 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/canvas/tqcanvas.cpp:1843 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQCanvasItem Class</title>
|
|
<style type="text/css"><!--
|
|
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>TQCanvasItem Class Reference<br><small>[<a href="canvas.html">canvas module</a>]</small></h1>
|
|
|
|
<p>The TQCanvasItem class provides an abstract graphic object on a TQCanvas.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="tqcanvas-h.html">tqcanvas.h</a>></tt>
|
|
<p>Inherits <a href="tqt.html">TQt</a>.
|
|
<p>Inherited by <a href="tqcanvassprite.html">TQCanvasSprite</a>, <a href="tqcanvaspolygonalitem.html">TQCanvasPolygonalItem</a>, and <a href="tqcanvastext.html">TQCanvasText</a>.
|
|
<p><a href="tqcanvasitem-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQCanvasItem"><b>TQCanvasItem</b></a> ( TQCanvas * canvas )</li>
|
|
<li class=fn>virtual <a href="#~TQCanvasItem"><b>~TQCanvasItem</b></a> ()</li>
|
|
<li class=fn>double <a href="#x"><b>x</b></a> () const</li>
|
|
<li class=fn>double <a href="#y"><b>y</b></a> () const</li>
|
|
<li class=fn>double <a href="#z"><b>z</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#moveBy"><b>moveBy</b></a> ( double dx, double dy )</li>
|
|
<li class=fn>void <a href="#move"><b>move</b></a> ( double x, double y )</li>
|
|
<li class=fn>void <a href="#setX"><b>setX</b></a> ( double x )</li>
|
|
<li class=fn>void <a href="#setY"><b>setY</b></a> ( double y )</li>
|
|
<li class=fn>void <a href="#setZ"><b>setZ</b></a> ( double z )</li>
|
|
<li class=fn>bool <a href="#animated"><b>animated</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setAnimated"><b>setAnimated</b></a> ( bool y )</li>
|
|
<li class=fn>virtual void <a href="#setVelocity"><b>setVelocity</b></a> ( double vx, double vy )</li>
|
|
<li class=fn>void <a href="#setXVelocity"><b>setXVelocity</b></a> ( double vx )</li>
|
|
<li class=fn>void <a href="#setYVelocity"><b>setYVelocity</b></a> ( double vy )</li>
|
|
<li class=fn>double <a href="#xVelocity"><b>xVelocity</b></a> () const</li>
|
|
<li class=fn>double <a href="#yVelocity"><b>yVelocity</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#advance"><b>advance</b></a> ( int phase )</li>
|
|
<li class=fn>virtual bool <a href="#collidesWith"><b>collidesWith</b></a> ( const TQCanvasItem * other ) const = 0</li>
|
|
<li class=fn>TQCanvasItemList <a href="#collisions"><b>collisions</b></a> ( bool exact ) const</li>
|
|
<li class=fn>virtual void <a href="#setCanvas"><b>setCanvas</b></a> ( TQCanvas * c )</li>
|
|
<li class=fn>virtual void <a href="#draw"><b>draw</b></a> ( TQPainter & painter ) = 0</li>
|
|
<li class=fn>void <a href="#show"><b>show</b></a> ()</li>
|
|
<li class=fn>void <a href="#hide"><b>hide</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#setVisible"><b>setVisible</b></a> ( bool yes )</li>
|
|
<li class=fn>bool <a href="#isVisible"><b>isVisible</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( bool yes )</li>
|
|
<li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setEnabled"><b>setEnabled</b></a> ( bool yes )</li>
|
|
<li class=fn>bool <a href="#isEnabled"><b>isEnabled</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setActive"><b>setActive</b></a> ( bool yes )</li>
|
|
<li class=fn>bool <a href="#isActive"><b>isActive</b></a> () const</li>
|
|
<li class=fn>bool visible () const <em>(obsolete)</em></li>
|
|
<li class=fn>bool selected () const <em>(obsolete)</em></li>
|
|
<li class=fn>bool enabled () const <em>(obsolete)</em></li>
|
|
<li class=fn>bool active () const <em>(obsolete)</em></li>
|
|
<li class=fn>enum <a href="#RttiValues-enum"><b>RttiValues</b></a> { Rtti_Item = 0, Rtti_Sprite = 1, Rtti_PolygonalItem = 2, Rtti_Text = 3, Rtti_Polygon = 4, Rtti_Rectangle = 5, Rtti_Ellipse = 6, Rtti_Line = 7, Rtti_Spline = 8 }</li>
|
|
<li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li>
|
|
<li class=fn>virtual TQRect <a href="#boundingRect"><b>boundingRect</b></a> () const = 0</li>
|
|
<li class=fn>virtual TQRect <a href="#boundingRectAdvanced"><b>boundingRectAdvanced</b></a> () const</li>
|
|
<li class=fn>TQCanvas * <a href="#canvas"><b>canvas</b></a> () const</li>
|
|
</ul>
|
|
<h2>Protected Members</h2>
|
|
<ul>
|
|
<li class=fn>void <a href="#update"><b>update</b></a> ()</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The TQCanvasItem class provides an abstract graphic object on a <a href="tqcanvas.html">TQCanvas</a>.
|
|
|
|
<p>
|
|
|
|
|
|
<p> A variety of TQCanvasItem subclasses provide immediately usable
|
|
behaviour. This class is a pure abstract superclass providing the
|
|
behaviour that is shared among all the concrete canvas item classes.
|
|
TQCanvasItem is not intended for direct subclassing. It is much easier
|
|
to subclass one of its subclasses, e.g. <a href="tqcanvaspolygonalitem.html">TQCanvasPolygonalItem</a> (the
|
|
commonest base class), <a href="tqcanvasrectangle.html">TQCanvasRectangle</a>, <a href="tqcanvassprite.html">TQCanvasSprite</a>, <a href="tqcanvasellipse.html">TQCanvasEllipse</a>
|
|
or <a href="tqcanvastext.html">TQCanvasText</a>.
|
|
<p> Canvas items are added to a canvas by constructing them and passing the
|
|
canvas to the canvas item's constructor. An item can be moved to a
|
|
different canvas using <a href="#setCanvas">setCanvas</a>().
|
|
<p> Items appear on the canvas after their <a href="#show">show()</a>
|
|
function has been called (or <a href="#setVisible">setVisible(TRUE)</a>), and <em>after</em> <a href="#update">update</a>() has been called. The
|
|
canvas only shows items that are <a href="#setVisible">visible</a>,
|
|
and then only if <a href="#update">update</a>() is called. If you created the canvas
|
|
without passing a width and height to the constructor you'll also need
|
|
to call <a href="tqcanvas.html#resize">resize()</a>. Since the canvas
|
|
background defaults to white and canvas items default to white,
|
|
you may need to change colors to see your items.
|
|
<p> A TQCanvasItem object can be moved in the <a href="#x">x</a>(), <a href="#y">y</a>() and <a href="#z">z</a>() dimensions
|
|
using functions such as <a href="#move">move</a>(), <a href="#moveBy">moveBy</a>(), <a href="#setX">setX</a>(), <a href="#setY">setY</a>() and <a href="#setZ">setZ</a>(). A
|
|
canvas item can be set in motion, `animated', using <a href="#setAnimated">setAnimated</a>() and
|
|
given a velocity in the x and y directions with <a href="#setXVelocity">setXVelocity</a>() and
|
|
<a href="#setYVelocity">setYVelocity</a>() -- the same effect can be achieved by calling
|
|
<a href="#setVelocity">setVelocity</a>(). Use the <a href="#collidesWith">collidesWith</a>() function to see if the canvas item
|
|
will collide on the <em>next</em> <a href="#advance">advance</a>(1) and use <a href="#collisions">collisions</a>() to see what
|
|
collisions have occurred.
|
|
<p> Use <a href="tqcanvassprite.html">TQCanvasSprite</a> or your own subclass of TQCanvasSprite to create canvas
|
|
items which are animated, i.e. which change over time.
|
|
<p> The size of a canvas item is given by <a href="#boundingRect">boundingRect</a>(). Use
|
|
<a href="#boundingRectAdvanced">boundingRectAdvanced</a>() to see what the size of the canvas item will be
|
|
<em>after</em> the next advance(1) call.
|
|
<p> The <a href="#rtti">rtti</a>() function is used for identifying subclasses of TQCanvasItem.
|
|
The <a href="#canvas">canvas</a>() function returns a pointer to the canvas which contains the
|
|
canvas item.
|
|
<p> TQCanvasItem provides the <a href="#show">show</a>() and <a href="#isVisible">isVisible</a>() functions like those in
|
|
<a href="tqwidget.html">TQWidget</a>.
|
|
<p> TQCanvasItem also provides the <a href="#setEnabled">setEnabled</a>(), <a href="#setActive">setActive</a>() and
|
|
<a href="#setSelected">setSelected</a>() functions; these functions set the relevant boolean and
|
|
cause a repaint but the boolean values they set are not used in
|
|
TQCanvasItem itself. You can make use of these booleans in your subclasses.
|
|
<p> By default, canvas items have no velocity, no size, and are not in
|
|
motion. The subclasses provided in TQt do not change these defaults
|
|
except where noted.
|
|
<p> <p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>.
|
|
|
|
<hr><h2>Member Type Documentation</h2>
|
|
<h3 class=fn><a name="RttiValues-enum"></a>TQCanvasItem::RttiValues</h3>
|
|
|
|
<p> This enum is used to name the different types of canvas item.
|
|
<ul>
|
|
<li><tt>TQCanvasItem::Rtti_Item</tt> - Canvas item abstract base class
|
|
<li><tt>TQCanvasItem::Rtti_Ellipse</tt>
|
|
<li><tt>TQCanvasItem::Rtti_Line</tt>
|
|
<li><tt>TQCanvasItem::Rtti_Polygon</tt>
|
|
<li><tt>TQCanvasItem::Rtti_PolygonalItem</tt>
|
|
<li><tt>TQCanvasItem::Rtti_Rectangle</tt>
|
|
<li><tt>TQCanvasItem::Rtti_Spline</tt>
|
|
<li><tt>TQCanvasItem::Rtti_Sprite</tt>
|
|
<li><tt>TQCanvasItem::Rtti_Text</tt>
|
|
</ul><p>
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQCanvasItem"></a>TQCanvasItem::TQCanvasItem ( <a href="tqcanvas.html">TQCanvas</a> * canvas )
|
|
</h3>
|
|
Constructs a TQCanvasItem on canvas <em>canvas</em>.
|
|
<p> <p>See also <a href="#setCanvas">setCanvas</a>().
|
|
|
|
<h3 class=fn><a name="~TQCanvasItem"></a>TQCanvasItem::~TQCanvasItem ()<tt> [virtual]</tt>
|
|
</h3>
|
|
Destroys the TQCanvasItem and removes it from its canvas.
|
|
|
|
<h3 class=fn>bool <a name="active"></a>TQCanvasItem::active () const
|
|
</h3>
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p>
|
|
Use <a href="#isActive">isActive</a>() instead.
|
|
|
|
<h3 class=fn>void <a name="advance"></a>TQCanvasItem::advance ( int phase )<tt> [virtual]</tt>
|
|
</h3>
|
|
The default implementation moves the canvas item, if it is
|
|
<a href="#animated">animated</a>(), by the preset velocity if <em>phase</em> is 1, and does
|
|
nothing if <em>phase</em> is 0.
|
|
<p> Note that if you reimplement this function, the reimplementation
|
|
must not change the canvas in any way, for example it must not add
|
|
or remove items.
|
|
<p> <p>See also <a href="tqcanvas.html#advance">TQCanvas::advance</a>() and <a href="#setVelocity">setVelocity</a>().
|
|
|
|
<p>Example: <a href="canvas-example.html#x2913">canvas/canvas.cpp</a>.
|
|
<p>Reimplemented in <a href="tqcanvassprite.html#advance">TQCanvasSprite</a>.
|
|
<h3 class=fn>bool <a name="animated"></a>TQCanvasItem::animated () const
|
|
</h3>
|
|
Returns TRUE if the canvas item is in motion; otherwise returns
|
|
FALSE.
|
|
<p> <p>See also <a href="#setVelocity">setVelocity</a>() and <a href="#setAnimated">setAnimated</a>().
|
|
|
|
<h3 class=fn><a href="tqrect.html">TQRect</a> <a name="boundingRect"></a>TQCanvasItem::boundingRect () const<tt> [pure virtual]</tt>
|
|
</h3>
|
|
|
|
<p> Returns the bounding rectangle in pixels that the canvas item covers.
|
|
<p> <p>See also <a href="#boundingRectAdvanced">boundingRectAdvanced</a>().
|
|
|
|
<p>Reimplemented in <a href="tqcanvassprite.html#boundingRect">TQCanvasSprite</a>, <a href="tqcanvaspolygonalitem.html#boundingRect">TQCanvasPolygonalItem</a>, and <a href="tqcanvastext.html#boundingRect">TQCanvasText</a>.
|
|
<h3 class=fn><a href="tqrect.html">TQRect</a> <a name="boundingRectAdvanced"></a>TQCanvasItem::boundingRectAdvanced () const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns the bounding rectangle of pixels that the canvas item <em>will</em> cover after <a href="#advance">advance</a>(1) is called.
|
|
<p> <p>See also <a href="#boundingRect">boundingRect</a>().
|
|
|
|
<h3 class=fn><a href="tqcanvas.html">TQCanvas</a> * <a name="canvas"></a>TQCanvasItem::canvas () const
|
|
</h3>
|
|
|
|
<p> Returns the canvas containing the canvas item.
|
|
|
|
<h3 class=fn>bool <a name="collidesWith"></a>TQCanvasItem::collidesWith ( const <a href="tqcanvasitem.html">TQCanvasItem</a> * other ) const<tt> [pure virtual]</tt>
|
|
</h3>
|
|
|
|
<p> Returns TRUE if the canvas item will collide with the <em>other</em>
|
|
item <em>after</em> they have moved by their current velocities;
|
|
otherwise returns FALSE.
|
|
<p> <p>See also <a href="#collisions">collisions</a>().
|
|
|
|
<p>Example: <a href="canvas-example.html#x2914">canvas/canvas.cpp</a>.
|
|
<h3 class=fn><a href="tqcanvasitemlist.html">TQCanvasItemList</a> <a name="collisions"></a>TQCanvasItem::collisions ( bool exact ) const
|
|
</h3>
|
|
Returns the list of canvas items that this canvas item has
|
|
collided with.
|
|
<p> A collision is generally defined as occurring when the pixels of
|
|
one item draw on the pixels of another item, but not all
|
|
subclasses are so precise. Also, since pixel-wise collision
|
|
detection can be slow, this function works in either exact or
|
|
inexact mode, according to the <em>exact</em> parameter.
|
|
<p> If <em>exact</em> is TRUE, the canvas items returned have been
|
|
accurately tested for collision with the canvas item.
|
|
<p> If <em>exact</em> is FALSE, the canvas items returned are <em>near</em> the
|
|
canvas item. You can test the canvas items returned using
|
|
<a href="#collidesWith">collidesWith</a>() if any are interesting collision candidates. By
|
|
using this approach, you can ignore some canvas items for which
|
|
collisions are not relevant.
|
|
<p> The returned list is a list of TQCanvasItems, but often you will
|
|
need to cast the items to their subclass types. The safe way to do
|
|
this is to use <a href="#rtti">rtti</a>() before casting. This provides some of the
|
|
functionality of the standard C++ dynamic cast operation even on
|
|
compilers where dynamic casts are not available.
|
|
<p> Note that a canvas item may be `on' a canvas, e.g. it was created
|
|
with the canvas as parameter, even though its coordinates place it
|
|
beyond the edge of the canvas's area. Collision detection only
|
|
works for canvas items which are wholly or partly within the
|
|
canvas's area.
|
|
<p> Note that if items have a velocity (see <a href="#setVelocity">setVelocity</a>()), then
|
|
collision testing is done based on where the item <em>will</em> be when
|
|
it moves, not its current location. For example, a "ball" item
|
|
doesn't need to actually embed into a "wall" item before a
|
|
collision is detected. For items without velocity, plain
|
|
intersection is used.
|
|
|
|
<h3 class=fn>void <a name="draw"></a>TQCanvasItem::draw ( <a href="tqpainter.html">TQPainter</a> & painter )<tt> [pure virtual]</tt>
|
|
</h3>
|
|
|
|
<p> This abstract virtual function draws the canvas item using <em>painter</em>.
|
|
<p> <b>Warning:</b> When you reimplement this function, make sure that you
|
|
leave the painter in the same state as you found it. For example,
|
|
if you start by calling <a href="tqpainter.html#translate">TQPainter::translate</a>(50, 50), end your
|
|
code by calling TQPainter::translate(-50, -50). Be also aware that
|
|
the painter might already have some transformations set (i.e.,
|
|
don't call <a href="tqpainter.html#resetXForm">TQPainter::resetXForm</a>() when you're done).
|
|
|
|
<p>Reimplemented in <a href="tqcanvassprite.html#draw">TQCanvasSprite</a>, <a href="tqcanvaspolygonalitem.html#draw">TQCanvasPolygonalItem</a>, and <a href="tqcanvastext.html#draw">TQCanvasText</a>.
|
|
<h3 class=fn>bool <a name="enabled"></a>TQCanvasItem::enabled () const
|
|
</h3>
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p>
|
|
Use <a href="#isEnabled">isEnabled</a>() instead.
|
|
|
|
<h3 class=fn>void <a name="hide"></a>TQCanvasItem::hide ()
|
|
</h3> Shorthand for <a href="#setVisible">setVisible</a>(FALSE).
|
|
<h3 class=fn>bool <a name="isActive"></a>TQCanvasItem::isActive () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if the TQCanvasItem is active; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="isEnabled"></a>TQCanvasItem::isEnabled () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if the TQCanvasItem is enabled; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="isSelected"></a>TQCanvasItem::isSelected () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if the canvas item is selected; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="isVisible"></a>TQCanvasItem::isVisible () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if the canvas item is visible; otherwise returns
|
|
FALSE.
|
|
<p> Note that in this context TRUE does <em>not</em> mean that the canvas
|
|
item is currently in a view, merely that if a view is showing the
|
|
area where the canvas item is positioned, and the item is not
|
|
obscured by items with higher z values, and the view is not
|
|
obscured by overlaying windows, it would be visible.
|
|
<p> <p>See also <a href="#setVisible">setVisible</a>() and <a href="#z">z</a>().
|
|
|
|
<h3 class=fn>void <a name="move"></a>TQCanvasItem::move ( double x, double y )
|
|
</h3>
|
|
Moves the canvas item to the absolute position (<em>x</em>, <em>y</em>).
|
|
|
|
<p>Example: <a href="canvas-example.html#x2915">canvas/canvas.cpp</a>.
|
|
<h3 class=fn>void <a name="moveBy"></a>TQCanvasItem::moveBy ( double dx, double dy )<tt> [virtual]</tt>
|
|
</h3>
|
|
Moves the canvas item relative to its current position by (<em>dx</em>,
|
|
<em>dy</em>).
|
|
|
|
<p>Example: <a href="canvas-example.html#x2916">canvas/canvas.cpp</a>.
|
|
<h3 class=fn>int <a name="rtti"></a>TQCanvasItem::rtti () const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns 0 (TQCanvasItem::Rtti_Item).
|
|
<p> Make your derived classes return their own values for <a href="#rtti">rtti</a>(), so
|
|
that you can distinguish between objects returned by
|
|
TQCanvas::at(). You should use values greater than 1000 to allow
|
|
for extensions to this class.
|
|
<p> Overuse of this functionality can damage it's extensibility. For
|
|
example, once you have identified a base class of a TQCanvasItem
|
|
found by TQCanvas::at(), cast it to that type and call meaningful
|
|
methods rather than acting upon the object based on its rtti
|
|
value.
|
|
<p> For example:
|
|
<p> <pre>
|
|
TQCanvasItem* item;
|
|
// Find an item, e.g. with TQCanvasItem::collisions().
|
|
...
|
|
if (item-><a href="#rtti">rtti</a>() == MySprite::RTTI ) {
|
|
MySprite* s = (MySprite*)item;
|
|
if (s->isDamagable()) s->loseHitPoints(1000);
|
|
if (s->isHot()) myself->loseHitPoints(1000);
|
|
...
|
|
}
|
|
</pre>
|
|
|
|
|
|
<p>Example: <a href="canvas-example.html#x2917">canvas/canvas.cpp</a>.
|
|
<p>Reimplemented in <a href="tqcanvassprite.html#rtti">TQCanvasSprite</a>, <a href="tqcanvaspolygonalitem.html#rtti">TQCanvasPolygonalItem</a>, and <a href="tqcanvastext.html#rtti">TQCanvasText</a>.
|
|
<h3 class=fn>bool <a name="selected"></a>TQCanvasItem::selected () const
|
|
</h3>
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p>
|
|
Use <a href="#isSelected">isSelected</a>() instead.
|
|
|
|
<h3 class=fn>void <a name="setActive"></a>TQCanvasItem::setActive ( bool yes )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the active flag of the item to <em>yes</em>. If this changes the
|
|
item's active state the item will be redrawn when
|
|
<a href="tqcanvas.html#update">TQCanvas::update</a>() is next called.
|
|
<p> The <a href="tqcanvas.html">TQCanvas</a>, TQCanvasItem and the TQt-supplied TQCanvasItem
|
|
subclasses do not make use of this value. The <a href="#setActive">setActive</a>() function
|
|
is supplied because many applications need it, but it is up to you
|
|
how you use the <a href="#isActive">isActive</a>() value.
|
|
|
|
<h3 class=fn>void <a name="setAnimated"></a>TQCanvasItem::setAnimated ( bool y )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the canvas item to be in motion if <em>y</em> is TRUE, or not if <em>y</em> is FALSE. The speed and direction of the motion is set with
|
|
<a href="#setVelocity">setVelocity</a>(), or with <a href="#setXVelocity">setXVelocity</a>() and <a href="#setYVelocity">setYVelocity</a>().
|
|
<p> <p>See also <a href="#advance">advance</a>() and <a href="tqcanvas.html#advance">TQCanvas::advance</a>().
|
|
|
|
<h3 class=fn>void <a name="setCanvas"></a>TQCanvasItem::setCanvas ( <a href="tqcanvas.html">TQCanvas</a> * c )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the <a href="tqcanvas.html">TQCanvas</a> upon which the canvas item is to be drawn to <em>c</em>.
|
|
<p> <p>See also <a href="#canvas">canvas</a>().
|
|
|
|
<h3 class=fn>void <a name="setEnabled"></a>TQCanvasItem::setEnabled ( bool yes )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the enabled flag of the item to <em>yes</em>. If this changes the
|
|
item's enabled state the item will be redrawn when
|
|
<a href="tqcanvas.html#update">TQCanvas::update</a>() is next called.
|
|
<p> The <a href="tqcanvas.html">TQCanvas</a>, TQCanvasItem and the TQt-supplied TQCanvasItem
|
|
subclasses do not make use of this value. The <a href="#setEnabled">setEnabled</a>()
|
|
function is supplied because many applications need it, but it is
|
|
up to you how you use the <a href="#isEnabled">isEnabled</a>() value.
|
|
|
|
<h3 class=fn>void <a name="setSelected"></a>TQCanvasItem::setSelected ( bool yes )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the selected flag of the item to <em>yes</em>. If this changes the
|
|
item's selected state the item will be redrawn when
|
|
<a href="tqcanvas.html#update">TQCanvas::update</a>() is next called.
|
|
<p> The <a href="tqcanvas.html">TQCanvas</a>, TQCanvasItem and the TQt-supplied TQCanvasItem
|
|
subclasses do not make use of this value. The <a href="#setSelected">setSelected</a>()
|
|
function is supplied because many applications need it, but it is
|
|
up to you how you use the <a href="#isSelected">isSelected</a>() value.
|
|
|
|
<h3 class=fn>void <a name="setVelocity"></a>TQCanvasItem::setVelocity ( double vx, double vy )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the canvas item to be in motion, moving by <em>vx</em> and <em>vy</em>
|
|
pixels in the horizontal and vertical directions respectively.
|
|
<p> <p>See also <a href="#advance">advance</a>(), <a href="#setXVelocity">setXVelocity</a>(), and <a href="#setYVelocity">setYVelocity</a>().
|
|
|
|
<h3 class=fn>void <a name="setVisible"></a>TQCanvasItem::setVisible ( bool yes )<tt> [virtual]</tt>
|
|
</h3>
|
|
Makes the canvas item visible if <em>yes</em> is TRUE, or invisible if
|
|
<em>yes</em> is FALSE. The change takes effect when <a href="tqcanvas.html#update">TQCanvas::update</a>() is
|
|
next called.
|
|
|
|
<h3 class=fn>void <a name="setX"></a>TQCanvasItem::setX ( double x )
|
|
</h3>
|
|
|
|
<p> Moves the canvas item so that its x-position is <em>x</em>.
|
|
<p> <p>See also <a href="#x">x</a>() and <a href="#move">move</a>().
|
|
|
|
<p>Example: <a href="tutorial2-06.html#x2568">chart/chartform_canvas.cpp</a>.
|
|
<h3 class=fn>void <a name="setXVelocity"></a>TQCanvasItem::setXVelocity ( double vx )
|
|
</h3>
|
|
|
|
<p> Sets the horizontal component of the canvas item's velocity to <em>vx</em>.
|
|
<p> <p>See also <a href="#setYVelocity">setYVelocity</a>() and <a href="#setVelocity">setVelocity</a>().
|
|
|
|
<h3 class=fn>void <a name="setY"></a>TQCanvasItem::setY ( double y )
|
|
</h3>
|
|
|
|
<p> Moves the canvas item so that its y-position is <em>y</em>.
|
|
<p> <p>See also <a href="#y">y</a>() and <a href="#move">move</a>().
|
|
|
|
<p>Example: <a href="tutorial2-06.html#x2569">chart/chartform_canvas.cpp</a>.
|
|
<h3 class=fn>void <a name="setYVelocity"></a>TQCanvasItem::setYVelocity ( double vy )
|
|
</h3>
|
|
|
|
<p> Sets the vertical component of the canvas item's velocity to <em>vy</em>.
|
|
<p> <p>See also <a href="#setXVelocity">setXVelocity</a>() and <a href="#setVelocity">setVelocity</a>().
|
|
|
|
<h3 class=fn>void <a name="setZ"></a>TQCanvasItem::setZ ( double z )
|
|
</h3>
|
|
|
|
<p> Sets the z index of the canvas item to <em>z</em>. Higher-z items
|
|
obscure (are in front of) lower-z items.
|
|
<p> <p>See also <a href="#z">z</a>() and <a href="#move">move</a>().
|
|
|
|
<p>Examples: <a href="canvas-example.html#x2918">canvas/canvas.cpp</a> and <a href="tutorial2-06.html#x2570">chart/chartform_canvas.cpp</a>.
|
|
<h3 class=fn>void <a name="show"></a>TQCanvasItem::show ()
|
|
</h3> Shorthand for <a href="#setVisible">setVisible</a>(TRUE).
|
|
<p>Examples: <a href="canvas-example.html#x2919">canvas/canvas.cpp</a> and <a href="tutorial2-06.html#x2571">chart/chartform_canvas.cpp</a>.
|
|
<h3 class=fn>void <a name="update"></a>TQCanvasItem::update ()<tt> [protected]</tt>
|
|
</h3>
|
|
|
|
<p> Call this function to repaint the canvas's changed chunks.
|
|
|
|
<h3 class=fn>bool <a name="visible"></a>TQCanvasItem::visible () const
|
|
</h3>
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p>
|
|
Use <a href="#isVisible">isVisible</a>() instead.
|
|
|
|
<h3 class=fn>double <a name="x"></a>TQCanvasItem::x () const
|
|
</h3>
|
|
|
|
<p> Returns the horizontal position of the canvas item. Note that
|
|
subclasses often have an origin other than the top-left corner.
|
|
|
|
<p>Example: <a href="canvas-example.html#x2920">canvas/canvas.cpp</a>.
|
|
<h3 class=fn>double <a name="xVelocity"></a>TQCanvasItem::xVelocity () const
|
|
</h3>
|
|
Returns the horizontal velocity component of the canvas item.
|
|
|
|
<h3 class=fn>double <a name="y"></a>TQCanvasItem::y () const
|
|
</h3>
|
|
|
|
<p> Returns the vertical position of the canvas item. Note that
|
|
subclasses often have an origin other than the top-left corner.
|
|
|
|
<p>Example: <a href="canvas-example.html#x2921">canvas/canvas.cpp</a>.
|
|
<h3 class=fn>double <a name="yVelocity"></a>TQCanvasItem::yVelocity () const
|
|
</h3>
|
|
Returns the vertical velocity component of the canvas item.
|
|
|
|
<h3 class=fn>double <a name="z"></a>TQCanvasItem::z () const
|
|
</h3>
|
|
|
|
<p> Returns the z index of the canvas item, which is used for visual
|
|
order: higher-z items obscure (are in front of) lower-z items.
|
|
|
|
<!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
|
Copyright © 1995-2007
|
|
<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 © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|