The Q3CanvasText class provides a text object on a Q3Canvas . 更多...
| 头: | #include <Q3CanvasText> |
| 继承: | 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 ) |
The Q3CanvasText class provides a text object on a Q3Canvas .
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 with setText () 和 setFont (). The color is set with setColor () and the alignment with setTextFlags (). The text item's bounding rectangle is retrieved with boundingRect ().
The text can be drawn on a painter with draw ().
Like any other canvas item text items can be moved with Q3CanvasItem::move () 和 Q3CanvasItem::moveBy (), or by setting coordinates with Q3CanvasItem::setX (), Q3CanvasItem::setY () 和 Q3CanvasItem::setZ ().
另请参阅 QtCanvas and Porting to Graphics View .
构造 Q3CanvasText with the text "<text>", on canvas .
构造 Q3CanvasText with the text t , on canvas canvas .
构造 Q3CanvasText with the text t and font f , on the canvas canvas .
[虚拟]
Q3CanvasText::
~Q3CanvasText
()
Destroys the canvas text item.
[虚拟]
QRect
Q3CanvasText::
boundingRect
() const
重实现自 Q3CanvasItem::boundingRect ().
Returns the bounding rectangle of the text.
[虚拟]
bool
Q3CanvasText::
collidesWith
(const
Q3CanvasItem
*
i
) const
重实现自 Q3CanvasItem::collidesWith ().
Returns the color of the text.
另请参阅 setColor ().
[virtual protected]
void
Q3CanvasText::
draw
(
QPainter
&
painter
)
重实现自 Q3CanvasItem::draw ().
Draws the text using the painter painter .
Returns the font in which the text is drawn.
另请参阅 setFont ().
[虚拟]
void
Q3CanvasText::
moveBy
(
double
dx
,
double
dy
)
重实现自 Q3CanvasItem::moveBy ().
[虚拟]
int
Q3CanvasText::
rtti
() const
重实现自 Q3CanvasItem::rtti ().
Returns 3 ( Q3CanvasItem::Rtti_Text ).
另请参阅 Q3CanvasItem::rtti ().
Sets the color of the text to the color c .
Sets the font in which the text is drawn to font f .
另请参阅 font ().
Sets the text item's text to t . The text may contain newlines.
另请参阅 text (), setFont (), setColor (),和 setTextFlags ().
Sets the alignment flags to f . These are a bitwise OR of the flags available to QPainter::drawText () -- see the Qt::AlignmentFlag 。
另请参阅 textFlags (), setFont (),和 setColor ().
Returns the text item's text.
另请参阅 setText ().
Returns the currently set alignment flags.
另请参阅 setTextFlags () 和 Qt::AlignmentFlag .