qpieslice.h
88 lines
| 2.4 KiB
| text/x-c
|
CLexer
Jani Honkonen
|
r794 | /**************************************************************************** | ||
** | ||||
** Copyright (C) 2012 Digia Plc | ||||
** All rights reserved. | ||||
** For any questions to Digia, please use contact form at http://qt.digia.com | ||||
** | ||||
** This file is part of the Qt Commercial Charts Add-on. | ||||
** | ||||
** $QT_BEGIN_LICENSE$ | ||||
** Licensees holding valid Qt Commercial licenses may use this file in | ||||
** accordance with the Qt Commercial License Agreement provided with the | ||||
** 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$ | ||||
** | ||||
****************************************************************************/ | ||||
Jani Honkonen
|
r203 | #ifndef QPIESLICE_H | ||
#define QPIESLICE_H | ||||
#include <qchartglobal.h> | ||||
#include <QObject> | ||||
#include <QPen> | ||||
#include <QBrush> | ||||
#include <QFont> | ||||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
Jani Honkonen
|
r818 | class PieSliceData; | ||
Jani Honkonen
|
r203 | |||
class QTCOMMERCIALCHART_EXPORT QPieSlice : public QObject | ||||
{ | ||||
Q_OBJECT | ||||
Jani Honkonen
|
r314 | Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY changed) | ||
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed) | ||||
Jani Honkonen
|
r203 | |||
public: | ||||
Michal Klocek
|
r970 | explicit QPieSlice(QObject *parent = 0); | ||
Jani Honkonen
|
r314 | QPieSlice(qreal value, QString label, QObject *parent = 0); | ||
Jani Honkonen
|
r203 | virtual ~QPieSlice(); | ||
// data | ||||
Jani Honkonen
|
r437 | void setValue(qreal value); | ||
Jani Honkonen
|
r203 | qreal value() const; | ||
Jani Honkonen
|
r437 | void setLabel(QString label); | ||
Jani Honkonen
|
r203 | QString label() const; | ||
Jani Honkonen
|
r696 | void setLabelVisible(bool visible = true); | ||
Jani Honkonen
|
r203 | bool isLabelVisible() const; | ||
Jani Honkonen
|
r696 | void setExploded(bool exploded = true); | ||
Jani Honkonen
|
r203 | bool isExploded() const; | ||
// generated data | ||||
qreal percentage() const; | ||||
Jani Honkonen
|
r355 | qreal startAngle() const; | ||
qreal endAngle() const; | ||||
Jani Honkonen
|
r203 | |||
// customization | ||||
Jani Honkonen
|
r756 | void setPen(const QPen &pen); | ||
QPen pen() const; | ||||
void setBrush(const QBrush &brush); | ||||
QBrush brush() const; | ||||
Jani Honkonen
|
r714 | void setLabelPen(const QPen &pen); | ||
QPen labelPen() const; | ||||
Jani Honkonen
|
r469 | void setLabelFont(const QFont &font); | ||
Jani Honkonen
|
r203 | QFont labelFont() const; | ||
Jani Honkonen
|
r454 | void setLabelArmLengthFactor(qreal factor); | ||
qreal labelArmLengthFactor() const; | ||||
Jani Honkonen
|
r618 | void setExplodeDistanceFactor(qreal factor); | ||
qreal explodeDistanceFactor() const; | ||||
Jani Honkonen
|
r437 | |||
Jani Honkonen
|
r203 | Q_SIGNALS: | ||
Jani Honkonen
|
r707 | void clicked(Qt::MouseButtons buttons); | ||
Jani Honkonen
|
r203 | void hoverEnter(); | ||
void hoverLeave(); | ||||
void changed(); | ||||
Michal Klocek
|
r855 | void selected(); | ||
Jani Honkonen
|
r203 | |||
private: | ||||
Jani Honkonen
|
r818 | friend class PieSliceData; | ||
PieSliceData * const d; | ||||
Jani Honkonen
|
r669 | Q_DISABLE_COPY(QPieSlice) | ||
Jani Honkonen
|
r203 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
#endif // QPIESLICE_H | ||||