KChart

KChartRulerAttributes.h
1 /*
2  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef KCHARTRULERATTRIBUTES_H
10 #define KCHARTRULERATTRIBUTES_H
11 
12 #include <QMetaType>
13 #include "KChartGlobal.h"
14 #include "KChartEnums.h"
15 
16 QT_BEGIN_NAMESPACE
17 class QPen;
18 QT_END_NAMESPACE
19 
20 namespace KChart {
21 
22 /**
23  * @brief A set of attributes controlling the appearance of axis rulers
24  */
25 class KCHART_EXPORT RulerAttributes
26 {
27 public:
30  RulerAttributes &operator= ( const RulerAttributes& );
31 
32  ~RulerAttributes();
33 
34  /**
35  * Sets the pen used to draw the tick marks
36  */
37  void setTickMarkPen( const QPen& pen );
38  QPen tickMarkPen() const;
39 
40  /**
41  * Sets the pen used to draw major tick marks
42  */
43  void setMajorTickMarkPen( const QPen& pen );
44  bool majorTickMarkPenIsSet() const;
45  QPen majorTickMarkPen() const;
46 
47  /**
48  * Sets the pen used to draw minor tick marks
49  */
50  void setMinorTickMarkPen( const QPen& pen );
51  bool minorTickMarkPenIsSet() const;
52  QPen minorTickMarkPen() const;
53 
54  /**
55  * Sets the pen used to draw the tick mark at a specific value
56  *
57  * Note: This will not paint a tick mark at the specified value
58  * if it wasn't already drawn before.
59  */
60  void setTickMarkPen( qreal value, const QPen& pen );
61  QPen tickMarkPen( qreal value ) const;
63  TickMarkerPensMap tickMarkPens() const;
64 
65  bool hasTickMarkPenAt( qreal value) const;
66 
67  /**
68  * Color setter method provided for convenience
69  */
70  void setTickMarkColor( const QColor& color );
71  QColor tickMarkColor() const;
72 
73  /**
74  * Shows or hides minor tick marks
75  */
76  void setShowMinorTickMarks( bool show );
77  bool showMinorTickMarks() const;
78 
79  /**
80  * Set the ruler line pen to @p pen
81  */
82  void setRulerLinePen(const QPen &pen);
83  /** @return the ruler line pen
84  */
85  QPen rulerLinePen() const;
86 
87  void setShowRulerLine( bool show );
88  bool showRulerLine() const;
89 
90  /**
91  * Shows or hides major tick marks
92  */
93  void setShowMajorTickMarks( bool show );
94  bool showMajorTickMarks() const;
95 
96  /**
97  * Sets the length of major tick marks
98  */
99  void setMajorTickMarkLength( int length );
100  int majorTickMarkLength() const;
101  bool majorTickMarkLengthIsSet() const;
102 
103  /**
104  * Sets the length of minor tick marks
105  */
106  void setMinorTickMarkLength( int length );
107  int minorTickMarkLength() const;
108  bool minorTickMarkLengthIsSet() const;
109 
110  /**
111  * Set margin that should be used between the labels and the ticks. By
112  * default the value is -1, which means that half of the label's font
113  * height/width should be used as margin.
114  */
115  void setLabelMargin(int margin);
116  int labelMargin() const;
117 
118  /**
119  * Shows or hides the first tick. This is usually where the axes cross.
120  * The tick itself may be obscured by the other axis, but the label will be visible.
121  */
122  void setShowFirstTick( bool show );
123  bool showFirstTick() const;
124 
125  bool operator==( const RulerAttributes& ) const;
126  inline bool operator!=( const RulerAttributes& other ) const { return !operator==(other); }
127 
128 private:
129  KCHART_DECLARE_PRIVATE_BASE_VALUE( RulerAttributes )
130 }; // End of class RulerAttributes
131 
132 }
133 
134 #if !defined(QT_NO_DEBUG_STREAM)
135 KCHART_EXPORT QDebug operator<<(QDebug, const KChart::RulerAttributes& );
136 #endif /* QT_NO_DEBUG_STREAM */
137 
138 KCHART_DECLARE_SWAP_SPECIALISATION( KChart::RulerAttributes )
139 
140 QT_BEGIN_NAMESPACE
141 Q_DECLARE_TYPEINFO( KChart::RulerAttributes, Q_MOVABLE_TYPE );
142 QT_END_NAMESPACE
143 
144 Q_DECLARE_METATYPE( KChart::RulerAttributes )
145 
146 #endif // KCHARTRULERATTRIBUTES_H
Contains KChart macros.
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Definition of global enums.
Global namespace.
A set of attributes controlling the appearance of axis rulers.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jan 27 2022 22:33:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.