KGameProgress Class Reference

#include <kgameprogress.h>

Collaboration diagram for KGameProgress:

Collaboration graph
[legend]

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 setMinimum (int value)
 Set the minimum value of the progress bar to value.
void setMaximum (int value)
 Set the maximum value of the progress bar to value.
void advance (int prog)
 Advance the progress bar by prog.
void valueChange (int newValue)

Signals

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

Public Member Functions

 KGameProgress (QWidget *parent=0)
 Construct a horizontal progress bar.
 KGameProgress (Qt::Orientation orient, QWidget *parent=0)
 Construct a progress bar with orientation orient.
 ~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 (Qt::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.
QColor barColor () const
 Retrieve the bar color.
const QPixmap * barPixmap () const
 Retrieve the bar pixmap.
int value () const
 Retrive the current status.
int minimum () const
 Retrieve the minimum value.
int maximum () const
 Retrieve the maximum value.
Qt::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 styleChange (QStyle &)
void paletteChange (const QPalette &)
void paintEvent (QPaintEvent *e)

Properties

int value
int mininum
int maximum
BarStyle barStyle
QColor barColor
QPixmap barPixmap
Qt::Orientation orientation
bool textEnabled

Classes

class  KGameProgressPrivate
 KGameProgress -- a progress indicator widget for KDE. More...


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

Definition at line 49 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 69 of file kgameprogress.h.


Constructor & Destructor Documentation

KGameProgress::KGameProgress ( QWidget *  parent = 0  )  [explicit]

Construct a horizontal progress bar.

Definition at line 63 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::initialize(), and KGameProgress::KGameProgressPrivate::slider.

Here is the call graph for this function:

KGameProgress::KGameProgress ( Qt::Orientation  orient,
QWidget *  parent = 0 
) [explicit]

Construct a progress bar with orientation orient.

Definition at line 70 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::initialize(), and KGameProgress::KGameProgressPrivate::slider.

Here is the call graph for this function:

KGameProgress::~KGameProgress (  ) 

Destruct the progress bar.

Definition at line 77 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::bar_pixmap.


Member Function Documentation

void KGameProgress::setBarStyle ( BarStyle  style  ) 

Set the progress bar style.

Allowed values are Solid and Blocked.

Definition at line 139 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::bar_style.

void KGameProgress::setBarColor ( const QColor &  color  ) 

Set the color of the progress bar.

Definition at line 129 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::bar_color, KGameProgress::KGameProgressPrivate::bar_pixmap, and KGameProgress::KGameProgressPrivate::use_supplied_bar_color.

void KGameProgress::setBarPixmap ( const QPixmap &  pixmap  ) 

Set a pixmap to be shown in the progress bar.

Definition at line 119 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::bar_pixmap.

void KGameProgress::setOrientation ( Qt::Orientation  orientation  ) 

Set the orientation of the progress bar.

Allowed values are Horizontal and Vertical.

Definition at line 147 of file kgameprogress.cpp.

void KGameProgress::setTextEnabled ( bool  enable  ) 

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

Definition at line 170 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::text_enabled.

BarStyle KGameProgress::barStyle (  )  const

Retrieve the bar style.

See also:
setBarStyle()

QColor KGameProgress::barColor (  )  const

Retrieve the bar color.

See also:
setBarColor()

const QPixmap* KGameProgress::barPixmap (  )  const

Retrieve the bar pixmap.

See also:
setBarPixmap()

int KGameProgress::value (  )  const

Retrive the current status.

See also:
setValue()

Referenced by advance().

int KGameProgress::minimum (  )  const

Retrieve the minimum value.

See also:
setMinimum()

Definition at line 190 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::slider.

Referenced by KGameProgress::KGameProgressPrivate::recalcValue().

int KGameProgress::maximum (  )  const

Retrieve the maximum value.

See also:
setMaximum()

Qt::Orientation KGameProgress::orientation (  )  const

Retrive the orientation of the progress bar.

See also:
setOrientation()

Referenced by paintEvent(), sizeHint(), and sizePolicy().

bool KGameProgress::textEnabled (  )  const

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

See also:
setFormat()

QSize KGameProgress::sizeHint (  )  const [virtual]

Definition at line 205 of file kgameprogress.cpp.

References orientation().

Referenced by minimumSizeHint().

Here is the call graph for this function:

QSize KGameProgress::minimumSizeHint (  )  const [virtual]

Definition at line 218 of file kgameprogress.cpp.

References sizeHint().

Here is the call graph for this function:

QSizePolicy KGameProgress::sizePolicy (  )  const [virtual]

Definition at line 223 of file kgameprogress.cpp.

References orientation().

Here is the call graph for this function:

QString KGameProgress::format (  )  const

Retrieve the current format for printing status text.

See also:
setFormat()

Definition at line 395 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::format_.

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 390 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::format_.

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 155 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::slider.

Referenced by advance().

void KGameProgress::setMinimum ( int  value  )  [slot]

Set the minimum value of the progress bar to value.

The maximum value may be changed to keep the range valid.

Definition at line 160 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::slider.

void KGameProgress::setMaximum ( int  value  )  [slot]

Set the maximum value of the progress bar to value.

The minimum value may be changed to keep the range valid.

Definition at line 165 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::slider.

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 83 of file kgameprogress.cpp.

References setValue(), and value().

void KGameProgress::valueChange ( int  newValue  )  [slot]

Definition at line 248 of file kgameprogress.cpp.

References percentageChanged(), and KGameProgress::KGameProgressPrivate::recalcValue().

Referenced by KGameProgress::KGameProgressPrivate::initialize().

void KGameProgress::percentageChanged ( int   )  [signal]

Emitted when the state of the progress bar changes.

Referenced by valueChange().

void KGameProgress::styleChange ( QStyle &   )  [protected]

Definition at line 256 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::adjustStyle().

Here is the call graph for this function:

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

Definition at line 277 of file kgameprogress.cpp.

References paletteChange().

Referenced by KGameProgress::KGameProgressPrivate::initialize(), and paletteChange().

Here is the call graph for this function:

void KGameProgress::paintEvent ( QPaintEvent *  e  )  [protected]

Definition at line 308 of file kgameprogress.cpp.

References KGameProgress::KGameProgressPrivate::bar_color, KGameProgress::KGameProgressPrivate::bar_pixmap, KGameProgress::KGameProgressPrivate::bar_style, Blocked, KGameProgress::KGameProgressPrivate::drawText(), KGameProgress::KGameProgressPrivate::fr, orientation(), KGameProgress::KGameProgressPrivate::recalcValue(), Solid, and KGameProgress::KGameProgressPrivate::text_enabled.

Here is the call graph for this function:


Property Documentation

int KGameProgress::value [read, write]

Definition at line 53 of file kgameprogress.h.

Referenced by KGameProgress::KGameProgressPrivate::drawText(), and KGameProgress::KGameProgressPrivate::recalcValue().

int KGameProgress::mininum [read, write]

Definition at line 54 of file kgameprogress.h.

int KGameProgress::maximum [read, write]

Definition at line 55 of file kgameprogress.h.

Referenced by KGameProgress::KGameProgressPrivate::drawText(), and KGameProgress::KGameProgressPrivate::recalcValue().

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

Definition at line 56 of file kgameprogress.h.

QColor KGameProgress::barColor [read, write]

Definition at line 57 of file kgameprogress.h.

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

Definition at line 58 of file kgameprogress.h.

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

Definition at line 59 of file kgameprogress.h.

bool KGameProgress::textEnabled [read, write]

Definition at line 60 of file kgameprogress.h.


The documentation for this class was generated from the following files:
Generated on Sun Mar 16 08:03:20 2008 for Libkdegames by  doxygen 1.5.3