class QMeter : public QLabel

LCD-type digital meter.

Inheritance:

QMeter


Public Methods

float getLevel(void)
void initMeter(void)
QMeter( QWidget* parent=0, const char* name=0, WFlags f=0 )
void Redraw(void)
public slots: void setLevel(double percent)
void setLevel(int ipercent)
void setLightSize(float percent)

Protected Fields

bool continuous
float current_level
float lightsize
QPixmap meter_map
QSize oldSize
int ppl

Protected Methods

QRect flipVert(int x0, int y0, int ww, int hh, QPixmap map)

Documentation

The QMeter object is a special QLabel. It displays a rectangular, vertical LCD-type digital meter. If you make it large enough, a QMeter will be composed of several individual "lights" stacked together, as in an LCD-meter. If the QMeter is too small, it will be continuous.

The QMeter changes level continuously. That is, as you increase the level, each "light" grows in size. After one light is completely lit, the next one is drawn. There is no set level cooresponding to a particular change in the lights. That depends on the size of the meter, the size of the lights, and so on.

This class inherits the Qt QLabel class. I've documented the protected methods in case you want to use this class as a base for a new widget.

  
  ----------------------------------------------------------
  ----------------------------------------------------------
  

QMeter( QWidget* parent=0, const char* name=0, WFlags f=0 )
Class constructor. The arguments are the same as those for a QLabel.

void Redraw(void)
Redraws the meter. You need to make a call to initMeter() if you've changed anything other than the meter level.
See Also:
initMeter

void setLightSize(float percent)
Sets the size of the "lights" in the meter, in terms of percent of the total size of the meter. In some sense, it also sets the number of lights in the meter. E.g.: "setLightSize(0.05)" makes the meter have 20 "lights".

Automatically calls initMeter(), but not Redraw().

See Also:
initMeter, Redraw

float getLevel(void)
Returns the level, in units of percent of the total meter size, that the meter is currently set to.

void initMeter(void)
Initializes the meter.

You should call this after any change in size. It's automatically called by setLightSize() and the class constructor. It does not, however, call Redraw(); you need to do that yourself.

See Also:
Redraw

public slots: void setLevel(double percent)
Sets the meter level to percent, which is the percent of the total meter size. Automatically calls Redraw().
See Also:
Redraw

void setLevel(int ipercent)
Overloaded version of setLevel(float). Essentially a call to setLevel((float)ipercent/100.0).
See Also:
Redraw

QPixmap meter_map
The actual QPixmap of the meter gets stored here.

float lightsize
Stores the light size set by setLightSize().

float current_level
Stores the meter level.

int ppl
Contains the height of each "light" in pixels.

QSize oldSize
Used internally by initMeter().

bool continuous
Set by initMeter(); indicates whether the QMeter should be continuous or subdivided into "lights."

QRect flipVert(int x0, int y0, int ww, int hh, QPixmap map)
This method is used internally by Redraw() to perform certain coordinate transforms.


This class has no child classes.

alphabetic index hierarchy of classes


Copyright 1997 by John Weiss [John.Weiss@colorado.edu] "generated by doc++"?! More like mangled ...

generated by doc++