KDEUI
#include <kcapacitybar.h>
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
Definition at line 44 of file kcapacitybar.h.
Member Enumeration Documentation
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
|
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.
|
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.
|
virtual |
Definition at line 353 of file kcapacitybar.cpp.
|
protectedvirtual |
Definition at line 370 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 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
-
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 117 of file kcapacitybar.cpp.
void KCapacityBar::setDrawTextMode | ( | DrawTextMode | mode | ) |
Set the way text is drawn if any is set.
- Parameters
-
drawTextMode If 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
-
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 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
-
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 141 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 88 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.
int KCapacityBar::value | ( | ) | const |
- Returns
- The fill value of the capacity bar.
Property Documentation
|
readwrite |
Definition at line 54 of file kcapacitybar.h.
|
readwrite |
Definition at line 53 of file kcapacitybar.h.
|
readwrite |
Definition at line 51 of file kcapacitybar.h.
|
readwrite |
Definition at line 52 of file kcapacitybar.h.
|
readwrite |
Definition at line 56 of file kcapacitybar.h.
|
readwrite |
Definition at line 50 of file kcapacitybar.h.
|
readwrite |
Definition at line 49 of file kcapacitybar.h.
The documentation for this class was generated from the following files:
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.