qpieslice.h
147 lines
| 4.6 KiB
| text/x-c
|
CLexer
|
r794 | /**************************************************************************** | ||
** | ||||
|
r2688 | ** Copyright (C) 2014 Digia Plc | ||
|
r794 | ** All rights reserved. | ||
** For any questions to Digia, please use contact form at http://qt.digia.com | ||||
** | ||||
|
r2574 | ** This file is part of the Qt Enterprise Charts Add-on. | ||
|
r794 | ** | ||
** $QT_BEGIN_LICENSE$ | ||||
|
r2574 | ** Licensees holding valid Qt Enterprise licenses may use this file in | ||
** accordance with the Qt Enterprise License Agreement provided with the | ||||
|
r794 | ** Software or, alternatively, in accordance with the terms contained in | ||
** a written agreement between you and Digia. | ||||
** | ||||
** If you have questions regarding the use of this file, please use | ||||
** contact form at http://qt.digia.com | ||||
** $QT_END_LICENSE$ | ||||
** | ||||
****************************************************************************/ | ||||
|
r203 | #ifndef QPIESLICE_H | ||
#define QPIESLICE_H | ||||
|
r2714 | #include <QtCharts/QChartGlobal> | ||
#include <QtCore/QObject> | ||||
#include <QtGui/QPen> | ||||
#include <QtGui/QBrush> | ||||
#include <QtGui/QFont> | ||||
|
r203 | |||
|
r2712 | QT_CHARTS_BEGIN_NAMESPACE | ||
|
r1274 | class QPieSlicePrivate; | ||
|
r1323 | class QPieSeries; | ||
|
r203 | |||
|
r2712 | class QT_CHARTS_EXPORT QPieSlice : public QObject | ||
|
r203 | { | ||
Q_OBJECT | ||||
|
r1450 | Q_ENUMS(LabelPosition) | ||
|
r1224 | Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged) | ||
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) | ||||
|
r1274 | Q_PROPERTY(bool labelVisible READ isLabelVisible WRITE setLabelVisible NOTIFY labelVisibleChanged) | ||
|
r1494 | Q_PROPERTY(LabelPosition labelPosition READ labelPosition WRITE setLabelPosition) | ||
Q_PROPERTY(bool exploded READ isExploded WRITE setExploded) | ||||
|
r1274 | Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) | ||
|
r1338 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) | ||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) | ||||
|
r1274 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) | ||
|
r1338 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) | ||
|
r1307 | Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged) | ||
|
r1338 | Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) | ||
|
r1274 | Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged) | ||
|
r1494 | Q_PROPERTY(qreal labelArmLengthFactor READ labelArmLengthFactor WRITE setLabelArmLengthFactor) | ||
Q_PROPERTY(qreal explodeDistanceFactor READ explodeDistanceFactor WRITE setExplodeDistanceFactor) | ||||
|
r1274 | Q_PROPERTY(qreal percentage READ percentage NOTIFY percentageChanged) | ||
Q_PROPERTY(qreal startAngle READ startAngle NOTIFY startAngleChanged) | ||||
Q_PROPERTY(qreal angleSpan READ angleSpan NOTIFY angleSpanChanged) | ||||
|
r203 | |||
|
r1450 | public: | ||
enum LabelPosition { | ||||
LabelOutside, | ||||
|
r1759 | LabelInsideHorizontal, | ||
|
r2044 | LabelInsideTangential, | ||
LabelInsideNormal | ||||
|
r1450 | }; | ||
|
r203 | public: | ||
|
r970 | explicit QPieSlice(QObject *parent = 0); | ||
|
r1206 | QPieSlice(QString label, qreal value, QObject *parent = 0); | ||
|
r203 | virtual ~QPieSlice(); | ||
|
r437 | void setLabel(QString label); | ||
|
r203 | QString label() const; | ||
|
r1224 | |||
void setValue(qreal value); | ||||
qreal value() const; | ||||
|
r203 | |||
|
r1274 | void setLabelVisible(bool visible = true); | ||
bool isLabelVisible() const; | ||||
|
r1450 | LabelPosition labelPosition(); | ||
void setLabelPosition(LabelPosition position); | ||||
|
r1274 | void setExploded(bool exploded = true); | ||
bool isExploded() const; | ||||
|
r756 | void setPen(const QPen &pen); | ||
QPen pen() const; | ||||
|
r1224 | |||
|
r1338 | QColor borderColor(); | ||
void setBorderColor(QColor color); | ||||
int borderWidth(); | ||||
void setBorderWidth(int width); | ||||
|
r756 | void setBrush(const QBrush &brush); | ||
QBrush brush() const; | ||||
|
r1224 | |||
|
r1338 | QColor color(); | ||
void setColor(QColor color); | ||||
|
r1307 | void setLabelBrush(const QBrush &brush); | ||
QBrush labelBrush() const; | ||||
|
r1224 | |||
|
r1338 | QColor labelColor(); | ||
void setLabelColor(QColor color); | ||||
|
r469 | void setLabelFont(const QFont &font); | ||
|
r203 | QFont labelFont() const; | ||
|
r1009 | |||
|
r1274 | void setLabelArmLengthFactor(qreal factor); | ||
qreal labelArmLengthFactor() const; | ||||
|
r1224 | |||
|
r618 | void setExplodeDistanceFactor(qreal factor); | ||
qreal explodeDistanceFactor() const; | ||||
|
r437 | |||
|
r1009 | qreal percentage() const; | ||
qreal startAngle() const; | ||||
|
r1274 | qreal angleSpan() const; | ||
|
r1009 | |||
|
r1323 | QPieSeries *series() const; | ||
|
r203 | Q_SIGNALS: | ||
|
r1494 | void clicked(); | ||
void hovered(bool state); | ||||
|
r1224 | void labelChanged(); | ||
void valueChanged(); | ||||
|
r1274 | void labelVisibleChanged(); | ||
void penChanged(); | ||||
void brushChanged(); | ||||
|
r1307 | void labelBrushChanged(); | ||
|
r1274 | void labelFontChanged(); | ||
void percentageChanged(); | ||||
void startAngleChanged(); | ||||
void angleSpanChanged(); | ||||
|
r1329 | void colorChanged(); | ||
void borderColorChanged(); | ||||
void borderWidthChanged(); | ||||
void labelColorChanged(); | ||||
|
r203 | |||
private: | ||||
|
r1274 | QPieSlicePrivate * const d_ptr; | ||
Q_DECLARE_PRIVATE(QPieSlice) | ||||
|
r669 | Q_DISABLE_COPY(QPieSlice) | ||
|
r203 | }; | ||
|
r2712 | QT_CHARTS_END_NAMESPACE | ||
|
r203 | |||
#endif // QPIESLICE_H | ||||