KChart

KChartMarkerAttributes.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 KCHARTMARKERATTRIBUTES_H
10#define KCHARTMARKERATTRIBUTES_H
11
12#include <QMetaType>
13#include "KChartGlobal.h"
14
15QT_BEGIN_NAMESPACE
16class QColor;
17class QSizeF;
18class QPen;
19class QPainterPath;
20class QDebug;
21template <typename T, typename K> class QMap;
22QT_END_NAMESPACE
23
24namespace KChart {
25
26 /**
27 * @brief A set of attributes controlling the appearance of data set markers
28 */
29 class KCHART_EXPORT MarkerAttributes
30 {
31 public:
34 MarkerAttributes &operator= ( const MarkerAttributes& );
35
37
38 enum MarkerStyle { NoMarker = 0,
39 MarkerCircle = 1,
40 MarkerSquare = 2,
41 MarkerDiamond = 3,
42 Marker1Pixel = 4,
43 Marker4Pixels = 5,
44 MarkerRing = 6,
45 MarkerCross = 7,
46 MarkerFastCross = 8,
47 MarkerArrowDown = 9,
48 MarkerArrowUp = 10,
49 MarkerArrowRight = 11,
50 MarkerArrowLeft = 12,
51 MarkerBowTie = 13,
52 MarkerHourGlass = 14,
53 MarkerStar = 15,
54 MarkerX = 16,
55 MarkerAsterisk = 17,
56 MarkerHorizontalBar = 18,
57 MarkerVerticalBar = 19,
58 PainterPathMarker = 255,
59 StartCustomMarkers = 256 };
60
62 /// the marker size is directly specified in pixels
63 AbsoluteSize = 0,
64 /// the marker size is specified in pixels, but scaled by the
65 /// painter's zoom level
66 AbsoluteSizeScaled = 1,
67 /// the marker size is relative to the diagram's min(width, height)
68 RelativeToDiagramWidthHeightMin = 2 };
69
70 void setVisible( bool visible );
71 bool isVisible() const;
72
73 typedef QMap<uint, uint> MarkerStylesMap;
74 void setMarkerStylesMap( const MarkerStylesMap & map );
75 MarkerStylesMap markerStylesMap() const;
76
77 void setThreeD( bool value );
78 bool threeD() const;
79
80 /**
81 * Set the marker-style to use. This could be either one of the
82 * predefined \a MarkerStyle or a custom one that has a value
83 * bigger or equal to StartCustomMarkers.
84 *
85 * Such a custom marker does then allow to fetch a custom pixmap
86 * for each point (value pair) from the model using the
87 * Qt::DecorationRole .
88 */
89 void setMarkerStyle( uint style );
90 uint markerStyle() const;
91
92 /**
93 * Normally you need to specify a valid QSizeF here, but for Legends you can
94 * use the invalid size QSizeF(), to enable automatic marker size calculation:
95 *
96 * For Markers shown in a Legend this means the marker size will be equal to
97 * the font height used for the labels that are shown next to the markers.
98 */
99 void setMarkerSize( const QSizeF& size );
100 QSizeF markerSize() const;
101
102 /**
103 * With this method you can change the way the actual marker size is
104 * calculated.
105 *
106 * By default, the marker size is absolute (equiv. to @a mode = AbsoluteSize)
107 * and specifies the size in pixels.
108 *
109 * In any other case, the size specified will be relative to what is
110 * specified in @a mode, e.g. the diagram's width. A marker width or
111 * height of 1.0 is then 100% of the diagram's width.
112 */
113 void setMarkerSizeMode( MarkerSizeMode mode );
114 MarkerSizeMode markerSizeMode() const;
115
116 void setMarkerColor( const QColor& color );
117 QColor markerColor() const;
118
119 void setCustomMarkerPath( const QPainterPath& path );
120 QPainterPath customMarkerPath() const;
121
122 void setPen( const QPen& pen );
123 QPen pen() const;
124
125 bool operator==( const MarkerAttributes& ) const;
126 bool operator!=( const MarkerAttributes& ) const;
127
128 private:
129 KCHART_DECLARE_PRIVATE_BASE_VALUE( MarkerAttributes )
130 }; // End of class MarkerAttributes
131
132 inline bool MarkerAttributes::operator!=( const MarkerAttributes & other ) const { return !operator==( other ); }
133}
134
135#ifndef QT_NO_DEBUG_STREAM
136KCHART_EXPORT QDebug operator<<( QDebug, const KChart::MarkerAttributes & );
137#endif
138
139KCHART_DECLARE_SWAP_SPECIALISATION( KChart::MarkerAttributes )
140
141QT_BEGIN_NAMESPACE
142Q_DECLARE_TYPEINFO( KChart::MarkerAttributes, Q_MOVABLE_TYPE );
143QT_END_NAMESPACE
144
145Q_DECLARE_METATYPE( KChart::MarkerAttributes )
146
147#endif // KCHARTMARKERATTRIBUTES_H
Contains KChart macros.
A set of attributes controlling the appearance of data set markers.
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:02:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.