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

KDEUI

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

#include <kcapacitybar.h>

Inheritance diagram for KCapacityBar:
Inheritance graph
[legend]

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 eresl.nosp@m.ibre.nosp@m.@kde..nosp@m.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)
protectedvirtual

Definition at line 344 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 170 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 353 of file kcapacitybar.cpp.

void KCapacityBar::paintEvent ( QPaintEvent *  event)
protectedvirtual

Definition at line 370 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 128 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 117 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 159 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 106 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 141 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
readwrite

Definition at line 54 of file kcapacitybar.h.

bool KCapacityBar::continuous
readwrite

Definition at line 53 of file kcapacitybar.h.

KCapacityBar::DrawTextMode KCapacityBar::drawTextMode
readwrite

Definition at line 51 of file kcapacitybar.h.

bool KCapacityBar::fillFullBlocks
readwrite

Definition at line 52 of file kcapacitybar.h.

Qt::Alignment KCapacityBar::horizontalTextAlignment
readwrite

Definition at line 56 of file kcapacitybar.h.

QString KCapacityBar::text
readwrite

Definition at line 50 of file kcapacitybar.h.

int KCapacityBar::value
readwrite

Definition at line 49 of file kcapacitybar.h.


The documentation for this class was generated from the following files:
  • kcapacitybar.h
  • kcapacitybar.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