• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libplasma

Plasma::Meter

Plasma::Meter Class Reference

#include <meter.h>

Inheritance diagram for Plasma::Meter:

Inheritance graph
[legend]

List of all members.


Detailed Description

This class provides generic meter widget for the Plasma desktop.

Analog and bar meters are supported.

Svgs can have following ids:

  • background: Drawn first to the bottom
  • label0, label1, ...: Rectangles mark the label places
  • bar: Bar for the bar meter
  • 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

Definition at line 48 of file meter.h.


Public Types

enum  MeterType { BarMeterHorizontal, BarMeterVertical, AnalogMeter }

Public Slots

void dataUpdated (QString sourceName, Plasma::DataEngine::Data data)

Public Member Functions

 Meter (QGraphicsItem *parent=0, QObject *parentObject=0)
 ~Meter ()
void setMaximum (int maximum)
int maximum () const
void setMinimum (int minimum)
int minimum () const
void setValue (int value)
int value () const
void setSvg (QString svg)
QString svg () const
void setMeterType (MeterType type)
MeterType meterType () const
virtual QSizeF sizeHint () const
void setLabel (int index, const QString &text)
QString label (int index) const
void setLabelColor (int index, const QColor &color)
QColor labelColor (int index) const
void setLabelFont (int index, const QFont &font)
QFont labelFont (int index) const
void setLabelAlignment (int index, const Qt::Alignment alignment)
Qt::Alignment labelAlignment (int index) const

Protected Member Functions

virtual void paintWidget (QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget=0)

Properties

int minimum
int maximum
int value
QString svg
MeterType meterType

Member Enumeration Documentation

enum Plasma::Meter::MeterType

Meter types enum.

Enumerator:
BarMeterHorizontal  Horizontal bar meter (like thermometer).

BarMeterVertical  Vertical bar meter (like thermometer).

AnalogMeter  Analog meter (like tachometer).

Definition at line 62 of file meter.h.


Constructor & Destructor Documentation

Plasma::Meter::Meter ( QGraphicsItem *  parent = 0,
QObject *  parentObject = 0 
) [explicit]

Constructor.

Parameters:
parent the QGraphicsItem this meter is parented to.
parent the QObject this meter is parented to.

Definition at line 114 of file meter.cpp.

Plasma::Meter::~Meter (  ) 

Destructor.

Definition at line 120 of file meter.cpp.


Member Function Documentation

void Plasma::Meter::setMaximum ( int  maximum  ) 

Set maximum value for the meter.

Definition at line 125 of file meter.cpp.

int Plasma::Meter::maximum (  )  const

Returns:
maximum value for the meter

void Plasma::Meter::setMinimum ( int  minimum  ) 

Set minimum value for the meter.

Definition at line 135 of file meter.cpp.

int Plasma::Meter::minimum (  )  const

Returns:
minimum value for the meter

void Plasma::Meter::setValue ( int  value  ) 

Set value for the meter.

Definition at line 145 of file meter.cpp.

int Plasma::Meter::value (  )  const

Returns:
value for the meter

void Plasma::Meter::setSvg ( QString  svg  ) 

Set svg file name.

Definition at line 220 of file meter.cpp.

QString Plasma::Meter::svg (  )  const

Returns:
svg file name

void Plasma::Meter::setMeterType ( MeterType  type  ) 

Set meter type.

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

Definition at line 240 of file meter.cpp.

MeterType Plasma::Meter::meterType (  )  const

Returns:
meter type

QSizeF Plasma::Meter::sizeHint (  )  const [virtual]

Reimplemented from Plasma::Widget.

Reimplemented from Plasma::Widget.

Definition at line 259 of file meter.cpp.

void Plasma::Meter::setLabel ( int  index,
const QString &  text 
)

Set text label for the meter.

Parameters:
index label index.
text text for the label.

Definition at line 156 of file meter.cpp.

QString Plasma::Meter::label ( int  index  )  const

Parameters:
index label index

Returns:
text label for the meter

Definition at line 164 of file meter.cpp.

void Plasma::Meter::setLabelColor ( int  index,
const QColor &  color 
)

Set text label color for the meter.

Parameters:
index label index.
text color for the label.

Definition at line 169 of file meter.cpp.

QColor Plasma::Meter::labelColor ( int  index  )  const

Parameters:
index label index

Returns:
text label color for the meter

Definition at line 177 of file meter.cpp.

void Plasma::Meter::setLabelFont ( int  index,
const QFont &  font 
)

Set text label font for the meter.

Parameters:
index label index.
text font for the label.

Definition at line 182 of file meter.cpp.

QFont Plasma::Meter::labelFont ( int  index  )  const

Parameters:
index label index

Returns:
text label font for the meter

Definition at line 190 of file meter.cpp.

void Plasma::Meter::setLabelAlignment ( int  index,
const Qt::Alignment  alignment 
)

Set text label alignment for the meter.

Parameters:
index label index.
text alignment for the label.

Definition at line 195 of file meter.cpp.

Qt::Alignment Plasma::Meter::labelAlignment ( int  index  )  const

Parameters:
index label index

Returns:
text label alignment for the meter

Definition at line 203 of file meter.cpp.

void Plasma::Meter::dataUpdated ( QString  sourceName,
Plasma::DataEngine::Data  data 
) [slot]

Used when connecting to a DataEngine.

Definition at line 208 of file meter.cpp.

void Plasma::Meter::paintWidget ( QPainter *  p,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = 0 
) [protected, virtual]

Reimplemented from Plasma::Widget.

Reimplemented from Plasma::Widget.

Definition at line 264 of file meter.cpp.


Property Documentation

int Plasma::Meter::minimum [read, write]

Definition at line 52 of file meter.h.

int Plasma::Meter::maximum [read, write]

Definition at line 53 of file meter.h.

int Plasma::Meter::value [read, write]

Definition at line 54 of file meter.h.

QString Plasma::Meter::svg [read, write]

Definition at line 55 of file meter.h.

Meter::MeterType Plasma::Meter::meterType [read, write]

Definition at line 56 of file meter.h.


The documentation for this class was generated from the following files:
  • meter.h
  • meter.cpp

libplasma

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

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal