30 #include <KDABLibFakes>
34 using namespace KDChart;
36 class RulerAttributes::Private
54 bool majorTickLengthIsSet : 1;
55 bool minorTickLengthIsSet : 1;
66 RulerAttributes::Private::Private()
67 : tickMarkPen( Qt::black )
68 , majorTickMarkPen( Qt::black )
69 , minorTickMarkPen( Qt::black )
70 , majorTickMarkPenIsSet( false )
71 , minorTickMarkPenIsSet( false )
72 , showMajorTickMarks( true )
73 , showMinorTickMarks( true )
74 , showRulerLine( false )
75 , majorTickLengthIsSet( false )
76 , minorTickLengthIsSet( false )
77 , showFirstTick( true )
79 , majorTickLength( 3 )
80 , minorTickLength( 2 )
82 tickMarkPen.setCapStyle( Qt::FlatCap );
83 majorTickMarkPen.setCapStyle( Qt::FlatCap );
84 minorTickMarkPen.setCapStyle( Qt::FlatCap );
87 RulerAttributes::RulerAttributes()
94 : _d( new Private( *r.
d ) )
100 d->tickMarkPen = pen;
105 return d->tickMarkPen;
110 d->majorTickMarkPen = pen;
111 d->majorTickMarkPenIsSet =
true;
116 return d->majorTickMarkPenIsSet;
121 return d->majorTickMarkPenIsSet ?
d->majorTickMarkPen :
d->tickMarkPen;
126 d->minorTickMarkPen = pen;
127 d->minorTickMarkPenIsSet =
true;
132 return d->minorTickMarkPenIsSet;
137 return d->minorTickMarkPenIsSet ?
d->minorTickMarkPen :
d->tickMarkPen;
142 if ( !
d->customTickMarkPens.contains( value ) )
143 d->customTickMarkPens.insert( value, pen );
148 QMapIterator<qreal, QPen> it(
d->customTickMarkPens );
149 while ( it.hasNext() ) {
151 if ( qAbs( value - it.key() ) < std::numeric_limits< float >::epsilon() )
154 return d->tickMarkPen;
159 return d->customTickMarkPens;
164 QMapIterator<qreal, QPen> it(
d->customTickMarkPens );
165 while ( it.hasNext() ) {
167 if ( qAbs( value - it.key() ) < std::numeric_limits< float >::epsilon() )
175 d->tickMarkPen.setColor( color );
180 return d->tickMarkPen.color();
185 d->showMajorTickMarks = show;
190 return d->showMajorTickMarks;
195 d->showMinorTickMarks = show;
200 return d->showMinorTickMarks;
205 d->labelMargin = margin;
210 return d->labelMargin;
215 d->majorTickLength = length;
216 d->majorTickLengthIsSet =
true;
221 return d->majorTickLength;
226 return d->majorTickLengthIsSet;
231 d->minorTickLength = length;
232 d->minorTickLengthIsSet =
true;
237 return d->minorTickLength;
242 return d->minorTickLengthIsSet;
247 d->showFirstTick = show;
252 return d->showFirstTick;
283 d->customTickMarkPens.size() == r.d->customTickMarkPens.size();
289 for ( ; it !=
d->customTickMarkPens.constEnd(); ++it, ++it2 ) {
290 if ( it.key() != it2.key() || it.value() != it2.value() ) {
299 d->showRulerLine = show;
304 return d->showRulerLine;
307 #if !defined( QT_NO_DEBUG_STREAM )
310 dbg <<
"KDChart::RulerAttributes("
315 QMapIterator<qreal, QPen> it( pens );
316 while ( it.hasNext() ) {
318 dbg <<
"customTickMarkPen=(" << it.value() <<
" : " << it.key() <<
")";