Plasma.Meter

KDE 4.5 PyKDE API Reference

- KDE's Python API

# Meter Class Reference

`from PyKDE4.plasma import *`

Inherits: QGraphicsWidget → QObject
Namespace: Plasma

## Detailed Description

Meter plasma/widgets/meter.h <Plasma/Widgets/Meter>

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

## Enumerations
MeterType | { BarMeterHorizontal, BarMeterVertical, AnalogMeter }
## Methods
| __init__ (self, QGraphicsItem parent=0)
| dataUpdated (self, QString sourceName, {QString:QVariant} data)
QString | label (self, int index)
Qt::Alignment | labelAlignment (self, int index)
QColor | labelColor (self, int index)
QFont | labelFont (self, int index)
QRectF | labelRect (self, int index)
int | maximum (self)
Plasma.Meter.MeterType | meterType (self)
int | minimum (self)
| paint (self, QPainter p, QStyleOptionGraphicsItem option, QWidget widget=0)
| setLabel (self, int index, QString text)
| setLabelAlignment (self, int index, Qt::Alignment alignment)
| setLabelColor (self, int index, QColor color)
| setLabelFont (self, int index, QFont font)
| setMaximum (self, int maximum)
| setMeterType (self, Plasma.Meter.MeterType type)
| setMinimum (self, int minimum)
| setSvg (self, QString svg)
| setValue (self, int value)
QSizeF | sizeHint (self, Qt::SizeHint which, QSizeF constraint=QSizeF())
QString | svg (self)
int | value (self)

## Method Documentation

__init__ | ( | self, |
|  | QGraphicsItem | parent=0
| ) |  |  |

Constructor

Parameters:

  | parent | the QGraphicsItem this meter is parented to.
  | parent | the QObject this meter is parented to.

dataUpdated | ( | self, |
|  | QString | sourceName,
|  | {QString:QVariant} | data
| ) |  |  |

Used when connecting to a DataEngine

QString label | ( | self, |
|  | int | index
| ) |  |  |

Parameters:

  | index | label index

Returns:
  text label for the meter

Qt::Alignment labelAlignment | ( | self, |
|  | int | index
| ) |  |  |

Parameters:

  | index | label index

Returns:
  text label alignment for the meter

QColor labelColor | ( | self, |
|  | int | index
| ) |  |  |

Parameters:

  | index | label index

Returns:
  text label color for the meter

QFont labelFont | ( | self, |
|  | int | index
| ) |  |  |

Parameters:

  | index | label index

Returns:
  text label font for the meter

QRectF labelRect | ( | self, |
|  | int | index
| ) |  |  |

Parameters:

  | index | label index

Returns:
  the size of this label.

int maximum | ( |  | self ) |

Returns:
  maximum value for the meter

Plasma.Meter.MeterType meterType | ( |  | self ) |

Returns:
  meter type

int minimum | ( |  | self ) |

Returns:
  minimum value for the meter

paint | ( | self, |
|  | QPainter | p,
|  | QStyleOptionGraphicsItem | option,
|  | QWidget | widget=0
| ) |  |  |

Reimplemented from Plasma.Widget

setLabel | ( | self, |
|  | int | index,
|  | QString | text
| ) |  |  |

Set text label for the meter

Parameters:

  | index | label index.
  | text | text for the label.

setLabelAlignment | ( | self, |
|  | int | index,
|  | Qt::Alignment | alignment
| ) |  |  |

Set text label alignment for the meter

Parameters:

  | index | label index
  | alignment | the text alignment to apply to the label

setLabelColor | ( | self, |
|  | int | index,
|  | QColor | color
| ) |  |  |

Set text label color for the meter

Parameters:

  | index | label index
  | color | the color to apply to the label

setLabelFont | ( | self, |
|  | int | index,
|  | QFont | font
| ) |  |  |

Set text label font for the meter

Parameters:

  | index | label index
  | font | the font to apply to the label

setMaximum | ( | self, |
|  | int | maximum
| ) |  |  |

Set maximum value for the meter

setMeterType | ( | self, |
|  | Plasma.Meter.MeterType | type
| ) |  |  |

Set meter type. Note: setSvg gets called automatically with the proper default values if svg is not set.

setMinimum | ( | self, |
|  | int | minimum
| ) |  |  |

Set minimum value for the meter

setSvg | ( | self, |
|  | QString | svg
| ) |  |  |

Set svg file name

setValue | ( | self, |
|  | int | value
| ) |  |  |

Set value for the meter

QSizeF sizeHint | ( | self, |
|  | Qt::SizeHint | which,
|  | QSizeF | constraint=QSizeF()
| ) |  |  |

QString svg | ( |  | self ) |

Returns:
  svg file name

int value | ( |  | self ) |

Returns:
  value for the meter

## Enumeration Documentation

MeterType

Meter types enum

Enumerator:

  BarMeterHorizontal |
  BarMeterVertical |
  AnalogMeter |