Notify when meter's value changes

This commit is contained in:
Viranch Mehta 2011-06-21 01:24:54 +05:30
parent 317510047d
commit 12e7e6f612
2 changed files with 9 additions and 1 deletions

View File

@ -325,6 +325,7 @@ void Meter::setValue(int value)
d->animation->setEndValue(value); d->animation->setEndValue(value);
d->animation->start(); d->animation->start();
} }
emit valueChanged(value);
} }
int MeterPrivate::meterValue() const int MeterPrivate::meterValue() const

View File

@ -57,7 +57,7 @@ class PLASMA_EXPORT Meter : public QGraphicsWidget
Q_ENUMS(MeterType) Q_ENUMS(MeterType)
Q_PROPERTY(int minimum READ minimum WRITE setMinimum) Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
Q_PROPERTY(int maximum READ maximum WRITE setMaximum) Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
Q_PROPERTY(int value READ value WRITE setValue) Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
Q_PROPERTY(QString svg READ svg WRITE setSvg) Q_PROPERTY(QString svg READ svg WRITE setSvg)
Q_PROPERTY(MeterType meterType READ meterType WRITE setMeterType) Q_PROPERTY(MeterType meterType READ meterType WRITE setMeterType)
@ -201,6 +201,13 @@ public Q_SLOTS:
*/ */
void setValue(int value); void setValue(int value);
Q_SIGNALS:
/**
* This signal is sent when the value of the meter changes programmatically.
* The meter's value is passed.
*/
void valueChanged(const int &value);
protected: protected:
/** /**
* Reimplemented from Plasma::Widget * Reimplemented from Plasma::Widget