KD Chart 2  [rev.2.5]
Public Member Functions
KDChart::TextAttributes Class Reference

A set of text attributes. More...

#include <KDChartTextAttributes.h>

List of all members.

Public Member Functions

bool autoRotate () const
bool autoShrink () const
const QFont calculatedFont (const QObject *autoReferenceArea, KDChartEnums::MeasureOrientation autoReferenceOrientation) const
 Returns the font in the size that is used at drawing time.
const qreal calculatedFontSize (const QObject *autoReferenceArea, KDChartEnums::MeasureOrientation autoReferenceOrientation) const
 Returns the font size that is used at drawing time.
QFont font () const
Measure fontSize () const
bool hasAbsoluteFontSize () const
bool hasRotation () const
bool isVisible () const
Measure minimalFontSize () const
bool operator!= (const TextAttributes &other) const
TextAttributesoperator= (const TextAttributes &)
bool operator== (const TextAttributes &) const
QPen pen () const
void resetRotation ()
int rotation () const
void setAutoRotate (bool autoRotate)
 Set whether the text should be automatically rotated as needed when space is tight.
void setAutoShrink (bool autoShrink)
 Set whether the text should automatically be shrunk if space is tight.
void setFont (const QFont &font)
 Set the font to be used for rendering the text.
void setFontSize (const Measure &measure)
 Set the size of the font used for rendering text.
void setMinimalFontSize (const Measure &measure)
 Set the minimal size of the font used for rendering text.
void setPen (const QPen &pen)
 Set the pen to use for rendering the text.
void setRotation (int rotation)
 Set the rotation angle to use for the text.
void setTextDocument (QTextDocument *layout)
 Sets the document to use for the text.
void setVisible (bool visible)
 Set whether the text is to be rendered at all.
 TextAttributes ()
 TextAttributes (const TextAttributes &)
QTextDocumenttextDocument () const
 ~TextAttributes ()

Detailed Description

A set of text attributes.

TextAttributes encapsulates settings that have to do with text. This includes font, fontsize, color, whether the text is rotated, etc

Definition at line 46 of file KDChartTextAttributes.h.


Constructor & Destructor Documentation

TextAttributes::TextAttributes ( )

Definition at line 71 of file KDChartTextAttributes.cpp.

TextAttributes::TextAttributes ( const TextAttributes r)

Definition at line 76 of file KDChartTextAttributes.cpp.

TextAttributes::~TextAttributes ( )

Definition at line 92 of file KDChartTextAttributes.cpp.


Member Function Documentation

bool TextAttributes::autoRotate ( ) const
Returns:
Whether text is automatically rotated when space is tight.

Definition at line 204 of file KDChartTextAttributes.cpp.

References d.

Referenced by operator<<(), operator==(), KDChart::CartesianAxis::paintCtx(), and setAutoRotate().

bool TextAttributes::autoShrink ( ) const
Returns:
Whether text is automatically shrunk if space is tight.

Definition at line 214 of file KDChartTextAttributes.cpp.

References d.

Referenced by operator<<(), operator==(), and setAutoShrink().

const QFont TextAttributes::calculatedFont ( const QObject autoReferenceArea,
KDChartEnums::MeasureOrientation  autoReferenceOrientation 
) const

Returns the font in the size that is used at drawing time.

This method is called at drawing time. It returns the font as it is used for rendering text, taking into account any measures that were set via setFontSize and/or setMinimalFontSize.

Definition at line 179 of file KDChartTextAttributes.cpp.

References calculatedFontSize(), d, and KDChart::CartesianCoordinatePlane::hasFixedDataCoordinateSpaceRelation().

Referenced by KDChart::LeveyJenningsDiagram::iconRect().

const qreal TextAttributes::calculatedFontSize ( const QObject autoReferenceArea,
KDChartEnums::MeasureOrientation  autoReferenceOrientation 
) const

Returns the font size that is used at drawing time.

This method is called at drawing time. It returns the font size as it is used for rendering text, taking into account any measures that were set via setFontSize and/or setMinimalFontSize.

Definition at line 169 of file KDChartTextAttributes.cpp.

References KDChart::Measure::calculatedValue(), fontSize(), and minimalFontSize().

Referenced by calculatedFont().

QFont TextAttributes::font ( ) const
Returns:
The font that is used for rendering text.

Definition at line 134 of file KDChartTextAttributes.cpp.

References d.

Referenced by operator<<(), operator==(), KDChart::RadarDiagram::paint(), setFont(), and KDChart::TextLayoutItem::setTextAttributes().

Measure TextAttributes::fontSize ( ) const
Returns:
The measure used for the font size.

Definition at line 144 of file KDChartTextAttributes.cpp.

References d.

Referenced by calculatedFontSize(), operator<<(), operator==(), and KDChart::CartesianAxis::titleTextAttributes().

bool TextAttributes::hasAbsoluteFontSize ( ) const
Returns:
Whether the text has an absolute font size set.

Definition at line 159 of file KDChartTextAttributes.cpp.

References d, and KDChartEnums::MeasureCalculationModeAbsolute.

bool TextAttributes::hasRotation ( ) const

Definition at line 236 of file KDChartTextAttributes.cpp.

References d.

bool TextAttributes::isVisible ( ) const
Measure TextAttributes::minimalFontSize ( ) const
Returns:
The measure used for the minimal font size.

Definition at line 154 of file KDChartTextAttributes.cpp.

References d.

Referenced by calculatedFontSize(), operator<<(), and operator==().

bool KDChart::TextAttributes::operator!= ( const TextAttributes other) const

Definition at line 53 of file KDChartTextAttributes.h.

References KDGantt::operator==().

TextAttributes & TextAttributes::operator= ( const TextAttributes r)

Definition at line 82 of file KDChartTextAttributes.cpp.

References d.

bool TextAttributes::operator== ( const TextAttributes r) const
QPen TextAttributes::pen ( ) const
Returns:
The pen used for rendering the text.

Definition at line 246 of file KDChartTextAttributes.cpp.

References d.

Referenced by operator<<(), operator==(), KDChart::RadarDiagram::paint(), KDChart::LeveyJenningsAxis::paintAsOrdinate(), setPen(), and KDChart::LeveyJenningsAxis::setType().

void TextAttributes::resetRotation ( )

Definition at line 230 of file KDChartTextAttributes.cpp.

References d.

int TextAttributes::rotation ( ) const
Returns:
The rotation angle used for rendering the text.

Definition at line 225 of file KDChartTextAttributes.cpp.

References d.

Referenced by fitFontSizeToGeometry(), KDChart::TextLayoutItem::intersects(), operator<<(), operator==(), KDChart::CartesianAxis::paintCtx(), and setRotation().

void TextAttributes::setAutoRotate ( bool  autoRotate)

Set whether the text should be automatically rotated as needed when space is tight.

Parameters:
autoRotateWhether text should be automatically rotated.

Definition at line 199 of file KDChartTextAttributes.cpp.

References autoRotate(), and d.

void TextAttributes::setAutoShrink ( bool  autoShrink)

Set whether the text should automatically be shrunk if space is tight.

Parameters:
autoShrinkWhether text should be auto-shrunk.

Definition at line 209 of file KDChartTextAttributes.cpp.

References autoShrink(), and d.

void TextAttributes::setFont ( const QFont &  font)

Set the font to be used for rendering the text.

Note:
All of the font's attributes will be used - except of its size! To specify the size please use setFontSize (or setMinimalFontSize, resp.)
Parameters:
fontThe font to use.
See also:
setFontSize, setMinimalFontSize

Definition at line 127 of file KDChartTextAttributes.cpp.

References d, and font().

void TextAttributes::setFontSize ( const Measure measure)

Set the size of the font used for rendering text.

Parameters:
measureThe measure to use.
See also:
Measure

Definition at line 139 of file KDChartTextAttributes.cpp.

References d.

Referenced by KDChart::Chart::addLegend(), KDChart::LeveyJenningsDiagram::iconRect(), and KDChart::CartesianAxis::titleTextAttributes().

void TextAttributes::setMinimalFontSize ( const Measure measure)

Set the minimal size of the font used for rendering text.

Parameters:
measureThe measure to use.
See also:
Measure

Definition at line 149 of file KDChartTextAttributes.cpp.

References d.

void TextAttributes::setPen ( const QPen &  pen)

Set the pen to use for rendering the text.

Parameters:
penThe pen to use.

Definition at line 241 of file KDChartTextAttributes.cpp.

References d, and pen().

Referenced by KDChart::LeveyJenningsAxis::setType().

void TextAttributes::setRotation ( int  rotation)

Set the rotation angle to use for the text.

Note:
For axis titles the rotation angle can be set to one of the following angles: 0, 90, 180, 270 Any other values specified will be replaced by the next smaller one of the allowed values, so no matter what you set the rotation will always be one of these four values.
Parameters:
rotationThe rotation angle.

Definition at line 219 of file KDChartTextAttributes.cpp.

References d, and rotation().

Referenced by KDChart::CartesianAxis::paintCtx().

void TextAttributes::setTextDocument ( QTextDocument layout)

Sets the document to use for the text.

The previous document is deleted.

Definition at line 256 of file KDChartTextAttributes.cpp.

References d.

void TextAttributes::setVisible ( bool  visible)

Set whether the text is to be rendered at all.

Parameters:
visibleWhether the text is visible.

Definition at line 117 of file KDChartTextAttributes.cpp.

References d.

QTextDocument * TextAttributes::textDocument ( ) const
Returns:
The document used for the drawing the text or NULL if the default document is used.

Definition at line 251 of file KDChartTextAttributes.cpp.

References d.

Referenced by operator==().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-chart/