File indexing completed on 2024-05-12 04:20:37

0001 /*
0002  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
0003  *
0004  * This file is part of the KD Chart library.
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #ifndef KCHARTVALUETRACKERATTRIBUTES_H
0010 #define KCHARTVALUETRACKERATTRIBUTES_H
0011 
0012 #include <QDebug>
0013 #include <QMetaType>
0014 #include "KChartGlobal.h"
0015 
0016 namespace KChart {
0017 
0018     /**
0019      * \class ValueTrackerAttributes KChartValueTrackerAttributes.h KChartValueTrackerAttributes
0020      * \brief Cell-specific attributes regarding value tracking
0021      *
0022      * ValueTrackerAttributes groups the properties regarding
0023      * value tracking, and how it is displayed.
0024      * Value tracking can be used to emphasize on one or several
0025      * specific points in a line diagram.
0026    */
0027 
0028     class KCHART_EXPORT ValueTrackerAttributes
0029     {
0030         public:
0031             ValueTrackerAttributes();
0032             ValueTrackerAttributes( const ValueTrackerAttributes& );
0033             ValueTrackerAttributes &operator= ( const ValueTrackerAttributes& );
0034 
0035             ~ValueTrackerAttributes();
0036 
0037             /** Set the pen the value tracking lines and markers will be drawn with
0038              * \param pen The pen the lines and markers will be drawn with
0039              */
0040             void setPen( const QPen& pen );
0041 
0042             /**
0043              * @return The pen the lines and markers are drawn with
0044              */
0045             QPen pen() const;
0046 
0047             void setLinePen( const QPen &pen );
0048             QPen linePen() const;
0049 
0050             void setMarkerPen( const QPen &pen );
0051             QPen markerPen() const;
0052 
0053             void setMarkerBrush( const QBrush &brush );
0054             QBrush markerBrush() const;
0055 
0056             void setArrowBrush( const QBrush &brush );
0057             QBrush arrowBrush() const;
0058 
0059             /** Set the brush the area below the value tracking
0060              * lines should be filled with. Default is a black brush
0061              * with the style Qt::NoBrush.
0062              * \param brush The brush the area should be filled with
0063              */
0064             void setAreaBrush( const QBrush& brush );
0065 
0066             /**
0067              * @return The brush the area below the value tracking lines is filled with
0068              */
0069             QBrush areaBrush() const;
0070 
0071             /** Set the size of the markers. This includes both the arrows at
0072              * the axes and the circle at the data point.
0073              * \param size The size of the markers
0074              */
0075             void setMarkerSize( const QSizeF& size );
0076 
0077             /**
0078              * @return The size of the markers
0079              */
0080             QSizeF markerSize() const;
0081 
0082             /**
0083              * @return The orientations used to show the value tracking. Using only a
0084              * vertical line, horizontal line or both (the default).
0085              */
0086             Qt::Orientations orientations() const;
0087 
0088             /** Set the orientations used to show the value tracking.
0089              * \param orientations The orientations of the value tracking lines.
0090              */
0091             void setOrientations( Qt::Orientations orientations );
0092 
0093             /** Set whether value tracking should be enabled for a specific
0094              * index or not
0095              * \param enabled Whether value tracking should be enabled or not
0096              */
0097             void setEnabled( bool enabled );
0098 
0099             /**
0100              * @return Whether value tracking is enabled or not
0101              */
0102             bool isEnabled() const;
0103 
0104             bool operator==( const ValueTrackerAttributes& ) const;
0105             inline bool operator!=( const ValueTrackerAttributes& other ) const { return !operator==(other); }
0106 
0107         private:
0108             KCHART_DECLARE_PRIVATE_BASE_VALUE( ValueTrackerAttributes )
0109     }; // End of class ValueTrackerAttributes
0110 
0111 }
0112 
0113 #if !defined(QT_NO_DEBUG_STREAM)
0114 KCHART_EXPORT QDebug operator<<(QDebug, const KChart::ValueTrackerAttributes& );
0115 #endif /* QT_NO_DEBUG_STREAM */
0116 
0117 KCHART_DECLARE_SWAP_SPECIALISATION( KChart::ValueTrackerAttributes )
0118 
0119 QT_BEGIN_NAMESPACE
0120 Q_DECLARE_TYPEINFO( KChart::ValueTrackerAttributes, Q_MOVABLE_TYPE );
0121 QT_END_NAMESPACE
0122 
0123 Q_DECLARE_METATYPE( KChart::ValueTrackerAttributes )
0124 
0125 #endif // KCHARTVALUETRACKERATTRIBUTES_H