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 METER_HEADER
00021 #define METER_HEADER
00022
00023 #include <plasma/plasma_export.h>
00024 #include <plasma/dataengine.h>
00025 #include <plasma/widgets/widget.h>
00026
00027 namespace Plasma
00028 {
00029
00048 class PLASMA_EXPORT Meter : public Plasma::Widget
00049 {
00050 Q_OBJECT
00051 Q_ENUMS(MeterType)
00052 Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
00053 Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
00054 Q_PROPERTY(int value READ value WRITE setValue)
00055 Q_PROPERTY(QString svg READ svg WRITE setSvg)
00056 Q_PROPERTY(MeterType meterType READ meterType WRITE setMeterType)
00057
00058 public:
00062 enum MeterType {
00064 BarMeterHorizontal,
00066 BarMeterVertical,
00068 AnalogMeter
00069 };
00070
00076 explicit Meter(QGraphicsItem *parent = 0, QObject *parentObject = 0);
00077
00081 ~Meter();
00082
00086 void setMaximum(int maximum);
00087
00091 int maximum() const;
00092
00096 void setMinimum(int minimum);
00097
00101 int minimum() const;
00102
00106 void setValue(int value);
00107
00111 int value() const;
00112
00116 void setSvg(QString svg);
00117
00121 QString svg() const;
00122
00127 void setMeterType(MeterType type);
00128
00132 MeterType meterType() const;
00133
00137 virtual QSizeF sizeHint() const;
00138
00144 void setLabel(int index, const QString &text);
00145
00150 QString label(int index) const;
00151
00157 void setLabelColor(int index, const QColor &color);
00158
00163 QColor labelColor(int index) const;
00164
00170 void setLabelFont(int index, const QFont &font);
00171
00176 QFont labelFont(int index) const;
00177
00183 void setLabelAlignment(int index, const Qt::Alignment alignment);
00184
00189 Qt::Alignment labelAlignment(int index) const;
00190
00191 public Q_SLOTS:
00195 void dataUpdated(QString sourceName, Plasma::DataEngine::Data data);
00196
00197 protected:
00201 virtual void paintWidget(QPainter *p,
00202 const QStyleOptionGraphicsItem *option,
00203 QWidget *widget = 0);
00204
00205 private:
00206 class Private;
00207 Private *const d;
00208 };
00209
00210 }
00211
00212 #endif