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

KDEUI

KCapacityBar Class Reference

This widget shows a bar which is filled to show the level of usage of a certain device. More...

#include <kcapacitybar.h>

Inheritance diagram for KCapacityBar:
QWidget

List of all members.

Public Types

enum  DrawTextMode { DrawTextInline = 0, DrawTextOutline }

Public Member Functions

int barHeight () const
bool continuous () const
void drawCapacityBar (QPainter *p, const QRect &rect) const
bool fillFullBlocks () const
Qt::Alignment horizontalTextAlignment () const
 KCapacityBar (DrawTextMode drawTextMode=DrawTextOutline, QWidget *parent=0)
virtual QSize minimumSizeHint () const
void setBarHeight (int barHeight)
void setContinuous (bool continuous)
void setFillFullBlocks (bool fillFullBlocks)
void setHorizontalTextAlignment (Qt::Alignment textAlignment)
void setText (const QString &text)
void setValue (int value)
QString text () const
int value () const
 ~KCapacityBar ()

Protected Member Functions

virtual void changeEvent (QEvent *event)
virtual void paintEvent (QPaintEvent *event)

Detailed Description

This widget shows a bar which is filled to show the level of usage of a certain device.

This widget represents a bar which goal is to show the level of usage of a device. Its look is similar to a progress bar, but different, because this widget does not want to give a notion of progress.

Since:
4.2
Author:
Rafael Fernández López <ereslibre@kde.org>

Definition at line 42 of file kcapacitybar.h.


Member Enumeration Documentation

enum KCapacityBar::DrawTextMode
Enumerator:
DrawTextInline 

If any text set, draw it into the capacity bar.

DrawTextOutline 

If any text set, draw it out of the capacity bar.

Definition at line 46 of file kcapacitybar.h.


Constructor & Destructor Documentation

KCapacityBar::KCapacityBar ( KCapacityBar::DrawTextMode  drawTextMode = DrawTextOutline,
QWidget *  parent = 0 
) [explicit]

Capacity bar constructor.

Parameters:
drawTextMode If any text set, whether to draw it into the capacity bar or not.
parent The parent of the widget.

Definition at line 65 of file kcapacitybar.cpp.

KCapacityBar::~KCapacityBar (  ) 

Definition at line 72 of file kcapacitybar.cpp.


Member Function Documentation

int KCapacityBar::barHeight (  )  const
Returns:
The preferred height of the capacity bar.

Definition at line 124 of file kcapacitybar.cpp.

void KCapacityBar::changeEvent ( QEvent *  event  )  [protected, virtual]

Definition at line 320 of file kcapacitybar.cpp.

bool KCapacityBar::continuous (  )  const
Returns:
Whether the fill of the capacity bar should be continuous or block-based.

Definition at line 112 of file kcapacitybar.cpp.

void KCapacityBar::drawCapacityBar ( QPainter *  p,
const QRect &  rect 
) const

This method allows you to draw the widget, directly, for example on item delegates.

You only need the painter object and the rect where this widget should be drawn.

Definition at line 146 of file kcapacitybar.cpp.

bool KCapacityBar::fillFullBlocks (  )  const
Returns:
Whether the last block shown can be cut off when necessary.

Definition at line 102 of file kcapacitybar.cpp.

Qt::Alignment KCapacityBar::horizontalTextAlignment (  )  const
Returns:
The horizontal alignment for the text that will be drawn.

Definition at line 141 of file kcapacitybar.cpp.

QSize KCapacityBar::minimumSizeHint (  )  const [virtual]

Definition at line 329 of file kcapacitybar.cpp.

void KCapacityBar::paintEvent ( QPaintEvent *  event  )  [protected, virtual]

Definition at line 346 of file kcapacitybar.cpp.

void KCapacityBar::setBarHeight ( int  barHeight  ) 

Sets the height (in pixels) of the bar.

Parameters:
barHeight The preferred height (in pixels) of the capacity bar.
Note:
If you set a certain text and the capacity bar is in inline mode, the height of the bar will be the maximum of the font height and this value.
If you set a certain text and the capacity bar is in outline mode, the height of the whole capacity bar will be bigger than this value. Take in count the height of this widget is got from adding the bar height, the font metrics height and a small separator between the bar and the outline text.
Its value is 12 pixels by default.

Definition at line 117 of file kcapacitybar.cpp.

void KCapacityBar::setContinuous ( bool  continuous  ) 

Sets whether the fill of the capacity bar should be continuous or in block mode.

Parameters:
continuous If true, the fill of the capacity bar is done in a continuous way. In other case, the fill is done with separated blocks.
Note:
Its value is true by default.

Definition at line 107 of file kcapacitybar.cpp.

void KCapacityBar::setFillFullBlocks ( bool  fillFullBlocks  ) 

When the capacity bar is non-continuous, sets whether the last block shown should be drawn full or can be cut off (depending on the capacity bar width, and the value set on it).

Parameters:
fillFullBlocks If true, the last block drawn will be fully filled, on other case, the last block drawn could be cut off.
Note:
This method is only relevant if the capacity bar is in non-continuous mode.
Its value is true by default.
See also:
setContinuous, continuous

Definition at line 97 of file kcapacitybar.cpp.

void KCapacityBar::setHorizontalTextAlignment ( Qt::Alignment  textAlignment  ) 

If the capacity bar is in outline text mode, draw the text with textAlignment alignment.

Parameters:
textAlignment Sets the horizontal alignment for the text if the capacity bar is in outline text mode.
Note:
If textAlignemt contains vertical alignment flags, they will be ignored.
If the capacity bar is in inline text mode, the text is always centered, and both vertical and horizontal flags set through this method are ignored.
Its value is centered by default.

Definition at line 129 of file kcapacitybar.cpp.

void KCapacityBar::setText ( const QString &  text  ) 

Sets the text for the capacity bar.

Parameters:
text The text that the capacity bar will show.
Note:
This is an empty string by default.

Definition at line 87 of file kcapacitybar.cpp.

void KCapacityBar::setValue ( int  value  ) 

Capacity bar fill value.

Parameters:
value This parameter can take values from 0 to 100.
Note:
Its value is 0 by default.

Definition at line 77 of file kcapacitybar.cpp.

QString KCapacityBar::text (  )  const
Returns:
The text that the capacity bar will show.

Definition at line 92 of file kcapacitybar.cpp.

int KCapacityBar::value (  )  const
Returns:
The fill value of the capacity bar.

Definition at line 82 of file kcapacitybar.cpp.


The documentation for this class was generated from the following files:
  • kcapacitybar.h
  • kcapacitybar.cpp

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal