30 #include <KDABLibFakes> 36 class RulerAttributes::Private
54 bool majorTickLengthIsSet : 1;
55 bool minorTickLengthIsSet : 1;
66 RulerAttributes::Private::Private()
75 , majorTickLengthIsSet(
false )
76 , minorTickLengthIsSet(
false )
79 , majorTickLength( 3 )
80 , minorTickLength( 2 )
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() <<
")";
void setMajorTickMarkLength(int length)
Sets the length of major tick marks.
bool showFirstTick() const
QPen majorTickMarkPen() const
int majorTickMarkLength() const
void setShowMinorTickMarks(bool show)
Shows or hides minor tick marks.
void setShowFirstTick(bool show)
Shows or hides the first tick.
void setTickMarkColor(const QColor &color)
Color setter method provided for convenience.
A set of attributes controlling the appearance of axis rulers.
void setMajorTickMarkPen(const QPen &pen)
Sets the pen used to draw major tick marks.
void setMinorTickMarkLength(int length)
Sets the length of minor tick marks.
bool hasTickMarkPenAt(qreal value) const
bool showMajorTickMarks() const
void setMinorTickMarkPen(const QPen &pen)
Sets the pen used to draw minor tick marks.
bool majorTickMarkLengthIsSet() const
bool minorTickMarkPenIsSet() const
bool operator==(const RulerAttributes &) const
int minorTickMarkLength() const
bool majorTickMarkPenIsSet() const
void setShowMajorTickMarks(bool show)
Shows or hides major tick marks.
RulerAttributes & operator=(const RulerAttributes &)
QPen minorTickMarkPen() const
void setLabelMargin(int margin)
Set margin that should be used between the labels and the ticks.
QColor tickMarkColor() const
void setShowRulerLine(bool show)
bool showMinorTickMarks() const
QDebug operator<<(QDebug stream, const DataDimension &r)
void setTickMarkPen(const QPen &pen)
Sets the pen used to draw the tick marks.
bool showRulerLine() const
bool minorTickMarkLengthIsSet() const
TickMarkerPensMap tickMarkPens() const