/usr/include/plasma/widgets/meter.h is in kdelibs5-dev 4:4.14.38-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | /*
* Copyright (C) 2007 Petri Damsten <damu@iki.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PLASMA_METER_H
#define PLASMA_METER_H
#include <plasma/plasma_export.h>
#include <plasma/dataengine.h>
#include <QtGui/QGraphicsWidget>
namespace Plasma
{
class MeterPrivate;
/**
* @class Meter plasma/widgets/meter.h <Plasma/Widgets/Meter>
*
* @short Provides generic meter widget for Plasma
*
* Analog and bar meters are supported.
*
* Svgs can have following ids:
* - background: Drawn first to the bottom
* background can be a FrameSvg
* - label0, label1, ...: Rectangles mark the label places
* - bar: Bar for the bar meter
* can be replaced with bar-active and bar-inactive FrameSvg
* - pointer: Pointer for analog meter
* - rotatecenter: Marks the place of pointer rotation center
* - rotateminmax: Width and height of this object are the Min and Max rotate
* angles for the pointer
* - foreground: Is drawn to top
*
* @author Petri Damstén
*/
class PLASMA_EXPORT Meter : public QGraphicsWidget
{
Q_OBJECT
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 NOTIFY valueChanged)
Q_PROPERTY(QString svg READ svg WRITE setSvg)
Q_PROPERTY(MeterType meterType READ meterType WRITE setMeterType)
public:
/**
* Meter types enum
*/
enum MeterType {
/** Horizontal bar meter (like thermometer). */
BarMeterHorizontal,
/** Vertical bar meter (like thermometer). */
BarMeterVertical,
/** Analog meter (like tachometer). */
AnalogMeter
};
/**
* Constructor
* @param parent the QGraphicsItem this meter is parented to.
* @param parent the QObject this meter is parented to.
*/
explicit Meter(QGraphicsItem *parent = 0);
/**
* Destructor
*/
~Meter();
/**
* @return maximum value for the meter
*/
int maximum() const;
/**
* @return minimum value for the meter
*/
int minimum() const;
/**
* @return value for the meter
*/
int value() const;
/**
* Set svg file name
*/
void setSvg(const QString &svg);
/**
* @return svg file name
*/
QString svg() const;
/**
* Set meter type. Note: setSvg gets called automatically with the proper
* default values if svg is not set.
*/
void setMeterType(MeterType type);
/**
* @return meter type
*/
MeterType meterType() const;
/**
* Set text label for the meter
* @param index label index.
* @param text text for the label.
*/
void setLabel(int index, const QString &text);
/**
* @param index label index
* @return text label for the meter
*/
QString label(int index) const;
/**
* Set text label color for the meter
* @param index label index
* @param color the color to apply to the label
*/
void setLabelColor(int index, const QColor &color);
/**
* @param index label index
* @return text label color for the meter
*/
QColor labelColor(int index) const;
/**
* Set text label font for the meter
* @param index label index
* @param font the font to apply to the label
*/
void setLabelFont(int index, const QFont &font);
/**
* @param index label index
* @return text label font for the meter
*/
QFont labelFont(int index) const;
/**
* Set text label alignment for the meter
* @param index label index
* @param alignment the text alignment to apply to the label
*/
void setLabelAlignment(int index, const Qt::Alignment alignment);
/**
* @param index label index
* @return text label alignment for the meter
*/
Qt::Alignment labelAlignment(int index) const;
/**
* @param index label index
* @return the size of this label.
*/
QRectF labelRect(int index) const;
public Q_SLOTS:
/**
* Used when connecting to a DataEngine
*/
void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
/**
* Set maximum value for the meter
*/
void setMaximum(int maximum);
/**
* Set minimum value for the meter
*/
void setMinimum(int minimum);
/**
* Set value for the meter
*/
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
*/
virtual void paint(QPainter *p,
const QStyleOptionGraphicsItem *option,
QWidget *widget = 0);
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
private:
MeterPrivate *const d;
};
} // End of namepace
#endif
|