• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • plasma
  • widgets
meter.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007 Petri Damsten <damu@iki.fi>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef PLASMA_METER_H
21#define PLASMA_METER_H
22
23#include <plasma/plasma_export.h>
24#include <plasma/dataengine.h>
25#include <QtGui/QGraphicsWidget>
26
27namespace Plasma
28{
29
30class MeterPrivate;
31
54class PLASMA_EXPORT Meter : public QGraphicsWidget
55{
56 Q_OBJECT
57 Q_ENUMS(MeterType)
58 Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
59 Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
60 Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
61 Q_PROPERTY(QString svg READ svg WRITE setSvg)
62 Q_PROPERTY(MeterType meterType READ meterType WRITE setMeterType)
63
64public:
68 enum MeterType {
70 BarMeterHorizontal,
72 BarMeterVertical,
74 AnalogMeter
75 };
76
82 explicit Meter(QGraphicsItem *parent = 0);
83
87 ~Meter();
88
92 int maximum() const;
93
97 int minimum() const;
98
102 int value() const;
103
107 void setSvg(const QString &svg);
108
112 QString svg() const;
113
118 void setMeterType(MeterType type);
119
123 MeterType meterType() const;
124
130 void setLabel(int index, const QString &text);
131
136 QString label(int index) const;
137
143 void setLabelColor(int index, const QColor &color);
144
149 QColor labelColor(int index) const;
150
156 void setLabelFont(int index, const QFont &font);
157
162 QFont labelFont(int index) const;
163
169 void setLabelAlignment(int index, const Qt::Alignment alignment);
170
175 Qt::Alignment labelAlignment(int index) const;
176
181 QRectF labelRect(int index) const;
182
183public Q_SLOTS:
187 void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
188
192 void setMaximum(int maximum);
193
197 void setMinimum(int minimum);
198
202 void setValue(int value);
203
204Q_SIGNALS:
209 void valueChanged(const int &value);
210
211protected:
215 virtual void paint(QPainter *p,
216 const QStyleOptionGraphicsItem *option,
217 QWidget *widget = 0);
218 QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
219
220private:
221 MeterPrivate *const d;
222};
223
224} // End of namepace
225
226#endif
Plasma::DataEngine::Data
QHash< QString, QVariant > Data
Definition: dataengine.h:68
Plasma::Meter
Provides generic meter widget for Plasma.
Definition: meter.h:55
Plasma::Meter::valueChanged
void valueChanged(const int &value)
This signal is sent when the value of the meter changes programmatically.
Plasma::Meter::MeterType
MeterType
Meter types enum.
Definition: meter.h:68
Plasma::Meter::BarMeterHorizontal
@ BarMeterHorizontal
Horizontal bar meter (like thermometer).
Definition: meter.h:70
Plasma::Meter::BarMeterVertical
@ BarMeterVertical
Vertical bar meter (like thermometer).
Definition: meter.h:72
QGraphicsWidget
QStyleOptionGraphicsItem
QWidget
dataengine.h
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
plasma_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal