KExtHighscore::Item Class Reference
#include <kexthighscore_item.h>
Inheritance diagram for KExtHighscore::Item:

Detailed Description
This class defines how to convert and how to display a highscore element (such as the score, the date, ...) or a player info (such as the player name, the best score, ...).
Definition at line 40 of file kexthighscore_item.h.
Public Types | |
enum | Format { NoFormat, OneDecimal, Percentage, MinuteTime, DateTime } |
enum | Special { NoSpecial, ZeroNotDefined, NegativeNotDefined, DefaultNotDefined, Anonymous } |
Public Member Functions | |
Item (const QVariant &def=QVariant::Invalid, const QString &label=QString::null, int alignment=Qt::AlignRight) | |
virtual | ~Item () |
void | setPrettyFormat (Format format) |
void | setPrettySpecial (Special special) |
bool | isVisible () const |
void | setLabel (const QString &label) |
QString | label () const |
int | alignment () const |
void | setDefaultValue (const QVariant &value) |
const QVariant & | defaultValue () const |
virtual QVariant | read (uint i, const QVariant &value) const |
virtual QString | pretty (uint i, const QVariant &value) const |
Member Enumeration Documentation
Possible display format.
-
NoFormat
: no formatting (default) -
OneDecimal
: with one decimal (only for Double) -
Percentage
: with one decimal + % (only for Double) -
MinuteTime
: MM:SS ie 3600 is 00:00, 1 is 59:59 and 0 is undefined (only for UInt, Int and Double) -
DateTime
: date and time according to locale (only for DateTime)
Definition at line 55 of file kexthighscore_item.h.
Possible special value for display format.
-
NoSpecial
: no special value ; a null DateTime is replaced by "--" (default) - ZeroNotDefined : 0 is replaced by "--" (only for UInt, Int and Double)
-
NegativeNotDefined
: negative values are replaced by "--" (only for Int and Double) -
DefaultNotDefined
: default value is replaced by "--" -
Anonymous
: replace the special value ItemBase::ANONYMOUS by i18n("anonymous") (only for String)
Definition at line 72 of file kexthighscore_item.h.
Constructor & Destructor Documentation
KExtHighscore::Item::Item | ( | const QVariant & | def = QVariant::Invalid , |
|
const QString & | label = QString::null , |
|||
int | alignment = Qt::AlignRight | |||
) |
Constructor.
- Parameters:
-
def default value ; the QVariant also gives the type of data. Be sure to cast the value to the required type (for e.g. with uint). label the label corresponding to the item. If empty, the item is not shown. alignment the alignment of the item.
Definition at line 36 of file kexthighscore_item.cpp.
Member Function Documentation
void KExtHighscore::Item::setPrettyFormat | ( | Format | format | ) |
void KExtHighscore::Item::setPrettySpecial | ( | Special | special | ) |
Set the special value for display.
- See also:
- Special
Definition at line 73 of file kexthighscore_item.cpp.
bool KExtHighscore::Item::isVisible | ( | ) | const [inline] |
void KExtHighscore::Item::setLabel | ( | const QString & | label | ) | [inline] |
QString KExtHighscore::Item::label | ( | ) | const [inline] |
int KExtHighscore::Item::alignment | ( | ) | const [inline] |
void KExtHighscore::Item::setDefaultValue | ( | const QVariant & | value | ) | [inline] |
const QVariant& KExtHighscore::Item::defaultValue | ( | ) | const [inline] |
QVariant KExtHighscore::Item::read | ( | uint | i, | |
const QVariant & | value | |||
) | const [virtual] |
- Returns:
- the converted value (by default the value is left unchanged).
Most of the time you don't need to reimplement this method.
- Parameters:
-
i the element index ("rank" for score / "id" for player) value the value to convert
Reimplemented in KExtHighscore::RankItem.
Definition at line 44 of file kexthighscore_item.cpp.
QString KExtHighscore::Item::pretty | ( | uint | i, | |
const QVariant & | value | |||
) | const [virtual] |
- Returns:
- the string to be displayed.
You may need to reimplement this method for special formatting (different from the standard ones).
- Parameters:
-
i the element index ("rank" for score / "id" for player) value the value to convert
Reimplemented in KExtHighscore::RankItem.
Definition at line 106 of file kexthighscore_item.cpp.
The documentation for this class was generated from the following files: