Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

QwtText Class Reference

Inheritance diagram for QwtText:

QwtPlainText QwtRichText List of all members.

Detailed Description

A virtual class to draw text.

QwtText is an interface class for drawing plain and rich text. It provides also an interface for text classes that understand other text description languages such as LaTeX or LyX.

Warning:
Rich text in Qt-2.3.x does not understand sub- and super-scripts. Qt-3.x.x does a better job in rendering mathematics.


Public Member Functions

virtual ~QwtText ()
virtual void setText (const QString &)
QString text () const
bool isNull () const
bool isEmpty () const
bool operator! () const
virtual void setFont (const QFont &)
QFont font () const
QFontMetrics fontMetrics () const
virtual void setAlignment (int align)
int alignment () const
virtual void setColor (const QColor &)
QColor color () const
virtual void setRectPen (const QPen &)
QPen rectPen () const
virtual void setRectBrush (const QBrush &)
QBrush rectBrush () const
virtual int heightForWidth (int width) const =0
virtual QRect boundingRect (QPainter *painter=0) const =0
virtual void draw (QPainter *painter, const QRect &rect) const =0
virtual QwtTextclone () const =0

Static Public Member Functions

QwtTextmakeText (const QString &, Qt::TextFormat, int align, const QFont &, const QColor &color=QColor(), const QPen &pen=QPen(Qt::NoPen), const QBrush &brush=QBrush(Qt::NoBrush))
QwtTextmakeText (const QString &, int align, const QFont &, const QColor &color=QColor(), const QPen &pen=QPen(Qt::NoPen), const QBrush &brush=QBrush(Qt::NoBrush))
void setDefaultFormat (Qt::TextFormat)
Qt::TextFormat defaultFormat ()

Protected Member Functions

 QwtText (const QString &text, const QFont &, int align, const QColor &, const QPen &pen=QPen(Qt::NoPen), const QBrush &brush=QBrush(Qt::NoBrush))


Constructor & Destructor Documentation

QwtText::~QwtText  )  [virtual]
 

Destructor.

QwtText::QwtText const QString &  text,
const QFont &  font,
int  align,
const QColor &  color,
const QPen &  pen = QPen(Qt::NoPen),
const QBrush &  brush = QBrush(Qt::NoBrush)
[protected]
 

Constructor.

Parameters:
text Text
font Font
align Alignment flags
color Color
pen Pen
brush Brush


Member Function Documentation

int QwtText::alignment  )  const
 

Get the alignment flags.

virtual QRect QwtText::boundingRect QPainter *  painter = 0  )  const [pure 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.

Implemented in QwtPlainText, and QwtRichText.

virtual QwtText* QwtText::clone  )  const [pure virtual]
 

Create a clone

Implemented in QwtPlainText, and QwtRichText.

QColor QwtText::color  )  const
 

Return the color.

Qt::TextFormat QwtText::defaultFormat  )  [static]
 

Return default format for the QwtText factory.

virtual void QwtText::draw QPainter *  painter,
const QRect &  rect
const [pure virtual]
 

Draw the text in a clipping rectangle.

Parameters:
painter Painter
rect Clipping rectangle

Implemented in QwtPlainText, and QwtRichText.

QFont QwtText::font  )  const
 

Return the font.

QFontMetrics QwtText::fontMetrics  )  const
 

Return the font metrics.

virtual int QwtText::heightForWidth int  width  )  const [pure virtual]
 

Find the height for a given width.

Parameters:
width Width
Returns:
height Height

Implemented in QwtPlainText, and QwtRichText.

QwtText * QwtText::makeText const QString &  text,
int  align,
const QFont &  font,
const QColor &  color = QColor(),
const QPen &  pen = QPen(Qt::NoPen),
const QBrush &  brush = QBrush(Qt::NoBrush)
[static]
 

Factory function for QwtText objects. Creates a text according to QwtText::defaultFormat()

Parameters:
text Contents of the text
align Or'd values of Qt::AlignmentFlags for drawing the text
font Font of the text
color Color of the text
pen Pen to draw the enclosing rectangle
brush Brush to draw the enclosing rectangle
Returns:
Pointer to a new QwtPlainText or QwtRichText object
See also:
QwtText::defaultFormat, QwtText::setDefaultFormat

QwtText * QwtText::makeText const QString &  text,
Qt::TextFormat  format,
int  align,
const QFont &  font,
const QColor &  color = QColor(),
const QPen &  pen = QPen(Qt::NoPen),
const QBrush &  brush = QBrush(Qt::NoBrush)
[static]
 

Factory function for QwtText objects.

Parameters:
text Contents of the text
format Format of the text
align Or'd values of Qt::AlignmentFlags for drawing the text
font Font of the text
color Color of the text
pen Pen to draw the enclosing rectangle
brush Brush to draw the enclosing rectangle
Returns:
Pointer to a new QwtPlainText or QwtRichText object

QBrush QwtText::rectBrush  )  const
 

Return the rectangle brush.

QPen QwtText::rectPen  )  const
 

Return the rectangle pen.

void QwtText::setAlignment int  align  )  [virtual]
 

Set the alignment flags.

Parameters:
align Or'd Qt::Alignment flags

Reimplemented in QwtRichText.

void QwtText::setColor const QColor &   )  [virtual]
 

Set the color.

void QwtText::setDefaultFormat Qt::TextFormat   )  [static]
 

Set the default format for the QwtText factory.

void QwtText::setFont const QFont &   )  [virtual]
 

Set the font.

Reimplemented in QwtRichText.

void QwtText::setRectBrush const QBrush &   )  [virtual]
 

Set the rectangle brush.

void QwtText::setRectPen const QPen &   )  [virtual]
 

Set the rectangle pen.

void QwtText::setText const QString &   )  [virtual]
 

Set the text.

Reimplemented in QwtRichText.

QString QwtText::text  )  const
 

Return the text.


Generated on Tue Nov 25 21:15:09 2003 for Qwt User's Guide by doxygen 1.3.4