qpieslice.h
159 lines
| 5.2 KiB
| text/x-c
|
CLexer
Miikka Heikkinen
|
r2854 | /**************************************************************************** | ||
Jani Honkonen
|
r794 | ** | ||
Miikka Heikkinen
|
r2854 | ** Copyright (C) 2016 The Qt Company Ltd. | ||
** Contact: https://www.qt.io/licensing/ | ||||
Jani Honkonen
|
r794 | ** | ||
Miikka Heikkinen
|
r2854 | ** This file is part of the Qt Charts module of the Qt Toolkit. | ||
Jani Honkonen
|
r794 | ** | ||
Miikka Heikkinen
|
r2854 | ** $QT_BEGIN_LICENSE:GPL$ | ||
Titta Heikkala
|
r2845 | ** Commercial License Usage | ||
** Licensees holding valid commercial Qt licenses may use this file in | ||||
** accordance with the commercial license agreement provided with the | ||||
** Software or, alternatively, in accordance with the terms contained in | ||||
** a written agreement between you and The Qt Company. For licensing terms | ||||
Miikka Heikkinen
|
r2854 | ** and conditions see https://www.qt.io/terms-conditions. For further | ||
** information use the contact form at https://www.qt.io/contact-us. | ||||
** | ||||
** GNU General Public License Usage | ||||
** Alternatively, this file may be used under the terms of the GNU | ||||
** General Public License version 3 or (at your option) any later version | ||||
** approved by the KDE Free Qt Foundation. The licenses are as published by | ||||
** the Free Software Foundation and appearing in the file LICENSE.GPL3 | ||||
** included in the packaging of this file. Please review the following | ||||
** information to ensure the GNU General Public License requirements will | ||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html. | ||||
Jani Honkonen
|
r794 | ** | ||
Titta Heikkala
|
r2845 | ** $QT_END_LICENSE$ | ||
** | ||||
Miikka Heikkinen
|
r2854 | ****************************************************************************/ | ||
Jani Honkonen
|
r794 | |||
Jani Honkonen
|
r203 | #ifndef QPIESLICE_H | ||
#define QPIESLICE_H | ||||
Titta Heikkala
|
r2714 | #include <QtCharts/QChartGlobal> | ||
#include <QtCore/QObject> | ||||
#include <QtGui/QPen> | ||||
#include <QtGui/QBrush> | ||||
#include <QtGui/QFont> | ||||
Jani Honkonen
|
r203 | |||
Titta Heikkala
|
r2712 | QT_CHARTS_BEGIN_NAMESPACE | ||
Jani Honkonen
|
r1274 | class QPieSlicePrivate; | ||
Jani Honkonen
|
r1323 | class QPieSeries; | ||
Jani Honkonen
|
r203 | |||
Titta Heikkala
|
r2712 | class QT_CHARTS_EXPORT QPieSlice : public QObject | ||
Jani Honkonen
|
r203 | { | ||
Q_OBJECT | ||||
Jani Honkonen
|
r1450 | Q_ENUMS(LabelPosition) | ||
Jani Honkonen
|
r1224 | Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged) | ||
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) | ||||
Jani Honkonen
|
r1274 | Q_PROPERTY(bool labelVisible READ isLabelVisible WRITE setLabelVisible NOTIFY labelVisibleChanged) | ||
Tero Ahola
|
r1494 | Q_PROPERTY(LabelPosition labelPosition READ labelPosition WRITE setLabelPosition) | ||
Q_PROPERTY(bool exploded READ isExploded WRITE setExploded) | ||||
Jani Honkonen
|
r1274 | Q_PROPERTY(QPen pen READ pen WRITE setPen NOTIFY penChanged) | ||
Jani Honkonen
|
r1338 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) | ||
Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) | ||||
Jani Honkonen
|
r1274 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush NOTIFY brushChanged) | ||
Jani Honkonen
|
r1338 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) | ||
Tero Ahola
|
r1307 | Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush NOTIFY labelBrushChanged) | ||
Jani Honkonen
|
r1338 | Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor NOTIFY labelColorChanged) | ||
Jani Honkonen
|
r1274 | Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont NOTIFY labelFontChanged) | ||
Tero Ahola
|
r1494 | Q_PROPERTY(qreal labelArmLengthFactor READ labelArmLengthFactor WRITE setLabelArmLengthFactor) | ||
Q_PROPERTY(qreal explodeDistanceFactor READ explodeDistanceFactor WRITE setExplodeDistanceFactor) | ||||
Jani Honkonen
|
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) | ||||
Jani Honkonen
|
r203 | |||
Jani Honkonen
|
r1450 | public: | ||
enum LabelPosition { | ||||
LabelOutside, | ||||
Jani Honkonen
|
r1759 | LabelInsideHorizontal, | ||
Tero Ahola
|
r2044 | LabelInsideTangential, | ||
LabelInsideNormal | ||||
Jani Honkonen
|
r1450 | }; | ||
Jani Honkonen
|
r203 | public: | ||
Michal Klocek
|
r970 | explicit QPieSlice(QObject *parent = 0); | ||
Jani Honkonen
|
r1206 | QPieSlice(QString label, qreal value, QObject *parent = 0); | ||
Jani Honkonen
|
r203 | virtual ~QPieSlice(); | ||
Jani Honkonen
|
r437 | void setLabel(QString label); | ||
Jani Honkonen
|
r203 | QString label() const; | ||
Jani Honkonen
|
r1224 | |||
void setValue(qreal value); | ||||
qreal value() const; | ||||
Jani Honkonen
|
r203 | |||
Jani Honkonen
|
r1274 | void setLabelVisible(bool visible = true); | ||
bool isLabelVisible() const; | ||||
Jani Honkonen
|
r1450 | LabelPosition labelPosition(); | ||
void setLabelPosition(LabelPosition position); | ||||
Jani Honkonen
|
r1274 | void setExploded(bool exploded = true); | ||
bool isExploded() const; | ||||
Jani Honkonen
|
r756 | void setPen(const QPen &pen); | ||
QPen pen() const; | ||||
Jani Honkonen
|
r1224 | |||
Jani Honkonen
|
r1338 | QColor borderColor(); | ||
void setBorderColor(QColor color); | ||||
int borderWidth(); | ||||
void setBorderWidth(int width); | ||||
Jani Honkonen
|
r756 | void setBrush(const QBrush &brush); | ||
QBrush brush() const; | ||||
Jani Honkonen
|
r1224 | |||
Jani Honkonen
|
r1338 | QColor color(); | ||
void setColor(QColor color); | ||||
Tero Ahola
|
r1307 | void setLabelBrush(const QBrush &brush); | ||
QBrush labelBrush() const; | ||||
Jani Honkonen
|
r1224 | |||
Jani Honkonen
|
r1338 | QColor labelColor(); | ||
void setLabelColor(QColor color); | ||||
Jani Honkonen
|
r469 | void setLabelFont(const QFont &font); | ||
Jani Honkonen
|
r203 | QFont labelFont() const; | ||
Jani Honkonen
|
r1009 | |||
Jani Honkonen
|
r1274 | void setLabelArmLengthFactor(qreal factor); | ||
qreal labelArmLengthFactor() const; | ||||
Jani Honkonen
|
r1224 | |||
Jani Honkonen
|
r618 | void setExplodeDistanceFactor(qreal factor); | ||
qreal explodeDistanceFactor() const; | ||||
Jani Honkonen
|
r437 | |||
Jani Honkonen
|
r1009 | qreal percentage() const; | ||
qreal startAngle() const; | ||||
Jani Honkonen
|
r1274 | qreal angleSpan() const; | ||
Jani Honkonen
|
r1009 | |||
Jani Honkonen
|
r1323 | QPieSeries *series() const; | ||
Jani Honkonen
|
r203 | Q_SIGNALS: | ||
Tero Ahola
|
r1494 | void clicked(); | ||
void hovered(bool state); | ||||
Titta Heikkala
|
r2739 | void pressed(); | ||
void released(); | ||||
void doubleClicked(); | ||||
Jani Honkonen
|
r1224 | void labelChanged(); | ||
void valueChanged(); | ||||
Jani Honkonen
|
r1274 | void labelVisibleChanged(); | ||
void penChanged(); | ||||
void brushChanged(); | ||||
Tero Ahola
|
r1307 | void labelBrushChanged(); | ||
Jani Honkonen
|
r1274 | void labelFontChanged(); | ||
void percentageChanged(); | ||||
void startAngleChanged(); | ||||
void angleSpanChanged(); | ||||
Tero Ahola
|
r1329 | void colorChanged(); | ||
void borderColorChanged(); | ||||
void borderWidthChanged(); | ||||
void labelColorChanged(); | ||||
Jani Honkonen
|
r203 | |||
private: | ||||
Jani Honkonen
|
r1274 | QPieSlicePrivate * const d_ptr; | ||
Q_DECLARE_PRIVATE(QPieSlice) | ||||
Jani Honkonen
|
r669 | Q_DISABLE_COPY(QPieSlice) | ||
Jani Honkonen
|
r203 | }; | ||
Titta Heikkala
|
r2712 | QT_CHARTS_END_NAMESPACE | ||
Jani Honkonen
|
r203 | |||
#endif // QPIESLICE_H | ||||