source: trunk/examples/demo/qasteroids/ledmeter.h@ 168

Last change on this file since 168 was 160, checked in by dmik, 19 years ago

Imported table and iconview modules and a bunch of dependent examples from the official release 3.3.1 from Trolltech.

  • Property svn:keywords set to Id
File size: 939 bytes
Line 
1/*
2 * KAsteroids - Copyright (c) Martin R. Jones 1997
3 *
4 * Part of the KDE project
5 */
6
7#ifndef __LEDMETER_H__
8#define __LEDMETER_H__
9
10#include <qframe.h>
11#include <qptrlist.h>
12
13
14class KALedMeter : public QFrame
15{
16 Q_OBJECT
17public:
18 KALedMeter( QWidget *parent );
19
20 int range() const { return mRange; }
21 void setRange( int r );
22
23 int count() const { return mCount; }
24 void setCount( int c );
25
26 int value () const { return mValue; }
27
28 void addColorRange( int pc, const QColor &c );
29
30public slots:
31 void setValue( int v );
32
33protected:
34 virtual void resizeEvent( QResizeEvent * );
35 virtual void drawContents( QPainter * );
36 void calcColorRanges();
37
38protected:
39 struct ColorRange
40 {
41 int mPc;
42 int mValue;
43 QColor mColor;
44 };
45
46 int mRange;
47 int mCount;
48 int mCurrentCount;
49 int mValue;
50 QPtrList<ColorRange> mCRanges;
51};
52
53#endif
Note: See TracBrowser for help on using the repository browser.