26 #include <KDChartCartesianCoordinatePlane_p.h> 31 #include <QApplication> 32 #include <QSharedPointer> 33 #include <QTextDocument> 34 #include <KDABLibFakes> 40 class TextAttributes::Private
48 mutable QFont cachedFont;
49 mutable qreal cachedFontSize;
57 QSharedPointer<QTextDocument> document;
60 TextAttributes::Private::Private()
62 font( QApplication::font() ),
63 cachedFontSize( -1.0 ),
78 : _d( new Private( *r.
d ) )
103 const QFont myFont(
font() );
104 QFont r_font( r.
font() );
105 r_font.setStyleHint( myFont.styleHint(), myFont.styleStrategy() );
120 d->visible = visible;
131 d->cachedFont =
font;
132 d->cachedFontSize = -1.0;
142 d->fontSize = measure;
152 d->minimalFontSize = measure;
157 return d->minimalFontSize;
171 return qMax( normalSize, minimalSize );
174 #if QT_VERSION < 0x040400 || defined(Q_COMPILER_MANGLES_RETURN_TYPE) 182 return qMax( normalSize, minimalSize );
197 CartesianCoordinatePlane::Private *priv
198 = CartesianCoordinatePlane::Private::get( const_cast< CartesianCoordinatePlane * >( plane ) );
200 autoReferenceOrientation );
205 if ( size > 0.0 &&
d->cachedFontSize != size ) {
206 d->cachedFontSize = size;
207 d->cachedFont.setPointSizeF(
d->cachedFontSize );
210 return d->cachedFont;
221 return d->autoRotate;
231 return d->autoShrink;
236 d->hasRotation =
true;
247 d->hasRotation =
false;
253 return d->hasRotation;
268 return d->document.data();
273 d->document = QSharedPointer<QTextDocument>(document);
276 #if !defined(QT_NO_DEBUG_STREAM) 279 dbg <<
"KDChart::TextAttributes(" 281 <<
"font=" << ta.
font().toString()
287 <<
"pen=" << ta.
pen()
MeasureOrientation
Measure orientation mode: the way how the absolute value of a KDChart::Measure is determined during K...
bool operator==(const TextAttributes &) const
qreal calculatedValue(const QObject *autoArea, KDChartEnums::MeasureOrientation autoOrientation) const
The reference area must either be derived from AbstractArea or from QWidget, so it can also be derive...
void setPen(const QPen &pen)
Set the pen to use for rendering the text.
QTextDocument * textDocument() const
bool hasAbsoluteFontSize() const
void setAutoShrink(bool autoShrink)
Set whether the text should automatically be shrunk if space is tight.
void setRotation(int rotation)
Set the rotation angle to use for the text.
void setFontSize(const Measure &measure)
Set the size of the font used for rendering text.
void setFont(const QFont &font)
Set the font to be used for rendering the text.
const QFont calculatedFont(const QObject *autoReferenceArea, KDChartEnums::MeasureOrientation autoReferenceOrientation) const
Returns the font in the size that is used at drawing time.
bool hasFixedDataCoordinateSpaceRelation() const
Class only listed here to document inheritance of some KDChart classes.
TextAttributes & operator=(const TextAttributes &)
Measure is used to specify relative and absolute sizes in KDChart, e.g.
Class only listed here to document inheritance of some KDChart classes.
void setMinimalFontSize(const Measure &measure)
Set the minimal size of the font used for rendering text.
Cartesian coordinate plane.
QDebug operator<<(QDebug stream, const DataDimension &r)
Measure minimalFontSize() const
void setVisible(bool visible)
Set whether the text is to be rendered at all.
void setTextDocument(QTextDocument *layout)
Sets the document to use for the text.
qreal calculatedFontSize(const QSizeF &referenceSize, KDChartEnums::MeasureOrientation autoReferenceOrientation) const
Returns the font size that is used at drawing time.
A set of text attributes.
void setAutoRotate(bool autoRotate)
Set whether the text should be automatically rotated as needed when space is tight.