• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Public Types | Public Slots | Public Member Functions | Protected Member Functions | Properties | List of all members
KLed Class Reference

#include <kled.h>

Inheritance diagram for KLed:
Inheritance graph
[legend]

Public Types

enum  Look { Flat, Raised, Sunken }
 
enum  Shape { Rectangular, Circular }
 
enum  State { Off, On }
 

Public Slots

void off ()
 
void on ()
 
void toggle ()
 

Public Member Functions

 KLed (QWidget *parent=0)
 
 KLed (const QColor &color, QWidget *parent=0)
 
 KLed (const QColor &color, KLed::State state, KLed::Look look, KLed::Shape shape, QWidget *parent=0)
 
 ~KLed ()
 
QColor color () const
 
int darkFactor () const
 
Look look () const
 
virtual QSize minimumSizeHint () const
 
void setColor (const QColor &color)
 
void setDarkFactor (int darkFactor)
 
void setLook (Look look)
 
void setShape (Shape shape)
 
void setState (State state)
 
Shape shape () const
 
virtual QSize sizeHint () const
 
State state () const
 

Protected Member Functions

virtual int ledWidth () const
 
bool paintCachedPixmap ()
 
void paintEvent (QPaintEvent *)
 
virtual void paintFlat ()
 
void paintLed (Shape shape, Look look)
 
virtual void paintRaised ()
 
virtual void paintRect ()
 
virtual void paintRectFrame (bool raised)
 
virtual void paintSunken ()
 
void resizeEvent (QResizeEvent *)
 
void updateCachedPixmap ()
 

Properties

QColor color
 
int darkFactor
 
Look look
 
Shape shape
 
State state
 

Detailed Description

An LED widget.

Displays a round or rectangular light emitting diode.

It is configurable to arbitrary 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.

kled.png
KDE LED Widget
Author
Joerg Habenicht, Richard J. Moore (rich@.nosp@m.kde..nosp@m.org) 1998, 1999

Definition at line 44 of file kled.h.

Member Enumeration Documentation

enum KLed::Look

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.

Timings:
( 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.

LED look.

Enumerator
Flat 
Raised 
Sunken 

Definition at line 88 of file kled.h.

enum KLed::Shape

Shades of the lamp.

LED shape

Enumerator
Rectangular 
Circular 

Definition at line 66 of file kled.h.

enum KLed::State

Status of the light is on/off.

LED on/off.

Enumerator
Off 
On 

Definition at line 60 of file kled.h.

Constructor & Destructor Documentation

KLed::KLed ( QWidget *  parent = 0)
explicit

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

Parameters
parentThe parent widget.

Definition at line 52 of file kled.cpp.

KLed::KLed ( const QColor &  color,
QWidget *  parent = 0 
)
explicit

Constructs a round LED widget with the supplied color which will initially be turned on.

Parameters
colorInitial color of the LED.
parentThe parent widget. Constructor

Definition at line 60 of file kled.cpp.

KLed::KLed ( const QColor &  color,
KLed::State  state,
KLed::Look  look,
KLed::Shape  shape,
QWidget *  parent = 0 
)

Constructor with the color, state and look.

Differs from above only in the parameters, which configure all settings.

Parameters
colorInitial color of the LED.
stateSets the State.
lookSets the Look.
shapeSets the Shape (rectangular or circular).
parentThe parent widget. Constructor

Definition at line 67 of file kled.cpp.

KLed::~KLed ( )

Destroys the LED widget.

Destructor

Definition at line 79 of file kled.cpp.

Member Function Documentation

QColor KLed::color ( ) const

Returns the current color of the widget.

See also
Color Returns LED color.
int KLed::darkFactor ( ) const

Returns the factor to darken the LED.

See also
setDarkFactor() Returns dark factor.
int KLed::ledWidth ( ) const
protectedvirtual

Returns the width of the led.

Definition at line 116 of file kled.cpp.

Look KLed::look ( ) const

Returns the current look of the widget.

See also
Look Returns LED look.
QSize KLed::minimumSizeHint ( ) const
virtual

Definition at line 261 of file kled.cpp.

void KLed::off ( )
slot

Sets the state of the widget to Off.

The widget will be painted immediately.

See also
on() toggle() setState()

Definition at line 243 of file kled.cpp.

void KLed::on ( )
slot

Sets the state of the widget to On.

The widget will be painted immediately.

See also
off() toggle() setState()

Definition at line 238 of file kled.cpp.

bool KLed::paintCachedPixmap ( )
protected

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

Definition at line 127 of file kled.cpp.

void KLed::paintEvent ( QPaintEvent *  )
protected

Definition at line 84 of file kled.cpp.

void KLed::paintFlat ( )
protectedvirtual

Paints a circular, flat LED.

Definition at line 137 of file kled.cpp.

void KLed::paintLed ( Shape  shape,
Look  look 
)
protected

Definition at line 273 of file kled.cpp.

void KLed::paintRaised ( )
protectedvirtual

Paints a circular, raised LED.

Definition at line 142 of file kled.cpp.

void KLed::paintRect ( )
protectedvirtual

Paints a rectangular, flat LED.

Definition at line 152 of file kled.cpp.

void KLed::paintRectFrame ( bool  raised)
protectedvirtual

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

Definition at line 157 of file kled.cpp.

void KLed::paintSunken ( )
protectedvirtual

Paints a circular, sunken LED.

Definition at line 147 of file kled.cpp.

void KLed::resizeEvent ( QResizeEvent *  )
protected

Definition at line 248 of file kled.cpp.

void KLed::setColor ( const QColor &  color)

Set the color of the widget.

The LED is shown with Color when in the KLed::On state or with the darken Color (

See also
setDarkFactor) in KLed::Off state.

The widget calls the update() method, so it will be updated when entering the main event loop.

See also
Color
Parameters
colorNew color of the LED. Sets the LED color.

Definition at line 200 of file kled.cpp.

void KLed::setDarkFactor ( int  darkFactor)

Sets the factor to darken the LED in KLed::Off state.

The

Parameters
darkFactorshould be greater than 100, otherwise the LED becomes lighter in KLed::Off state.

Defaults to 300.

See also
QColor
Parameters
darkFactorSets the factor to darken the LED. Sets the factor to darken the LED.

Definition at line 209 of file kled.cpp.

void KLed::setLook ( Look  look)

Sets the look of the widget.

The look may be Flat, Raised or Sunken.

The widget calls the update() method, so it will be updated when entering the main event loop.

See also
Look
Parameters
lookNew look of the LED. Sets LED look.

Definition at line 223 of file kled.cpp.

void KLed::setShape ( Shape  shape)

Set the shape of the LED.

Parameters
shapeThe LED shape. Set LED shape.

Definition at line 191 of file kled.cpp.

void KLed::setState ( State  state)

Sets the state of the widget to On or Off.

The widget will be painted immediately.

See also
on() off() toggle()
Parameters
stateThe LED state: on or off. Set LED state.

Definition at line 182 of file kled.cpp.

Shape KLed::shape ( ) const

Returns the current shape of the widget.

See also
Shape Returns LED shape.
QSize KLed::sizeHint ( void  ) const
virtual

Definition at line 253 of file kled.cpp.

State KLed::state ( ) const

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

See also
State Returns LED state.
void KLed::toggle ( )
slot

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

The widget repaints itself immediately.

Definition at line 232 of file kled.cpp.

void KLed::updateCachedPixmap ( )
protected

invalidates caches after property changes and calls update()

Definition at line 266 of file kled.cpp.

Property Documentation

QColor KLed::color
readwrite

Definition at line 51 of file kled.h.

int KLed::darkFactor
readwrite

Definition at line 52 of file kled.h.

KLed::Look KLed::look
readwrite

Definition at line 50 of file kled.h.

KLed::Shape KLed::shape
readwrite

Definition at line 49 of file kled.h.

KLed::State KLed::state
readwrite

Definition at line 48 of file kled.h.


The documentation for this class was generated from the following files:
  • kled.h
  • kled.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal