From 12e7e6f6121cb5eab64d982cf8a5e8a4c00beae1 Mon Sep 17 00:00:00 2001 From: Viranch Mehta Date: Tue, 21 Jun 2011 01:24:54 +0530 Subject: [PATCH] Notify when meter's value changes --- widgets/meter.cpp | 1 + widgets/meter.h | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/widgets/meter.cpp b/widgets/meter.cpp index 0bec03406..d1007e556 100644 --- a/widgets/meter.cpp +++ b/widgets/meter.cpp @@ -325,6 +325,7 @@ void Meter::setValue(int value) d->animation->setEndValue(value); d->animation->start(); } + emit valueChanged(value); } int MeterPrivate::meterValue() const diff --git a/widgets/meter.h b/widgets/meter.h index c194e68fc..a0719841e 100644 --- a/widgets/meter.h +++ b/widgets/meter.h @@ -57,7 +57,7 @@ class PLASMA_EXPORT Meter : public QGraphicsWidget Q_ENUMS(MeterType) Q_PROPERTY(int minimum READ minimum WRITE setMinimum) 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(MeterType meterType READ meterType WRITE setMeterType) @@ -201,6 +201,13 @@ public Q_SLOTS: */ 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: /** * Reimplemented from Plasma::Widget