customslice.cpp
22 lines
| 556 B
| text/x-c
|
CppLexer
Jani Honkonen
|
r203 | #include "customslice.h" | ||
CustomSlice::CustomSlice(qreal value, QObject* parent) | ||||
:QPieSlice(parent) | ||||
{ | ||||
setValue(value); | ||||
Jani Honkonen
|
r294 | setLabelVisible(true); | ||
setExploded(true); | ||||
Jani Honkonen
|
r203 | connect(this, SIGNAL(changed()), this, SLOT(updateLabel())); | ||
connect(this, SIGNAL(hoverEnter()), this, SLOT(toggleExploded())); | ||||
connect(this, SIGNAL(hoverLeave()), this, SLOT(toggleExploded())); | ||||
} | ||||
void CustomSlice::updateLabel() | ||||
{ | ||||
Jani Honkonen
|
r294 | setLabel(QString::number(this->percentage()*100) + "%"); | ||
Jani Honkonen
|
r203 | } | ||
void CustomSlice::toggleExploded() | ||||
{ | ||||
setExploded(!isExploded()); | ||||
} | ||||