org.kde.koala

Class KLed

public class KLed extends QWidget

Displays a round or rectangular light emitting diode. It is configurable to five colors, the two on/off states and three styles (or "looks"); It may display itself in a performant flat view, a round view with light spot or a round view sunken in the screen. \image html kled.png "KDE LED Widget"

Author: Joerg Habenicht, Richard J. Moore (rich@kde.org) 1998, 1999

UNKNOWN: An LED widget.

Field Summary
static intCircular
static intFlat
Displays a flat, round or sunken LED.
static intOff
Status of the light is on/off.
static intOn
static intRaised
static intRectangular
Shades of the lamp.
static intSunken
Constructor Summary
protected KLed(Class dummy)
KLed(QWidget parent, String name)
Constructs a green, round LED widget which will initially be turned on.
KLed(QWidget parent)
KLed()
KLed(QColor col, QWidget parent, String name)
Constructor with the ledcolor, the parent widget, and the name.
KLed(QColor col, QWidget parent)
KLed(QColor col)
KLed(QColor col, int state, int look, int shape, QWidget parent, String name)
Constructor with the ledcolor, ledstate, ledlook, the parent widget, and the name.
KLed(QColor col, int state, int look, int shape, QWidget parent)
KLed(QColor col, int state, int look, int shape)
Method Summary
StringclassName()
QColorcolor()
Returns the color of the widget
intdarkFactor()
Returns the factor to darken the LED.
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
protected intensureRoundLed()
Compute LED width
protected voidfinalize()
Deletes the wrapped C++ instance
booleanisDisposed()
Has the wrapped C++ instance been deleted?
intlook()
Returns the look of the widget.
QMetaObjectmetaObject()
QSizeminimumSizeHint()
voidoff()
Sets the state of the widget to Off.
voidon()
Sets the state of the widget to On.
protected booleanpaintCachedPixmap()
Paint the cached antialiased pixmap corresponding to the state if any
protected voidpaintEvent(QPaintEvent arg1)
protected voidpaintFlat()
Paints a circular, flat LED.
protected voidpaintRect()
Paints a rectangular, flat LED.
protected voidpaintRectFrame(boolean raised)
Paints a rectangular LED, either raised or sunken, depending on its argument.
protected voidpaintRound()
Paints a circular, raised LED.
protected voidpaintSunken()
Paints a circular, sunken LED.
voidsetColor(QColor color)
Set the color of the widget.
voidsetDarkFactor(int darkfactor)
Sets the factor to darken the LED in OFF state.
voidsetLook(int look)
Sets the look of the widget.
voidsetShape(int s)
Set the shape of the LED to s.
voidsetState(int state)
Sets the state of the widget to On or Off.
intshape()
QSizesizeHint()
intstate()
Returns the current state of the widget (on/off).
voidtoggle()
Toggles the state of the led from Off to On or vice versa.

Field Detail

Circular

public static final int Circular

Flat

public static final int Flat
Displays a flat, round or sunken LED. Displaying the LED flat is less time and color consuming, but not so nice to see. The sunken LED itself is (certainly) smaller than the round LED because of the 3 shading circles and is most time consuming. Makes sense for LED > 15x15 pixels. imings: \n ( AMD K5/133, Diamond Stealth 64 PCI Graphics, widgetsize 29x29 )
  • flat Approximately 0.7 msec per paint
  • round Approximately 2.9 msec per paint
  • sunken Approximately 3.3 msec per paint
  • The widget will be updated on the next repaining event.

    UNKNOWN: LED look.

    Off

    public static final int Off
    Status of the light is on/off.

    UNKNOWN: LED on/off.

    On

    public static final int On

    Raised

    public static final int Raised

    Rectangular

    public static final int Rectangular
    Shades of the lamp.

    UNKNOWN: LED shape.

    Sunken

    public static final int Sunken

    Constructor Detail

    KLed

    protected KLed(Class dummy)

    KLed

    public KLed(QWidget parent, String name)
    Constructs a green, round LED widget which will initially be turned on.

    UNKNOWN: Constructs a green, round LED widget which will initially be turned on.

    KLed

    public KLed(QWidget parent)

    KLed

    public KLed()

    KLed

    public KLed(QColor col, QWidget parent, String name)
    Constructor with the ledcolor, the parent widget, and the name. The State will be defaulted On and the Look round.

    Parameters: col Initial color of the LED. parent Will be handed over to QWidget. name Will be handed over to QWidget.

    UNKNOWN: Constructor.

    KLed

    public KLed(QColor col, QWidget parent)

    KLed

    public KLed(QColor col)

    KLed

    public KLed(QColor col, int state, int look, int shape, QWidget parent, String name)
    Constructor with the ledcolor, ledstate, ledlook, the parent widget, and the name. Differs from above only in the parameters, which configure all settings.

    Parameters: col Initial color of the LED. state Sets the State. look Sets the Look. shape Sets the Shape (rectangular or circular) parent Will be handed over to QWidget. name Will be handed over to QWidget.

    UNKNOWN: Constructor.

    KLed

    public KLed(QColor col, int state, int look, int shape, QWidget parent)

    KLed

    public KLed(QColor col, int state, int look, int shape)

    Method Detail

    className

    public String className()

    color

    public QColor color()
    Returns the color of the widget

    See Also: Color

    UNKNOWN: Returns LED color.

    darkFactor

    public int darkFactor()
    Returns the factor to darken the LED.

    See Also: KLed

    UNKNOWN: Returns dark factor.

    dispose

    public void dispose()
    Delete the wrapped C++ instance ahead of finalize()

    ensureRoundLed

    protected int ensureRoundLed()
    Compute LED width

    UNKNOWN: Compute LED width

    finalize

    protected void finalize()
    Deletes the wrapped C++ instance

    isDisposed

    public boolean isDisposed()
    Has the wrapped C++ instance been deleted?

    look

    public int look()
    Returns the look of the widget.

    See Also: Look

    UNKNOWN: Returns LED look.

    metaObject

    public QMetaObject metaObject()

    minimumSizeHint

    public QSize minimumSizeHint()

    off

    public void off()
    Sets the state of the widget to Off. The widget will be painted immediately.

    See Also: KLed KLed KLed KLed

    UNKNOWN: Sets the state of the widget to Off.

    on

    public void on()
    Sets the state of the widget to On. The widget will be painted immediately.

    See Also: KLed KLed KLed KLed

    UNKNOWN: Sets the state of the widget to On.

    paintCachedPixmap

    protected boolean paintCachedPixmap()
    Paint the cached antialiased pixmap corresponding to the state if any

    Returns: true if the pixmap was painted, false if it hasn't been created yet

    UNKNOWN: Paint the cached antialiased pixmap corresponding to the state if any

    paintEvent

    protected void paintEvent(QPaintEvent arg1)

    paintFlat

    protected void paintFlat()
    Paints a circular, flat LED.

    UNKNOWN: Paints a circular, flat LED.

    paintRect

    protected void paintRect()
    Paints a rectangular, flat LED.

    UNKNOWN: Paints a rectangular, flat LED.

    paintRectFrame

    protected void paintRectFrame(boolean raised)
    Paints a rectangular LED, either raised or sunken, depending on its argument.

    UNKNOWN: Paints a rectangular LED, either raised or sunken, depending on its argument.

    paintRound

    protected void paintRound()
    Paints a circular, raised LED.

    UNKNOWN: Paints a circular, raised LED.

    paintSunken

    protected void paintSunken()
    Paints a circular, sunken LED.

    UNKNOWN: Paints a circular, sunken LED.

    setColor

    public void setColor(QColor color)
    Set the color of the widget. The Color is shown with the KLed.On state. The KLed.Off state is shown with QColor.dark() method The widget calls the update() method, so it will be updated when entering the main event loop.

    Parameters: color New color of the LED.

    See Also: Color

    UNKNOWN: Sets the LED color.

    setDarkFactor

    public void setDarkFactor(int darkfactor)
    Sets the factor to darken the LED in OFF state. Same as QColor.dark(). "darkfactor should be greater than 100, else the LED gets lighter in OFF state. Defaults to 300.

    Parameters: darkfactor sets the factor to darken the LED.

    See Also: org.kde.qt.QColor

    UNKNOWN: sets the factor to darken the LED.

    setLook

    public void setLook(int look)
    Sets the look of the widget. The look may be flat, round or sunken. The widget calls the update() method, so it will be updated when entering the main event loop.

    Parameters: look New look of the LED.

    See Also: Look

    UNKNOWN: Sets LED look.

    setShape

    public void setShape(int s)
    Set the shape of the LED to s.

    UNKNOWN: Set the shape of the LED to s.

    setState

    public void setState(int state)
    Sets the state of the widget to On or Off. The widget will be painted immediately.

    Parameters: state The LED state: on or off.

    See Also: KLed KLed KLed KLed

    UNKNOWN: Set LED state.

    shape

    public int shape()

    sizeHint

    public QSize sizeHint()

    state

    public int state()
    Returns the current state of the widget (on/off).

    See Also: State

    UNKNOWN: Returns LED state.

    toggle

    public void toggle()
    Toggles the state of the led from Off to On or vice versa. The widget repaints itself immediately.

    UNKNOWN: Toggles the state of the led from Off to On or vice versa.