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

QwtText Class Reference

Inheritance diagram for QwtText:

Inheritance graph
[legend]
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.

Definition at line 35 of file qwt_text.h.

Public Member Functions

virtual ~QwtText ()
virtual void setText (const QString &)
QString text () const
bool isNull () const
bool isEmpty () 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.

Definition at line 44 of file qwt_text.cpp.

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
Definition at line 31 of file qwt_text.cpp.


Member Function Documentation

int QwtText::alignment  )  const
 

Get the alignment flags.

Definition at line 151 of file qwt_text.cpp.

Referenced by QwtRichText::boundingRect(), QwtPlainText::boundingRect(), QwtRichText::clone(), QwtPlainText::clone(), QwtRichText::draw(), QwtPlainText::draw(), QwtScale::drawTitle(), QwtPlainText::heightForWidth(), QwtMarker::setLabel(), QwtRichText::setText(), QwtScale::setTitle(), and QwtScale::titleAlignment().

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.

Referenced by QwtMarker::draw(), QwtPicker::drawCursorLabel(), and QwtPushButton::heightForWidth().

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

Create a clone

Implemented in QwtPlainText, and QwtRichText.

Referenced by QwtMarker::operator=(), and QwtMarker::QwtMarker().

QColor QwtText::color  )  const
 

Return the color.

Definition at line 163 of file qwt_text.cpp.

Referenced by QwtRichText::clone(), QwtPlainText::clone(), QwtRichText::draw(), QwtPlainText::draw(), QwtMarker::labelColor(), QwtMarker::labelPen(), QwtMarker::setLabel(), QwtMarker::setLabelColor(), QwtMarker::setLabelPen(), QwtMarker::setLabelText(), QwtScale::setTitle(), and QwtScale::titleColor().

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

Return default format for the QwtText factory.

Definition at line 105 of file qwt_text.cpp.

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.

Referenced by QwtMarker::draw(), QwtPicker::drawCursorLabel(), QwtLegendItem::drawItem(), QwtScale::drawTitle(), and QwtPlot::printTitle().

QFont QwtText::font  )  const
 

Return the font.

Definition at line 130 of file qwt_text.cpp.

Referenced by QwtRichText::boundingRect(), QwtPlainText::boundingRect(), QwtRichText::clone(), QwtPlainText::clone(), QwtRichText::draw(), QwtPlainText::draw(), QwtMarker::font(), QwtRichText::heightForWidth(), QwtRichText::setAlignment(), QwtMarker::setFont(), QwtMarker::setLabel(), QwtMarker::setLabelText(), QwtRichText::setText(), QwtScale::setTitle(), QwtScale::setTitleFont(), and QwtScale::titleFont().

QFontMetrics QwtText::fontMetrics  )  const
 

Return the font metrics.

Definition at line 136 of file qwt_text.cpp.

Referenced by QwtPlainText::boundingRect(), and QwtPlainText::heightForWidth().

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.

Referenced by QwtPushButton::heightForWidth(), and QwtScale::titleHeightForWidth().

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
Definition at line 61 of file qwt_text.cpp.

References makeText().

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
Definition at line 81 of file qwt_text.cpp.

Referenced by QwtPicker::drawCursorLabel(), QwtPushButton::heightForWidth(), makeText(), QwtPlot::printTitle(), QwtMarker::QwtMarker(), QwtMarker::setLabel(), QwtScale::setTitle(), QwtLegendLabel::titleText(), and QwtLegendButton::titleText().

QBrush QwtText::rectBrush  )  const
 

Return the rectangle brush.

Definition at line 187 of file qwt_text.cpp.

Referenced by QwtRichText::clone(), QwtPlainText::clone(), QwtRichText::draw(), QwtPlainText::draw(), QwtMarker::setLabel(), and QwtMarker::setLabelText().

QPen QwtText::rectPen  )  const
 

Return the rectangle pen.

Definition at line 175 of file qwt_text.cpp.

Referenced by QwtRichText::clone(), QwtPlainText::clone(), QwtRichText::draw(), QwtPlainText::draw(), QwtMarker::setLabel(), and QwtMarker::setLabelText().

void QwtText::setAlignment int  align  )  [virtual]
 

Set the alignment flags.

Parameters:
align Or'd Qt::Alignment flags

Reimplemented in QwtRichText.

Definition at line 145 of file qwt_text.cpp.

Referenced by QwtScale::drawTitle(), QwtRichText::setAlignment(), and QwtScale::setTitleAlignment().

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

Set the color.

Definition at line 157 of file qwt_text.cpp.

Referenced by QwtMarker::setLabelColor(), QwtMarker::setLabelPen(), and QwtScale::setTitleColor().

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

Set the default format for the QwtText factory.

Definition at line 99 of file qwt_text.cpp.

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

Set the font.

Reimplemented in QwtRichText.

Definition at line 123 of file qwt_text.cpp.

Referenced by QwtRichText::setFont(), QwtMarker::setFont(), and QwtScale::setTitleFont().

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

Set the rectangle brush.

Definition at line 181 of file qwt_text.cpp.

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

Set the rectangle pen.

Definition at line 169 of file qwt_text.cpp.

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

Set the text.

Reimplemented in QwtRichText.

Definition at line 111 of file qwt_text.cpp.

Referenced by QwtRichText::setText().

QString QwtText::text  )  const
 

Return the text.

Definition at line 117 of file qwt_text.cpp.

Referenced by QwtPlainText::boundingRect(), QwtRichText::clone(), QwtPlainText::clone(), QwtScale::dimForLength(), QwtPlainText::draw(), QwtMarker::draw(), QwtPlainText::heightForWidth(), QwtMarker::label(), QwtRichText::setAlignment(), QwtMarker::setLabel(), and QwtScale::title().


Generated on Tue Nov 16 21:12:42 2004 for Qwt User's Guide by doxygen 1.3.8