libplasma
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
00050 class PLASMA_EXPORT Meter : public QGraphicsWidget
00051 {
00052 Q_OBJECT
00053 Q_ENUMS(MeterType)
00054 Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
00055 Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
00056 Q_PROPERTY(int value READ value WRITE setValue)
00057 Q_PROPERTY(QString svg READ svg WRITE setSvg)
00058 Q_PROPERTY(MeterType meterType READ meterType WRITE setMeterType)
00059
00060 public:
00064 enum MeterType {
00066 BarMeterHorizontal,
00068 BarMeterVertical,
00070 AnalogMeter
00071 };
00072
00078 explicit Meter(QGraphicsItem *parent = 0);
00079
00083 ~Meter();
00084
00088 void setMaximum(int maximum);
00089
00093 int maximum() const;
00094
00098 void setMinimum(int minimum);
00099
00103 int minimum() const;
00104
00108 void setValue(int value);
00109
00113 int value() const;
00114
00118 void setSvg(const QString &svg);
00119
00123 QString svg() const;
00124
00129 void setMeterType(MeterType type);
00130
00134 MeterType meterType() const;
00135
00141 void setLabel(int index, const QString &text);
00142
00147 QString label(int index) const;
00148
00154 void setLabelColor(int index, const QColor &color);
00155
00160 QColor labelColor(int index) const;
00161
00167 void setLabelFont(int index, const QFont &font);
00168
00173 QFont labelFont(int index) const;
00174
00180 void setLabelAlignment(int index, const Qt::Alignment alignment);
00181
00186 Qt::Alignment labelAlignment(int index) const;
00187
00188 public Q_SLOTS:
00192 void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
00193
00194 protected:
00198 virtual void paint(QPainter *p,
00199 const QStyleOptionGraphicsItem *option,
00200 QWidget *widget = 0);
00201
00202 private:
00203 MeterPrivate *const d;
00204 };
00205
00206 }
00207
00208 #endif