[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/canvas/qcanvas.cpp:4858 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QCanvasText Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QCanvasText Class Reference<br><small>[<a href="canvas.html">canvas module</a>]</small></h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QCanvasText class provides a text object on a QCanvas.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qcanvas-h.html">qcanvas.h</a>></tt>
|
---|
| 37 | <p>Inherits <a href="qcanvasitem.html">QCanvasItem</a>.
|
---|
| 38 | <p><a href="qcanvastext-members.html">List of all member functions.</a>
|
---|
| 39 | <h2>Public Members</h2>
|
---|
| 40 | <ul>
|
---|
| 41 | <li class=fn><a href="#QCanvasText"><b>QCanvasText</b></a> ( QCanvas * canvas )</li>
|
---|
| 42 | <li class=fn><a href="#QCanvasText-2"><b>QCanvasText</b></a> ( const QString & t, QCanvas * canvas )</li>
|
---|
| 43 | <li class=fn><a href="#QCanvasText-3"><b>QCanvasText</b></a> ( const QString & t, QFont f, QCanvas * canvas )</li>
|
---|
| 44 | <li class=fn>virtual <a href="#~QCanvasText"><b>~QCanvasText</b></a> ()</li>
|
---|
| 45 | <li class=fn>void <a href="#setText"><b>setText</b></a> ( const QString & t )</li>
|
---|
| 46 | <li class=fn>void <a href="#setFont"><b>setFont</b></a> ( const QFont & f )</li>
|
---|
| 47 | <li class=fn>void <a href="#setColor"><b>setColor</b></a> ( const QColor & c )</li>
|
---|
| 48 | <li class=fn>QString <a href="#text"><b>text</b></a> () const</li>
|
---|
| 49 | <li class=fn>QFont <a href="#font"><b>font</b></a> () const</li>
|
---|
| 50 | <li class=fn>QColor <a href="#color"><b>color</b></a> () const</li>
|
---|
| 51 | <li class=fn>int <a href="#textFlags"><b>textFlags</b></a> () const</li>
|
---|
| 52 | <li class=fn>void <a href="#setTextFlags"><b>setTextFlags</b></a> ( int f )</li>
|
---|
| 53 | <li class=fn>virtual QRect <a href="#boundingRect"><b>boundingRect</b></a> () const</li>
|
---|
| 54 | <li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li>
|
---|
| 55 | </ul>
|
---|
| 56 | <h2>Protected Members</h2>
|
---|
| 57 | <ul>
|
---|
| 58 | <li class=fn>virtual void <a href="#draw"><b>draw</b></a> ( QPainter & painter )</li>
|
---|
| 59 | </ul>
|
---|
| 60 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | The QCanvasText class provides a text object on a <a href="qcanvas.html">QCanvas</a>.
|
---|
| 64 |
|
---|
| 65 | <p>
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | <p> A canvas text item has text with font, color and alignment
|
---|
| 69 | attributes. The text and font can be set in the constructor or set
|
---|
| 70 | or changed later with <a href="#setText">setText</a>() and <a href="#setFont">setFont</a>(). The color is set
|
---|
| 71 | with <a href="#setColor">setColor</a>() and the alignment with <a href="#setTextFlags">setTextFlags</a>(). The text
|
---|
| 72 | item's bounding rectangle is retrieved with <a href="#boundingRect">boundingRect</a>().
|
---|
| 73 | <p> The text can be drawn on a painter with <a href="#draw">draw</a>().
|
---|
| 74 | <p> Like any other canvas item text items can be moved with
|
---|
| 75 | <a href="qcanvasitem.html#move">QCanvasItem::move</a>() and <a href="qcanvasitem.html#moveBy">QCanvasItem::moveBy</a>(), or by setting
|
---|
| 76 | coordinates with <a href="qcanvasitem.html#setX">QCanvasItem::setX</a>(), <a href="qcanvasitem.html#setY">QCanvasItem::setY</a>() and
|
---|
| 77 | <a href="qcanvasitem.html#setZ">QCanvasItem::setZ</a>().
|
---|
| 78 | <p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>.
|
---|
| 79 |
|
---|
| 80 | <hr><h2>Member Function Documentation</h2>
|
---|
| 81 | <h3 class=fn><a name="QCanvasText"></a>QCanvasText::QCanvasText ( <a href="qcanvas.html">QCanvas</a> * canvas )
|
---|
| 82 | </h3>
|
---|
| 83 | Constructs a QCanvasText with the text "<text>", on <em>canvas</em>.
|
---|
| 84 |
|
---|
| 85 | <h3 class=fn><a name="QCanvasText-2"></a>QCanvasText::QCanvasText ( const <a href="qstring.html">QString</a> & t, <a href="qcanvas.html">QCanvas</a> * canvas )
|
---|
| 86 | </h3>
|
---|
| 87 | Constructs a QCanvasText with the text <em>t</em>, on canvas <em>canvas</em>.
|
---|
| 88 |
|
---|
| 89 | <h3 class=fn><a name="QCanvasText-3"></a>QCanvasText::QCanvasText ( const <a href="qstring.html">QString</a> & t, <a href="qfont.html">QFont</a> f, <a href="qcanvas.html">QCanvas</a> * canvas )
|
---|
| 90 | </h3>
|
---|
| 91 | Constructs a QCanvasText with the text <em>t</em> and font <em>f</em>, on the
|
---|
| 92 | canvas <em>canvas</em>.
|
---|
| 93 |
|
---|
| 94 | <h3 class=fn><a name="~QCanvasText"></a>QCanvasText::~QCanvasText ()<tt> [virtual]</tt>
|
---|
| 95 | </h3>
|
---|
| 96 | Destroys the canvas text item.
|
---|
| 97 |
|
---|
| 98 | <h3 class=fn><a href="qrect.html">QRect</a> <a name="boundingRect"></a>QCanvasText::boundingRect () const<tt> [virtual]</tt>
|
---|
| 99 | </h3>
|
---|
| 100 | Returns the bounding rectangle of the text.
|
---|
| 101 |
|
---|
| 102 | <p>Reimplemented from <a href="qcanvasitem.html#boundingRect">QCanvasItem</a>.
|
---|
| 103 | <h3 class=fn><a href="qcolor.html">QColor</a> <a name="color"></a>QCanvasText::color () const
|
---|
| 104 | </h3>
|
---|
| 105 | Returns the color of the text.
|
---|
| 106 | <p> <p>See also <a href="#setColor">setColor</a>().
|
---|
| 107 |
|
---|
| 108 | <h3 class=fn>void <a name="draw"></a>QCanvasText::draw ( <a href="qpainter.html">QPainter</a> & painter )<tt> [virtual protected]</tt>
|
---|
| 109 | </h3>
|
---|
| 110 | Draws the text using the painter <em>painter</em>.
|
---|
| 111 |
|
---|
| 112 | <p>Reimplemented from <a href="qcanvasitem.html#draw">QCanvasItem</a>.
|
---|
| 113 | <h3 class=fn><a href="qfont.html">QFont</a> <a name="font"></a>QCanvasText::font () const
|
---|
| 114 | </h3>
|
---|
| 115 | Returns the font in which the text is drawn.
|
---|
| 116 | <p> <p>See also <a href="#setFont">setFont</a>().
|
---|
| 117 |
|
---|
| 118 | <h3 class=fn>int <a name="rtti"></a>QCanvasText::rtti () const<tt> [virtual]</tt>
|
---|
| 119 | </h3>
|
---|
| 120 | Returns 3 (QCanvasItem::Rtti_Text).
|
---|
| 121 | <p> <p>See also <a href="qcanvasitem.html#rtti">QCanvasItem::rtti</a>().
|
---|
| 122 |
|
---|
| 123 | <p>Reimplemented from <a href="qcanvasitem.html#rtti">QCanvasItem</a>.
|
---|
| 124 | <h3 class=fn>void <a name="setColor"></a>QCanvasText::setColor ( const <a href="qcolor.html">QColor</a> & c )
|
---|
| 125 | </h3>
|
---|
| 126 | Sets the color of the text to the color <em>c</em>.
|
---|
| 127 | <p> <p>See also <a href="#color">color</a>() and <a href="#setFont">setFont</a>().
|
---|
| 128 |
|
---|
| 129 | <p>Example: <a href="tutorial2-06.html#x2574">chart/chartform_canvas.cpp</a>.
|
---|
| 130 | <h3 class=fn>void <a name="setFont"></a>QCanvasText::setFont ( const <a href="qfont.html">QFont</a> & f )
|
---|
| 131 | </h3>
|
---|
| 132 | Sets the font in which the text is drawn to font <em>f</em>.
|
---|
| 133 | <p> <p>See also <a href="#font">font</a>().
|
---|
| 134 |
|
---|
| 135 | <h3 class=fn>void <a name="setText"></a>QCanvasText::setText ( const <a href="qstring.html">QString</a> & t )
|
---|
| 136 | </h3>
|
---|
| 137 | Sets the text item's text to <em>t</em>. The text may contain newlines.
|
---|
| 138 | <p> <p>See also <a href="#text">text</a>(), <a href="#setFont">setFont</a>(), <a href="#setColor">setColor</a>(), and <a href="#setTextFlags">setTextFlags</a>().
|
---|
| 139 |
|
---|
| 140 | <p>Example: <a href="canvas-example.html#x2929">canvas/canvas.cpp</a>.
|
---|
| 141 | <h3 class=fn>void <a name="setTextFlags"></a>QCanvasText::setTextFlags ( int f )
|
---|
| 142 | </h3>
|
---|
| 143 | Sets the alignment flags to <em>f</em>. These are a bitwise OR of the
|
---|
| 144 | flags available to <a href="qpainter.html#drawText">QPainter::drawText</a>() -- see the
|
---|
| 145 | <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>.
|
---|
| 146 | <p> <p>See also <a href="#setFont">setFont</a>() and <a href="#setColor">setColor</a>().
|
---|
| 147 |
|
---|
| 148 | <h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QCanvasText::text () const
|
---|
| 149 | </h3>
|
---|
| 150 | Returns the text item's text.
|
---|
| 151 | <p> <p>See also <a href="#setText">setText</a>().
|
---|
| 152 |
|
---|
| 153 | <h3 class=fn>int <a name="textFlags"></a>QCanvasText::textFlags () const
|
---|
| 154 | </h3>
|
---|
| 155 |
|
---|
| 156 | <p> Returns the currently set alignment flags.
|
---|
| 157 | <p> <p>See also <a href="#setTextFlags">setTextFlags</a>() and <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>.
|
---|
| 158 |
|
---|
| 159 | <!-- eof -->
|
---|
| 160 | <hr><p>
|
---|
| 161 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 162 | Copyright © 1995-2007
|
---|
| 163 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 164 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 165 | <td>Copyright © 2007
|
---|
| 166 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 167 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 168 | </table></div></address></body>
|
---|
| 169 | </html>
|
---|