Source Code (Use browser search to find items of interest.)
Class Index
ksirtet'Led (./kdegames/ksirtet/misc_ui.cpp:143)
class Led : public QWidget // KLed
{
public:
Led(const QColor &c, QWidget *parent, const char *name=0)
: QWidget(parent, name), col(c), _on(FALSE) {}
// : KLed(c, Off, flat, Rectangular, parent, name) {}
QSizePolicy sizePolicy() const
{ return QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); }
QSize sizeHint() const { return QSize(LED_WIDTH, LED_HEIGHT); }
void on() { if (!_on) { _on = TRUE; repaint(); } }
void off() { if (_on) {_on = FALSE; repaint(); } }
void setColor(const QColor &c) { if (c!=col) { col = c; repaint(); } }
protected:
void paintEvent(QPaintEvent *) {
QPainter p(this);
p.setBrush((_on ? col.light() : col.dark()));
p.setPen(black);
p.drawEllipse(0, 0, width(), height());
}
private:
QColor col;
bool _on;
};