---
name: "QwtRichText"
section: "3"
platform: "linux"
package: "libqwt-doc"
version: "4.2.0-6"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/QwtRichText"
---

# QwtRichText(3)

## NAME

QwtRichText -

## SYNOPSIS

Inherits **QwtText**.

## Detailed Description

Rich text drawing support.

Definition at line 155 of file qwt\_text.h.

### Public Member Functions

**QwtRichText** (const QString &text, const QFont &font, int align=Qt::AlignCenter\|Qt::WordBreak\|Qt::ExpandTabs, const QColor &color=QColor(), const QPen &pen=QPen(Qt::NoPen), const QBrush &brush=QBrush(Qt::NoBrush))\
 **QwtRichText** (const QString &, const QFont &, const QColor &)\
 virtual **~QwtRichText** ()\
 virtual **QwtText** \* **clone** () const\
 virtual void **setText** (const QString &text)\
 virtual void **setFont** (const QFont &font)\
 virtual void **setAlignment** (int align)\
 virtual int **heightForWidth** (int width) const\
 virtual QRect **boundingRect** (QPainter \*painter=0) const\
 virtual void **draw** (QPainter \*painter, const QRect &rect) const\

## Constructor & Destructor Documentation

### QwtRichText::QwtRichText (const QString & text, const QFont & font, int align = `Qt::AlignCenter | Qt::WordBreak | Qt::ExpandTabs`, const QColor & color = `QColor()`, const QPen & pen = `QPen(Qt::NoPen)`, const QBrush & brush = `QBrush(Qt::NoBrush)`)

Constructor.

**Parameters:**

*text* Contents of the text \
 *font* Font of the text \
 *align* Or'd values of Qt::AlignmentFlags for drawing the text \
 *color* Color of the text \
 *pen* Pen to draw the enclosing rectangle \
 *brush* Brush to draw the enclosing rectangle

Definition at line 291 of file qwt\_text.cpp.

References setText().

Referenced by clone().

### QwtRichText::QwtRichText (const QString & text, const QFont & font, const QColor & color)

Constructor.

**Parameters:**

*text* Text \
 *font* Font \
 *color* Color

Definition at line 306 of file qwt\_text.cpp.

References setText().

### QwtRichText::~QwtRichText ()` [virtual]`

Destructor.

Definition at line 316 of file qwt\_text.cpp.

## Member Function Documentation

### QRect QwtRichText::boundingRect (QPainter \* painter = `0`) const` [virtual]`

Returns the bounding rectangle.

The bounding rectangle is calculated with respect to (0, 0). The left and top border depend on the alignment flags:

- •

  the left border is at -width, -width/2 or 0 for Qt::AlignRight, Qt::AlignHCenter or Qt::AlignLeft respectively

- •

  the top border is at 0, -height/2 or -height for Qt::AlignTop, Qt::AlignVCenter or Qt::AlignBottom respectively

Use for instance QRect::moveBy(x,y), before drawing the text into the rectangle.

Implements **QwtText**.

Definition at line 408 of file qwt\_text.cpp.

References QwtText::alignment(), and QwtText::font().

Referenced by QwtPushButton::sizeHint().

### QwtText \* QwtRichText::clone () const` [virtual]`

Create a clone.

Implements **QwtText**.

Definition at line 322 of file qwt\_text.cpp.

References QwtText::alignment(), QwtText::color(), QwtText::font(), QwtRichText(), QwtText::rectBrush(), QwtText::rectPen(), and QwtText::text().

### void QwtRichText::draw (QPainter \* painter, const QRect & rect) const` [virtual]`

Draw the text in a clipping rectangle.

**Parameters:**

*painter* Painter \
 *rect* Clipping rectangle

Implements **QwtText**.

Definition at line 382 of file qwt\_text.cpp.

References QwtText::alignment(), QwtText::color(), QwtPainter::drawRect(), QwtPainter::drawSimpleRichText(), QwtText::font(), QwtText::rectBrush(), and QwtText::rectPen().

### int QwtRichText::heightForWidth (int width) const` [virtual]`

Find the height for a given width.

**Parameters:**

*width* Width

**Returns:**

height Height

Implements **QwtText**.

Definition at line 360 of file qwt\_text.cpp.

References QwtText::font().

### void QwtRichText::setAlignment (int align)` [virtual]`

Set the alignment.

Reimplemented from **QwtText**.

Definition at line 347 of file qwt\_text.cpp.

References QwtText::font(), QwtText::setAlignment(), and QwtText::text().

### void QwtRichText::setFont (const QFont & font)` [virtual]`

Set the font.

Reimplemented from **QwtText**.

Definition at line 338 of file qwt\_text.cpp.

References QwtText::setFont().

### void QwtRichText::setText (const QString & text)` [virtual]`

Set the text.

Reimplemented from **QwtText**.

Definition at line 329 of file qwt\_text.cpp.

References QwtText::alignment(), QwtText::font(), and QwtText::setText().

Referenced by QwtRichText().

## Author

Generated automatically by Doxygen for Qwt User's Guide from the source code.
