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