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

KDEUI

Public Types | Public Member Functions | Protected Member Functions | Properties

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:
Inheritance graph
[legend]

List of all members.

Public Types

enum  DrawTextMode { DrawTextInline = 0, DrawTextOutline }

Public Member Functions

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

Protected Member Functions

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

Properties

int barHeight
bool continuous
DrawTextMode drawTextMode
bool fillFullBlocks
Qt::Alignment horizontalTextAlignment
QString text
int value

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
kcapacitybar.png

KDE Capacity Bar

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

Definition at line 44 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 60 of file kcapacitybar.h.


Constructor & Destructor Documentation

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

Capacity bar constructor.

Parameters:
drawTextModeIf any text set, whether to draw it into the capacity bar or not.
parentThe 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.
void KCapacityBar::changeEvent ( QEvent *  event) [protected, virtual]

Definition at line 341 of file kcapacitybar.cpp.

bool KCapacityBar::continuous ( ) const
Returns:
Whether the fill of the capacity bar should be continuous or block-based.
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 167 of file kcapacitybar.cpp.

DrawTextMode KCapacityBar::drawTextMode ( ) const

The way text is drawn, inside the capacity bar or outside of it.

bool KCapacityBar::fillFullBlocks ( ) const
Returns:
Whether the last block shown can be cut off when necessary.
Qt::Alignment KCapacityBar::horizontalTextAlignment ( ) const
Returns:
The horizontal alignment for the text that will be drawn.
QSize KCapacityBar::minimumSizeHint ( ) const [virtual]

Definition at line 350 of file kcapacitybar.cpp.

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

Definition at line 367 of file kcapacitybar.cpp.

void KCapacityBar::setBarHeight ( int  barHeight)

Sets the height (in pixels) of the bar.

Parameters:
barHeightThe 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 125 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:
continuousIf 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 114 of file kcapacitybar.cpp.

void KCapacityBar::setDrawTextMode ( DrawTextMode  mode)

Set the way text is drawn if any is set.

Parameters:
drawTextModeIf any text set, whether to draw it into the capacity bar or not.

Definition at line 156 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:
fillFullBlocksIf 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 103 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:
textAlignmentSets 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 138 of file kcapacitybar.cpp.

void KCapacityBar::setText ( const QString &  text)

Sets the text for the capacity bar.

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

Definition at line 88 of file kcapacitybar.cpp.

void KCapacityBar::setValue ( int  value)

Capacity bar fill value.

Parameters:
valueThis 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.
int KCapacityBar::value ( ) const
Returns:
The fill value of the capacity bar.

Property Documentation

int KCapacityBar::barHeight [read, write]

Definition at line 54 of file kcapacitybar.h.

bool KCapacityBar::continuous [read, write]

Definition at line 53 of file kcapacitybar.h.

KCapacityBar::DrawTextMode KCapacityBar::drawTextMode [read, write]

Definition at line 51 of file kcapacitybar.h.

bool KCapacityBar::fillFullBlocks [read, write]

Definition at line 52 of file kcapacitybar.h.

Qt::Alignment KCapacityBar::horizontalTextAlignment [read, write]

Definition at line 56 of file kcapacitybar.h.

QString KCapacityBar::text [read, write]

Definition at line 50 of file kcapacitybar.h.

int KCapacityBar::value [read, write]

Definition at line 49 of file kcapacitybar.h.


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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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