##// END OF EJS Templates
Hide slice label by default
Jani Honkonen -
r294:bf1f84426ed8
parent child
Show More
@@ -4,6 +4,8 CustomSlice::CustomSlice(qreal value, QObject* parent)
4 :QPieSlice(parent)
4 :QPieSlice(parent)
5 {
5 {
6 setValue(value);
6 setValue(value);
7 setLabelVisible(true);
8 setExploded(true);
7 connect(this, SIGNAL(changed()), this, SLOT(updateLabel()));
9 connect(this, SIGNAL(changed()), this, SLOT(updateLabel()));
8 connect(this, SIGNAL(hoverEnter()), this, SLOT(toggleExploded()));
10 connect(this, SIGNAL(hoverEnter()), this, SLOT(toggleExploded()));
9 connect(this, SIGNAL(hoverLeave()), this, SLOT(toggleExploded()));
11 connect(this, SIGNAL(hoverLeave()), this, SLOT(toggleExploded()));
@@ -11,7 +13,7 CustomSlice::CustomSlice(qreal value, QObject* parent)
11
13
12 void CustomSlice::updateLabel()
14 void CustomSlice::updateLabel()
13 {
15 {
14 setLabel(QString::number(this->percentage()));
16 setLabel(QString::number(this->percentage()*100) + "%");
15 }
17 }
16
18
17 void CustomSlice::toggleExploded()
19 void CustomSlice::toggleExploded()
@@ -248,6 +248,7 void QPieSeries::highlightOn(QPieSlice* slice)
248 Q_ASSERT(slice);
248 Q_ASSERT(slice);
249 QColor c = slice->brush().color().lighter();
249 QColor c = slice->brush().color().lighter();
250 slice->setBrush(c);
250 slice->setBrush(c);
251 slice->setLabelVisible(true);
251 }
252 }
252
253
253 void QPieSeries::highlightOff(QPieSlice* slice)
254 void QPieSeries::highlightOff(QPieSlice* slice)
@@ -255,6 +256,7 void QPieSeries::highlightOff(QPieSlice* slice)
255 Q_ASSERT(slice);
256 Q_ASSERT(slice);
256 QColor c = slice->brush().color().darker(150);
257 QColor c = slice->brush().color().darker(150);
257 slice->setBrush(c);
258 slice->setBrush(c);
259 slice->setLabelVisible(false);
258 }
260 }
259
261
260 void QPieSeries::updateDerivativeData()
262 void QPieSeries::updateDerivativeData()
@@ -10,7 +10,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10 QPieSlice::QPieSlice(QObject *parent)
10 QPieSlice::QPieSlice(QObject *parent)
11 :QObject(parent),
11 :QObject(parent),
12 m_value(0),
12 m_value(0),
13 m_isLabelVisible(true),
13 m_isLabelVisible(false),
14 m_isExploded(false),
14 m_isExploded(false),
15 m_explodeDistance(DEFAULT_EXPOLODE_DISTANCE),
15 m_explodeDistance(DEFAULT_EXPOLODE_DISTANCE),
16 m_percentage(0),
16 m_percentage(0),
@@ -17,7 +17,7 class QTCOMMERCIALCHART_EXPORT QPieSlice : public QObject
17
17
18 public:
18 public:
19 QPieSlice(QObject *parent = 0);
19 QPieSlice(QObject *parent = 0);
20 QPieSlice(qreal value, QString label, bool labelVisible = true, QObject *parent = 0);
20 QPieSlice(qreal value, QString label, bool labelVisible = false, QObject *parent = 0);
21 virtual ~QPieSlice();
21 virtual ~QPieSlice();
22
22
23 // data
23 // data
General Comments 0
You need to be logged in to leave comments. Login now