Qt 4.8
Public Types | Public Functions | List of all members
QTextItem Class Reference

The QTextItem class provides all the information required to draw text in a custom paint engine. More...

#include <qpaintengine.h>

Inheritance diagram for QTextItem:
QTextItemInt

Public Types

enum  RenderFlag {
  RightToLeft = 0x1, Overline = 0x10, Underline = 0x20, StrikeOut = 0x40,
  Dummy = 0xffffffff
}
 

Public Functions

qreal ascent () const
 Corresponds to the ascent of the piece of text that is drawn. More...
 
qreal descent () const
 Corresponds to the descent of the piece of text that is drawn. More...
 
QFont font () const
 Returns the font that should be used to draw the text. More...
 
RenderFlags renderFlags () const
 Returns the render flags used. More...
 
QString text () const
 Returns the text that should be drawn. More...
 
qreal width () const
 Specifies the total width of the text to be drawn. More...
 

Detailed Description

The QTextItem class provides all the information required to draw text in a custom paint engine.

When you reimplement your own paint engine, you must reimplement QPaintEngine::drawTextItem(), a function that takes a QTextItem as one of its arguments.

Definition at line 68 of file qpaintengine.h.

Enumerations

◆ RenderFlag

  • RightToLeft Render the text from right to left.
  • Overline Paint a line above the text.
  • Underline Paint a line under the text.
  • StrikeOut Paint a line through the text.
  • Dummy
Enumerator
RightToLeft 
Overline 
Underline 
StrikeOut 
Dummy 

Definition at line 70 of file qpaintengine.h.

70  {
71  RightToLeft = 0x1,
72  Overline = 0x10,
73  Underline = 0x20,
74  StrikeOut = 0x40,
75 
76  Dummy = 0xffffffff
77  };

Functions

◆ ascent()

qreal QTextItem::ascent ( ) const

Corresponds to the ascent of the piece of text that is drawn.

Definition at line 104 of file qpaintengine.cpp.

Referenced by QAlphaPaintEngine::drawTextItem(), QPicturePaintEngine::drawTextItem(), QPaintBufferEngine::drawTextItem(), and QTextItemInt::initWithScriptItem().

105 {
106  const QTextItemInt *ti = static_cast<const QTextItemInt *>(this);
107  return ti->ascent.toReal();
108 }
Internal QTextItem.
qreal toReal() const
Definition: qfixed_p.h:77

◆ descent()

qreal QTextItem::descent ( ) const

Corresponds to the descent of the piece of text that is drawn.

Definition at line 90 of file qpaintengine.cpp.

Referenced by QAlphaPaintEngine::drawTextItem(), QPaintBufferEngine::drawTextItem(), and QTextItemInt::initWithScriptItem().

91 {
92  const QTextItemInt *ti = static_cast<const QTextItemInt *>(this);
93  return ti->descent.toReal();
94 }
Internal QTextItem.
qreal toReal() const
Definition: qfixed_p.h:77

◆ font()

QFont QTextItem::font ( ) const

Returns the font that should be used to draw the text.

Definition at line 160 of file qpaintengine.cpp.

Referenced by QPicturePaintEngine::drawTextItem(), QVGPaintEngine::drawTextItem(), QSvgPaintEngine::drawTextItem(), QPaintBufferEngine::drawTextItem(), QStaticTextPrivate::get(), QBlittablePixmapData::markRasterOverlay(), QPainterReplayer::process(), and QTextItemInt::QTextItemInt().

161 {
162  const QTextItemInt *ti = static_cast<const QTextItemInt *>(this);
163  return ti->f ? *ti->f : QApplication::font();
164 }
static QFont font()
Returns the default application font.
Internal QTextItem.
const QFont * f

◆ renderFlags()

QTextItem::RenderFlags QTextItem::renderFlags ( ) const

Returns the render flags used.

Definition at line 132 of file qpaintengine.cpp.

Referenced by QPicturePaintEngine::drawTextItem(), and QPaintBufferEngine::drawTextItem().

133 {
134  const QTextItemInt *ti = static_cast<const QTextItemInt *>(this);
135  return ti->flags;
136 }
RenderFlags flags
Internal QTextItem.

◆ text()

QString QTextItem::text ( ) const

Returns the text that should be drawn.

Definition at line 146 of file qpaintengine.cpp.

Referenced by QPaintBuffer::commandDescription(), QDirectFBPaintEngine::drawTextItem(), QPicturePaintEngine::drawTextItem(), QPaintBufferEngine::drawTextItem(), QPainter::drawTextItem(), QBlittablePixmapData::markRasterOverlay(), and QPainterReplayer::process().

147 {
148  const QTextItemInt *ti = static_cast<const QTextItemInt *>(this);
149  return QString(ti->chars, ti->num_chars);
150 }
const QChar * chars
The QString class provides a Unicode character string.
Definition: qstring.h:83
Internal QTextItem.

◆ width()

qreal QTextItem::width ( ) const

Specifies the total width of the text to be drawn.

Definition at line 118 of file qpaintengine.cpp.

Referenced by QAlphaPaintEngine::drawTextItem(), QPaintBufferEngine::drawTextItem(), qt_fill_tile(), and glyph_metrics_t::transformed().

119 {
120  const QTextItemInt *ti = static_cast<const QTextItemInt *>(this);
121  return ti->width.toReal();
122 }
Internal QTextItem.
qreal toReal() const
Definition: qfixed_p.h:77

The documentation for this class was generated from the following files: