KGameProgress Class Reference

A progress indicator widget. More...

#include <kgameprogress.h>

List of all members.

Public Types

enum  BarStyle { Solid, Blocked }
 Possible values for bar style. More...

Public Slots

void setFormat (const QString &format)
 Set the format of the text to use to display status.
void setValue (int value)
 Set the current value of the progress bar to value.
void advance (int prog)
 Advance the progress bar by prog.

Signals

void percentageChanged (int)
 Emitted when the state of the progress bar changes.

Public Member Functions

 KGameProgress (QWidget *parent=0, const char *name=0)
 Construct a horizontal progress bar.
 KGameProgress (Orientation orient, QWidget *parent=0, const char *name=0)
 Construct a progress bar with orientation orient.
 KGameProgress (int minValue, int maxValue, int value, Orientation, QWidget *parent=0, const char *name=0)
 Construct a progress bar with minimum, maximum and initial values.
 ~KGameProgress ()
 Destruct the progress bar.
void setBarStyle (BarStyle style)
 Set the progress bar style.
void setBarColor (const QColor &)
 Set the color of the progress bar.
void setBarPixmap (const QPixmap &)
 Set a pixmap to be shown in the progress bar.
void setOrientation (Orientation)
 Set the orientation of the progress bar.
void setTextEnabled (bool)
 If this is set to true, the progress text will be displayed.
BarStyle barStyle () const
 Retrieve the bar style.
const QColor & barColor () const
 Retrieve the bar color.
const QPixmap * barPixmap () const
 Retrieve the bar pixmap.
int value () const
 Retrive the current status.
Orientation orientation () const
 Retrive the orientation of the progress bar.
bool textEnabled () const
 Returns true if progress text will be displayed, false otherwise.
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const
virtual QSizePolicy sizePolicy () const
QString format () const
 Retrieve the current format for printing status text.

Protected Member Functions

void valueChange ()
void rangeChange ()
void styleChange (QStyle &)
void paletteChange (const QPalette &)
void drawContents (QPainter *)

Properties

int value
BarStyle barStyle
QColor barColor
QPixmap barPixmap
Orientation orientation
bool textEnabled


Detailed Description

A progress indicator widget.

KGameProgress is derived from QFrame and QRangeControl, so you can use all the methods from those classes. The only difference is that setValue() is now made a slot, so you can connect stuff to it.

None of the constructors take line step and page step as arguments, so by default they're set to 1 and 10 respectively.

The Blocked style ignores the textEnabled() setting and displays no text, since it looks truly ugly (and for other reasons). Signal percentageChanged() is emitted whenever the value changes so you can set up a different widget to display the current percentage complete and connect the signal to it.

Author:
Martynas Kunigelis
Version:
Id
kgameprogress.h 465369 2005-09-29 14:33:08Z mueller

Definition at line 50 of file kgameprogress.h.


Member Enumeration Documentation

enum KGameProgress::BarStyle
 

Possible values for bar style.

Solid means one continuous progress bar, Blocked means a progress bar made up of several blocks.

Enumerator:
Solid 
Blocked 

Definition at line 68 of file kgameprogress.h.


Constructor & Destructor Documentation

KGameProgress::KGameProgress QWidget *  parent = 0,
const char *  name = 0
 

Construct a horizontal progress bar.

Definition at line 32 of file kgameprogress.cpp.

KGameProgress::KGameProgress Orientation  orient,
QWidget *  parent = 0,
const char *  name = 0
 

Construct a progress bar with orientation orient.

Definition at line 40 of file kgameprogress.cpp.

KGameProgress::KGameProgress int  minValue,
int  maxValue,
int  value,
Orientation  ,
QWidget *  parent = 0,
const char *  name = 0
 

Construct a progress bar with minimum, maximum and initial values.

Definition at line 48 of file kgameprogress.cpp.

KGameProgress::~KGameProgress  ) 
 

Destruct the progress bar.

Definition at line 57 of file kgameprogress.cpp.


Member Function Documentation

void KGameProgress::advance int  prog  )  [slot]
 

Advance the progress bar by prog.

This method is provided for convenience and is equivalent with setValue(value()+prog).

Definition at line 62 of file kgameprogress.cpp.

References setValue(), and value().

const QColor& KGameProgress::barColor  )  const
 

Retrieve the bar color.

See also:
setBarColor()

const QPixmap* KGameProgress::barPixmap  )  const
 

Retrieve the bar pixmap.

See also:
setBarPixmap()

BarStyle KGameProgress::barStyle  )  const
 

Retrieve the bar style.

See also:
setBarStyle()

void KGameProgress::drawContents QPainter *   )  [protected]
 

Definition at line 260 of file kgameprogress.cpp.

References Blocked, and Solid.

QString KGameProgress::format  )  const
 

Retrieve the current format for printing status text.

See also:
setFormat()

Definition at line 340 of file kgameprogress.cpp.

QSize KGameProgress::minimumSizeHint  )  const [virtual]
 

Definition at line 167 of file kgameprogress.cpp.

References sizeHint().

Here is the call graph for this function:

Orientation KGameProgress::orientation  )  const
 

Retrive the orientation of the progress bar.

See also:
setOrientation()

Referenced by sizeHint(), and sizePolicy().

void KGameProgress::paletteChange const QPalette &   )  [protected]
 

Definition at line 229 of file kgameprogress.cpp.

References paletteChange().

Referenced by paletteChange().

Here is the call graph for this function:

void KGameProgress::percentageChanged int   )  [signal]
 

Emitted when the state of the progress bar changes.

Referenced by rangeChange(), and valueChange().

void KGameProgress::rangeChange  )  [protected]
 

Definition at line 203 of file kgameprogress.cpp.

References percentageChanged().

void KGameProgress::setBarColor const QColor &   ) 
 

Set the color of the progress bar.

Definition at line 103 of file kgameprogress.cpp.

void KGameProgress::setBarPixmap const QPixmap &   ) 
 

Set a pixmap to be shown in the progress bar.

Definition at line 93 of file kgameprogress.cpp.

void KGameProgress::setBarStyle BarStyle  style  ) 
 

Set the progress bar style.

Allowed values are Solid and Blocked.

Definition at line 113 of file kgameprogress.cpp.

void KGameProgress::setFormat const QString &  format  )  [slot]
 

Set the format of the text to use to display status.

The default format is "%p%" (which looks like "42%".)

Parameters:
format p is replaced by percentage done, v is replaced by actual value, m is replaced by the maximum value.

Definition at line 335 of file kgameprogress.cpp.

void KGameProgress::setOrientation Orientation   ) 
 

Set the orientation of the progress bar.

Allowed values are Horizontal and Vertical.

Definition at line 121 of file kgameprogress.cpp.

void KGameProgress::setTextEnabled bool   ) 
 

If this is set to true, the progress text will be displayed.

Definition at line 134 of file kgameprogress.cpp.

void KGameProgress::setValue int  value  )  [slot]
 

Set the current value of the progress bar to value.

This must be a number in the range 0..100.

Definition at line 129 of file kgameprogress.cpp.

Referenced by advance().

QSize KGameProgress::sizeHint  )  const [virtual]
 

Definition at line 154 of file kgameprogress.cpp.

References orientation().

Referenced by minimumSizeHint().

Here is the call graph for this function:

QSizePolicy KGameProgress::sizePolicy  )  const [virtual]
 

Definition at line 172 of file kgameprogress.cpp.

References orientation().

Here is the call graph for this function:

void KGameProgress::styleChange QStyle &   )  [protected]
 

Definition at line 209 of file kgameprogress.cpp.

bool KGameProgress::textEnabled  )  const
 

Returns true if progress text will be displayed, false otherwise.

See also:
setFormat()

int KGameProgress::value  )  const [inline]
 

Retrive the current status.

See also:
setValue()

Definition at line 146 of file kgameprogress.h.

Referenced by advance().

void KGameProgress::valueChange  )  [protected]
 

Definition at line 197 of file kgameprogress.cpp.

References percentageChanged().


Property Documentation

const QColor & KGameProgress::barColor [read, write]
 

Definition at line 56 of file kgameprogress.h.

const QPixmap * KGameProgress::barPixmap [read, write]
 

Definition at line 57 of file kgameprogress.h.

KGameProgress::BarStyle KGameProgress::barStyle [read, write]
 

Definition at line 55 of file kgameprogress.h.

KGameProgress::Orientation KGameProgress::orientation [read, write]
 

Definition at line 58 of file kgameprogress.h.

bool KGameProgress::textEnabled [read, write]
 

Definition at line 59 of file kgameprogress.h.

int KGameProgress::value [read, write]
 

Definition at line 54 of file kgameprogress.h.


The documentation for this class was generated from the following files:
Generated on Wed Aug 23 18:05:39 2006 for libkdegames by  doxygen 1.4.6