123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #ifndef CUSTOMPIE_H
- #define CUSTOMPIE_H
- #include <QWidget>
- class CustomPie : public QWidget
- {
- Q_OBJECT
- Q_PROPERTY(QColor textColor READ getTextColor WRITE setTextColor)
- Q_PROPERTY(QColor borderColor READ getBorderColor WRITE setBorderColor)
- public:
- CustomPie(QWidget *parent = 0);
- ~CustomPie();
- protected:
- void paintEvent(QPaintEvent *);
- void drawPie(QPainter *painter);
- private:
- bool explodedAll;
- int explodedIndex;
- bool showPercent;
- double holeSize;
- QColor textColor;
- QColor borderColor;
- QList<QColor> colors;
- QList<QString> labels;
- QList<double> values;
- private:
-
- double getSumValue();
-
- QPoint getOffsetPoint(double angel, int offset = 6);
- public:
- QColor getTextColor() const;
- QColor getBorderColor() const;
- public Q_SLOTS:
-
- void setExplodedAll(bool explodedAll);
- void setExplodedIndex(int index);
-
- void setDefaultColor(bool defaultColor);
-
- void setTextColor(const QColor &textColor);
- void setBorderColor(const QColor &borderColor);
-
- void setColors(const QList<QColor> &colors);
-
- void initPie();
-
- void appendPie(const QString &label, double value, const QString &tip = "");
-
- void setDataPie();
-
- void loadPercent();
-
- void clearPie();
-
- void setHoleSize(double holeSize);
- };
- #endif
|