Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | 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.

Definition at line 37 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 setFlags (int flags)
int flags () 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

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

Protected Member Functions

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


Constructor & Destructor Documentation

QwtText::~QwtText  )  [virtual]
 

Destructor.

Definition at line 102 of file qwt_text.cpp.

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

Constructor.

Parameters:
text Text
font Font
flags Or'd Qt::Alignment or Qt::TextFlags flags
color Color
pen Pen
brush Brush

Definition at line 95 of file qwt_text.cpp.

References color(), font(), and text().


Member Function Documentation

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 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 QwtRichText::boundingRect(), and QwtPlainText::boundingRect().

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

Create a clone

Implemented in QwtPlainText, and QwtRichText.

QColor QwtText::color  )  const
 

Return the color.

Definition at line 231 of file qwt_text.cpp.

Referenced by QwtRichText::clone(), QwtPlainText::clone(), QwtRichText::draw(), QwtPlainText::draw(), QwtPlotMarker::labelColor(), makeText(), QwtText(), and setColor().

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

Return default format for the QwtText factory.

Definition at line 173 of file qwt_text.cpp.

Referenced by makeText().

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 QwtLegendItem::drawItem(), QwtPicker::drawTracker(), and QwtPlot::printTitle().

int QwtText::flags  )  const
 

Get the flags.

Definition at line 219 of file qwt_text.cpp.

Referenced by QwtPlainText::boundingRect(), QwtRichText::clone(), QwtPlainText::clone(), QwtRichText::draw(), QwtPlainText::draw(), QwtPlainText::heightForWidth(), setFlags(), and QwtRichText::setText().

QFont QwtText::font  )  const
 

Return the font.

Definition at line 198 of file qwt_text.cpp.

Referenced by QwtPlainText::boundingRect(), QwtRichText::clone(), QwtPlainText::clone(), QwtRichText::draw(), QwtPlainText::draw(), makeText(), QwtText(), QwtRichText::setFlags(), setFont(), and QwtRichText::setText().

QFontMetrics QwtText::fontMetrics  )  const
 

Return the font metrics.

Definition at line 204 of file qwt_text.cpp.

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

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 QwtRichText::heightForWidth(), and QwtPlainText::heightForWidth().

QwtText * QwtText::makeText const QString &  text,
int  flags,
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
flags Or'd Qt::Alignment or Qt::TextFlags flags
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 120 of file qwt_text.cpp.

References color(), defaultFormat(), font(), makeText(), and text().

QwtText * QwtText::makeText const QString &  text,
Qt::TextFormat  format,
int  flags,
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
flags Or'd Qt::Alignment or Qt::TextFlags flags
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 140 of file qwt_text.cpp.

References color(), font(), and text().

Referenced by QwtPicker::drawTracker(), makeText(), QwtPlot::printTitle(), QwtPlotMarker::setLabel(), QwtScaleWidget::setTitle(), and QwtLegendItem::titleText().

QBrush QwtText::rectBrush  )  const
 

Return the rectangle brush.

Definition at line 255 of file qwt_text.cpp.

Referenced by QwtRichText::clone(), QwtPlainText::clone(), QwtRichText::draw(), QwtPlainText::draw(), and setRectBrush().

QPen QwtText::rectPen  )  const
 

Return the rectangle pen.

Definition at line 243 of file qwt_text.cpp.

Referenced by QwtRichText::clone(), QwtPlainText::clone(), QwtRichText::draw(), QwtPlainText::draw(), and setRectPen().

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

Set the color.

Definition at line 225 of file qwt_text.cpp.

References color().

Referenced by QwtPlotMarker::setLabelColor(), and QwtPlotMarker::setLabelPen().

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

Set the default format for the QwtText factory.

Definition at line 167 of file qwt_text.cpp.

void QwtText::setFlags int  flags  )  [virtual]
 

Set the flags.

Parameters:
flags Or'd Qt::Alignment or Qt::TextFlags flags

Reimplemented in QwtRichText.

Definition at line 213 of file qwt_text.cpp.

References flags().

Referenced by QwtRichText::setFlags().

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

Set the font.

Reimplemented in QwtRichText.

Definition at line 191 of file qwt_text.cpp.

References font(), and fontMetrics().

Referenced by QwtPlainText::boundingRect(), QwtRichText::draw(), QwtPlainText::draw(), and QwtRichText::setFont().

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

Set the rectangle brush.

Definition at line 249 of file qwt_text.cpp.

References rectBrush().

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

Set the rectangle pen.

Definition at line 237 of file qwt_text.cpp.

References rectPen().

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

Set the text.

Reimplemented in QwtRichText.

Definition at line 179 of file qwt_text.cpp.

References text().

Referenced by QwtRichText::setText().

QString QwtText::text  )  const
 

Return the text.

Definition at line 185 of file qwt_text.cpp.

Referenced by QwtPlainText::boundingRect(), QwtRichText::clone(), QwtPlainText::clone(), QwtPlainText::draw(), QwtPlainText::heightForWidth(), QwtPlotMarker::label(), makeText(), QwtText(), QwtRichText::setFlags(), and setText().


Generated on Wed Aug 31 23:03:55 2005 for Qwt User's Guide by  doxygen 1.4.1