1QCanvasText(3qt) QCanvasText(3qt)
2
3
4
6 QCanvasText - Text object on a QCanvas
7
9 #include <qcanvas.h>
10
11 Inherits QCanvasItem.
12
13 Public Members
14 QCanvasText ( QCanvas * canvas )
15 QCanvasText ( const QString & t, QCanvas * canvas )
16 QCanvasText ( const QString & t, QFont f, QCanvas * canvas )
17 virtual ~QCanvasText ()
18 void setText ( const QString & t )
19 void setFont ( const QFont & f )
20 void setColor ( const QColor & c )
21 QString text () const
22 QFont font () const
23 QColor color () const
24 int textFlags () const
25 void setTextFlags ( int f )
26 virtual QRect boundingRect () const
27 virtual int rtti () const
28
29 Protected Members
30 virtual void draw ( QPainter & painter )
31
33 The QCanvasText class provides a text object on a QCanvas.
34
35 A canvas text item has text with font, color and alignment attributes.
36 The text and font can be set in the constructor or set or changed later
37 with setText() and setFont(). The color is set with setColor() and the
38 alignment with setTextFlags(). The text item's bounding rectangle is
39 retrieved with boundingRect().
40
41 The text can be drawn on a painter with draw().
42
43 Like any other canvas item text items can be moved with
44 QCanvasItem::move() and QCanvasItem::moveBy(), or by setting
45 coordinates with QCanvasItem::setX(), QCanvasItem::setY() and
46 QCanvasItem::setZ().
47
48 See also Graphics Classes and Image Processing Classes.
49
52 Constructs a QCanvasText with the text "<text>", on canvas.
53
55 Constructs a QCanvasText with the text t, on canvas canvas.
56
58 Constructs a QCanvasText with the text t and font f, on the canvas
59 canvas.
60
62 Destroys the canvas text item.
63
65 Returns the bounding rectangle of the text.
66
67 Reimplemented from QCanvasItem.
68
70 Returns the color of the text.
71
72 See also setColor().
73
75 Draws the text using the painter painter.
76
77 Reimplemented from QCanvasItem.
78
80 Returns the font in which the text is drawn.
81
82 See also setFont().
83
85 Returns 3 (QCanvasItem::Rtti_Text).
86
87 See also QCanvasItem::rtti().
88
89 Reimplemented from QCanvasItem.
90
92 Sets the color of the text to the color c.
93
94 See also color() and setFont().
95
96 Example: chart/chartform_canvas.cpp.
97
99 Sets the font in which the text is drawn to font f.
100
101 See also font().
102
104 Sets the text item's text to t. The text may contain newlines.
105
106 See also text(), setFont(), setColor(), and setTextFlags().
107
108 Example: canvas/canvas.cpp.
109
111 Sets the alignment flags to f. These are a bitwise OR of the flags
112 available to QPainter::drawText() -- see the Qt::AlignmentFlags.
113
114 See also setFont() and setColor().
115
117 Returns the text item's text.
118
119 See also setText().
120
122 Returns the currently set alignment flags.
123
124 See also setTextFlags() and Qt::AlignmentFlags.
125
126
128 http://doc.trolltech.com/qcanvastext.html
129 http://www.trolltech.com/faq/tech.html
130
132 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
133 license file included in the distribution for a complete license
134 statement.
135
137 Generated automatically from the source code.
138
140 If you find a bug in Qt, please report it as described in
141 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
142 help you. Thank you.
143
144 The definitive Qt documentation is provided in HTML format; it is
145 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
146 web browser. This man page is provided as a convenience for those users
147 who prefer man pages, although this format is not officially supported
148 by Trolltech.
149
150 If you find errors in this manual page, please report them to qt-
151 bugs@trolltech.com. Please include the name of the manual page
152 (qcanvastext.3qt) and the Qt version (3.3.8).
153
154
155
156Trolltech AS 2 February 2007 QCanvasText(3qt)