Plasma
meter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PLASMA_METER_H
00021 #define PLASMA_METER_H
00022
00023 #include <plasma/plasma_export.h>
00024 #include <plasma/dataengine.h>
00025 #include <QtGui/QGraphicsWidget>
00026
00027 namespace Plasma
00028 {
00029
00030 class MeterPrivate;
00031
00054 class PLASMA_EXPORT Meter : public QGraphicsWidget
00055 {
00056 Q_OBJECT
00057 Q_ENUMS(MeterType)
00058 Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
00059 Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
00060 Q_PROPERTY(int value READ value WRITE setValue)
00061 Q_PROPERTY(QString svg READ svg WRITE setSvg)
00062 Q_PROPERTY(MeterType meterType READ meterType WRITE setMeterType)
00063
00064 public:
00068 enum MeterType {
00070 BarMeterHorizontal,
00072 BarMeterVertical,
00074 AnalogMeter
00075 };
00076
00082 explicit Meter(QGraphicsItem *parent = 0);
00083
00087 ~Meter();
00088
00092 void setMaximum(int maximum);
00093
00097 int maximum() const;
00098
00102 void setMinimum(int minimum);
00103
00107 int minimum() const;
00108
00112 void setValue(int value);
00113
00117 int value() const;
00118
00122 void setSvg(const QString &svg);
00123
00127 QString svg() const;
00128
00133 void setMeterType(MeterType type);
00134
00138 MeterType meterType() const;
00139
00145 void setLabel(int index, const QString &text);
00146
00151 QString label(int index) const;
00152
00158 void setLabelColor(int index, const QColor &color);
00159
00164 QColor labelColor(int index) const;
00165
00171 void setLabelFont(int index, const QFont &font);
00172
00177 QFont labelFont(int index) const;
00178
00184 void setLabelAlignment(int index, const Qt::Alignment alignment);
00185
00190 Qt::Alignment labelAlignment(int index) const;
00191
00196 QRectF labelRect(int index) const;
00197
00198 public Q_SLOTS:
00202 void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
00203
00204 protected:
00208 virtual void paint(QPainter *p,
00209 const QStyleOptionGraphicsItem *option,
00210 QWidget *widget = 0);
00211
00212 private:
00213 Q_PRIVATE_SLOT(d, void progressChanged(qreal))
00214 MeterPrivate *const d;
00215 };
00216
00217 }
00218
00219 #endif