qcanvastext.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 167 行
HTML
167 行
<!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/canvas/qcanvas.cpp:4619 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QCanvasText 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>QCanvasText Class Reference<br><small>[<a href="canvas.html">canvas module</a>]</small></h1><p>The QCanvasText class provides a text object on a QCanvas.<a href="#details">More...</a><p><tt>#include <<a href="qcanvas-h.html">qcanvas.h</a>></tt><p>Inherits <a href="qcanvasitem.html">QCanvasItem</a>.<p><a href="qcanvastext-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn><a href="#QCanvasText"><b>QCanvasText</b></a> ( QCanvas * canvas )</div></li><li><div class=fn><a href="#QCanvasText-2"><b>QCanvasText</b></a> ( const QString & t, QCanvas * canvas )</div></li><li><div class=fn><a href="#QCanvasText-3"><b>QCanvasText</b></a> ( const QString & t, QFont f, QCanvas * canvas )</div></li><li><div class=fn>virtual <a href="#~QCanvasText"><b>~QCanvasText</b></a> ()</div></li><li><div class=fn>void <a href="#setText"><b>setText</b></a> ( const QString & t )</div></li><li><div class=fn>void <a href="#setFont"><b>setFont</b></a> ( const QFont & f )</div></li><li><div class=fn>void <a href="#setColor"><b>setColor</b></a> ( const QColor & c )</div></li><li><div class=fn>QString <a href="#text"><b>text</b></a> () const</div></li><li><div class=fn>QFont <a href="#font"><b>font</b></a> () const</div></li><li><div class=fn>QColor <a href="#color"><b>color</b></a> () const</div></li><li><div class=fn>int <a href="#textFlags"><b>textFlags</b></a> () const</div></li><li><div class=fn>void <a href="#setTextFlags"><b>setTextFlags</b></a> ( int f )</div></li><li><div class=fn>virtual QRect <a href="#boundingRect"><b>boundingRect</b></a> () const</div></li><li><div class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</div></li></ul><h2>Protected Members</h2><ul><li><div class=fn>virtual void <a href="#draw"><b>draw</b></a> ( QPainter & painter )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2>The QCanvasText class provides a text object on a <a href="qcanvas.html">QCanvas</a>.<p> A canvas text item has text with font, color and alignment attributes.The text and font can be set in the constructor or set or changedlater with <a href="#setText">setText</a>() and <a href="#setFont">setFont</a>(). The color is set with <a href="#setColor">setColor</a>()and the alignment with <a href="#setTextFlags">setTextFlags</a>(). The text item's boundingrectangle is retrieved with <a href="#boundingRect">boundingRect</a>().<p> The text can be drawn on a painter with <a href="#draw">draw</a>().<p> Like any other canvas item text items can be moved with<a href="qcanvasitem.html#move">QCanvasItem::move</a>() and <a href="qcanvasitem.html#moveBy">QCanvasItem::moveBy</a>(), or by setting coordinateswith <a href="qcanvasitem.html#setX">QCanvasItem::setX</a>(), <a href="qcanvasitem.html#setY">QCanvasItem::setY</a>() and <a href="qcanvasitem.html#setZ">QCanvasItem::setZ</a>().<p> <p>See also <a href="graphics.html">Graphics Classes</a> and <a href="images.html">Image Processing Classes</a>.<hr><h2>Member Function Documentation</h2><h3 class=fn><a name="QCanvasText"></a>QCanvasText::QCanvasText ( <a href="qcanvas.html">QCanvas</a> * canvas )</h3>Constructs a QCanvasText with the text "<text>", on <em>canvas</em>.<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 )</h3>Constructs a QCanvasText with the text <em>t</em>, on canvas <em>canvas</em>.<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 )</h3>Constructs a QCanvasText with the text <em>t</em> and font <em>f</em>, on thecanvas <em>canvas</em>.<h3 class=fn><a name="~QCanvasText"></a>QCanvasText::~QCanvasText ()<tt> [virtual]</tt></h3>Destroys the canvas text item.<h3 class=fn><a href="qrect.html">QRect</a> <a name="boundingRect"></a>QCanvasText::boundingRect () const<tt> [virtual]</tt></h3>Returns the bounding rectangle of the text.<p>Reimplemented from <a href="qcanvasitem.html#boundingRect">QCanvasItem</a>.<h3 class=fn><a href="qcolor.html">QColor</a> <a name="color"></a>QCanvasText::color () const</h3>Returns the color of the text.<p>See also <a href="#setColor">setColor</a>().<h3 class=fn>void <a name="draw"></a>QCanvasText::draw ( <a href="qpainter.html">QPainter</a> & painter )<tt> [virtual protected]</tt></h3>Draws the text using the painter <em>painter</em>.<p>Reimplemented from <a href="qcanvasitem.html#draw">QCanvasItem</a>.<h3 class=fn><a href="qfont.html">QFont</a> <a name="font"></a>QCanvasText::font () const</h3>Returns the font in which the text is drawn.<p>See also <a href="#setFont">setFont</a>().<h3 class=fn>int <a name="rtti"></a>QCanvasText::rtti () const<tt> [virtual]</tt></h3>Returns 3 (QCanvasItem::Rtti_Text).<p> <p>See also <a href="qcanvasitem.html#rtti">QCanvasItem::rtti</a>().<p>Reimplemented from <a href="qcanvasitem.html#rtti">QCanvasItem</a>.<h3 class=fn>void <a name="setColor"></a>QCanvasText::setColor ( const <a href="qcolor.html">QColor</a> & c )</h3>Sets the color of the text to the color <em>c</em>.<p>See also <a href="#color">color</a>() and <a href="#setFont">setFont</a>().<p>Example: <a href="tutorial2-06.html#x2479">chart/chartform_canvas.cpp</a>.<h3 class=fn>void <a name="setFont"></a>QCanvasText::setFont ( const <a href="qfont.html">QFont</a> & f )</h3>Sets the font in which the text is drawn to font <em>f</em>.<p>See also <a href="#font">font</a>().<h3 class=fn>void <a name="setText"></a>QCanvasText::setText ( const <a href="qstring.html">QString</a> & t )</h3>Sets the text item's text to <em>t</em>. The text may contain newlines.<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>().<p>Example: <a href="canvas-example.html#x2705">canvas/canvas.cpp</a>.<h3 class=fn>void <a name="setTextFlags"></a>QCanvasText::setTextFlags ( int f )</h3>Sets the alignment flags to <em>f</em>. These are a bitwise OR of theflags available to <a href="qpainter.html#drawText">QPainter::drawText</a>() -- see Qt::AlignmentFlags.<p> <p>See also <a href="#setFont">setFont</a>() and <a href="#setColor">setColor</a>().<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QCanvasText::text () const</h3>Returns the text item's text.<p> <p>See also <a href="#setText">setText</a>().<h3 class=fn>int <a name="textFlags"></a>QCanvasText::textFlags () const</h3><p> Returns the currently set alignment flags.<p>See also <a href="#setTextFlags">setTextFlags</a>() and <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</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 + -
显示快捷键?