File indexing completed on 2024-09-22 04:00:05
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 KCHART_PIE_ATTRIBUTES_H 0010 #define KCHART_PIE_ATTRIBUTES_H 0011 0012 #include <QMetaType> 0013 #include "KChartAbstractThreeDAttributes.h" 0014 #include "KChartGlobal.h" 0015 0016 namespace KChart { 0017 0018 /** 0019 * @brief A set of attributes controlling the appearance of pie charts 0020 */ 0021 class KCHART_EXPORT PieAttributes 0022 { 0023 public: 0024 PieAttributes(); 0025 PieAttributes( const PieAttributes& ); 0026 PieAttributes &operator= ( const PieAttributes& ); 0027 0028 ~PieAttributes(); 0029 0030 /** \brief Enable or disable exploding the respective pie piece(s). 0031 * 0032 * The default explode factor is 10 percent; use setExplodeFactor 0033 * to specify a different factor. 0034 * 0035 * \note This is a convenience function: Calling setExplode( true ) 0036 * does the same as calling setExplodeFactor( 0.1 ), and calling 0037 * setExplode( false ) does the same as calling setExplodeFactor( 0.0 ). 0038 * 0039 * \sa setExplodeFactor 0040 */ 0041 void setExplode( bool explode ); 0042 0043 /** @return whether the respective pie piece(s) will be exploded. */ 0044 bool explode() const; 0045 0046 /** Set the explode factor. 0047 * The explode factor is a qreal between 0 and 1, and is interpreted 0048 * as a percentage of the total available radius of the pie. 0049 * 0050 * \sa setExplode 0051 */ 0052 void setExplodeFactor( qreal factor ); 0053 0054 /** @return the explode factor set by setExplode or by setExplodeFactor. */ 0055 qreal explodeFactor() const; 0056 0057 void setGapFactor( bool circular, qreal factor ); 0058 qreal gapFactor( bool circular ) const; 0059 0060 bool operator==( const PieAttributes& ) const; 0061 inline bool operator!=( const PieAttributes& other ) const { return !operator==(other); } 0062 0063 private: 0064 KCHART_DECLARE_PRIVATE_BASE_VALUE( PieAttributes ) 0065 }; // End of class PieAttributes 0066 0067 } 0068 0069 #if !defined(QT_NO_DEBUG_STREAM) 0070 KCHART_EXPORT QDebug operator<<(QDebug, const KChart::PieAttributes& ); 0071 #endif /* QT_NO_DEBUG_STREAM */ 0072 0073 KCHART_DECLARE_SWAP_SPECIALISATION( KChart::PieAttributes ) 0074 0075 QT_BEGIN_NAMESPACE 0076 Q_DECLARE_TYPEINFO( KChart::PieAttributes, Q_MOVABLE_TYPE ); 0077 QT_END_NAMESPACE 0078 0079 Q_DECLARE_METATYPE( KChart::PieAttributes ) 0080 0081 #endif // KCHART_PIE_ATTRIBUTES_H