26 #include <KDChartCartesianCoordinatePlane_p.h>
31 #include <QApplication>
32 #include <QSharedPointer>
33 #include <QTextDocument>
34 #include <KDABLibFakes>
38 using namespace KDChart;
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 ),
72 TextAttributes::TextAttributes()
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()