
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQ3CanvasText class provides a text object on aQ3Canvas.More...
| Header: | #include <Q3CanvasText> |
| Inherits: | Q3CanvasItem |
| Q3CanvasText(Q3Canvas * canvas) | |
| Q3CanvasText(const QString & t, Q3Canvas * canvas) | |
| Q3CanvasText(const QString & t, QFont f, Q3Canvas * canvas) | |
| virtual | ~Q3CanvasText() |
| QColor | color() const |
| QFont | font() const |
| void | setColor(const QColor & c) |
| void | setFont(const QFont & f) |
| void | setText(const QString & t) |
| void | setTextFlags(int f) |
| QString | text() const |
| int | textFlags() const |
| virtual QRect | boundingRect() const |
| virtual bool | collidesWith(const Q3CanvasItem * i) const |
| virtual void | moveBy(double dx, double dy) |
| virtual int | rtti() const |
| virtual void | draw(QPainter & painter) |
TheQ3CanvasText class provides a text object on aQ3Canvas.
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 changed later withsetText() andsetFont(). The color is set withsetColor() and the alignment withsetTextFlags(). The text item's bounding rectangle is retrieved withboundingRect().
The text can be drawn on a painter withdraw().
Like any other canvas item text items can be moved withQ3CanvasItem::move() andQ3CanvasItem::moveBy(), or by setting coordinates withQ3CanvasItem::setX(),Q3CanvasItem::setY() andQ3CanvasItem::setZ().
See alsoQtCanvas andPorting to Graphics View.
Constructs aQ3CanvasText with the text "<text>", oncanvas.
Constructs aQ3CanvasText with the textt, on canvascanvas.
Constructs aQ3CanvasText with the textt and fontf, on the canvascanvas.
[virtual]Q3CanvasText::~Q3CanvasText()Destroys the canvas text item.
[virtual]QRect Q3CanvasText::boundingRect() constReimplemented fromQ3CanvasItem::boundingRect().
Returns the bounding rectangle of the text.
[virtual]bool Q3CanvasText::collidesWith(constQ3CanvasItem * i) constReimplemented fromQ3CanvasItem::collidesWith().
Returns the color of the text.
See alsosetColor().
[virtual protected]void Q3CanvasText::draw(QPainter & painter)Reimplemented fromQ3CanvasItem::draw().
Draws the text using the painterpainter.
Returns the font in which the text is drawn.
See alsosetFont().
[virtual]void Q3CanvasText::moveBy(double dx,double dy)Reimplemented fromQ3CanvasItem::moveBy().
[virtual]int Q3CanvasText::rtti() constReimplemented fromQ3CanvasItem::rtti().
Returns 3 (Q3CanvasItem::Rtti_Text).
See alsoQ3CanvasItem::rtti().
Sets the color of the text to the colorc.
Sets the font in which the text is drawn to fontf.
See alsofont().
Sets the text item's text tot. The text may contain newlines.
See alsotext(),setFont(),setColor(), andsetTextFlags().
Sets the alignment flags tof. These are a bitwise OR of the flags available toQPainter::drawText() -- see theQt::AlignmentFlags.
See alsotextFlags(),setFont(), andsetColor().
Returns the text item's text.
See alsosetText().
Returns the currently set alignment flags.
See alsosetTextFlags() andQt::AlignmentFlag.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.