Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

Q3CanvasText Class

TheQ3CanvasText class provides a text object on aQ3Canvas.More...

Header:#include <Q3CanvasText>
Inherits:Q3CanvasItem

Public Functions

Q3CanvasText(Q3Canvas * canvas)
Q3CanvasText(const QString & t, Q3Canvas * canvas)
Q3CanvasText(const QString & t, QFont f, Q3Canvas * canvas)
virtual~Q3CanvasText()
QColorcolor() const
QFontfont() const
voidsetColor(const QColor & c)
voidsetFont(const QFont & f)
voidsetText(const QString & t)
voidsetTextFlags(int f)
QStringtext() const
inttextFlags() const

Reimplemented Public Functions

virtual QRectboundingRect() const
virtual boolcollidesWith(const Q3CanvasItem * i) const
virtual voidmoveBy(double dx, double dy)
virtual intrtti() const

Reimplemented Protected Functions

virtual voiddraw(QPainter & painter)

Detailed Description

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.

Member Function Documentation

Q3CanvasText::Q3CanvasText(Q3Canvas * canvas)

Constructs aQ3CanvasText with the text "<text>", oncanvas.

Q3CanvasText::Q3CanvasText(constQString & t,Q3Canvas * canvas)

Constructs aQ3CanvasText with the textt, on canvascanvas.

Q3CanvasText::Q3CanvasText(constQString & t,QFont f,Q3Canvas * canvas)

Constructs aQ3CanvasText with the textt and fontf, on the canvascanvas.

[virtual]Q3CanvasText::~Q3CanvasText()

Destroys the canvas text item.

[virtual]QRect Q3CanvasText::boundingRect() const

Reimplemented fromQ3CanvasItem::boundingRect().

Returns the bounding rectangle of the text.

[virtual]bool Q3CanvasText::collidesWith(constQ3CanvasItem * i) const

Reimplemented fromQ3CanvasItem::collidesWith().

QColor Q3CanvasText::color() const

Returns the color of the text.

See alsosetColor().

[virtual protected]void Q3CanvasText::draw(QPainter & painter)

Reimplemented fromQ3CanvasItem::draw().

Draws the text using the painterpainter.

QFont Q3CanvasText::font() const

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() const

Reimplemented fromQ3CanvasItem::rtti().

Returns 3 (Q3CanvasItem::Rtti_Text).

See alsoQ3CanvasItem::rtti().

void Q3CanvasText::setColor(constQColor & c)

Sets the color of the text to the colorc.

See alsocolor() andsetFont().

void Q3CanvasText::setFont(constQFont & f)

Sets the font in which the text is drawn to fontf.

See alsofont().

void Q3CanvasText::setText(constQString & t)

Sets the text item's text tot. The text may contain newlines.

See alsotext(),setFont(),setColor(), andsetTextFlags().

void Q3CanvasText::setTextFlags(int f)

Sets the alignment flags tof. These are a bitwise OR of the flags available toQPainter::drawText() -- see theQt::AlignmentFlags.

See alsotextFlags(),setFont(), andsetColor().

QString Q3CanvasText::text() const

Returns the text item's text.

See alsosetText().

int Q3CanvasText::textFlags() const

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.


[8]ページ先頭

©2009-2025 Movatter.jp