• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdegames
 

libtdegames

  • KExtHighscore
  • Item
Public Types | Public Member Functions | List of all members
KExtHighscore::Item Class Reference

#include <kexthighscore_item.h>

Inherited by KExtHighscore::DateItem, KExtHighscore::NameItem, KExtHighscore::RankItem, and KExtHighscore::SuccessPercentageItem.

Public Types

enum  Format {
  NoFormat , OneDecimal , Percentage , MinuteTime ,
  DateTime
}
 
enum  Special {
  NoSpecial , ZeroNotDefined , NegativeNotDefined , DefaultNotDefined ,
  Anonymous
}
 

Public Member Functions

 Item (const TQVariant &def=TQVariant::Invalid, const TQString &label=TQString(), int alignment=TQt::AlignRight)
 
void setPrettyFormat (Format format)
 
void setPrettySpecial (Special special)
 
bool isVisible () const
 
void setLabel (const TQString &label)
 
TQString label () const
 
int alignment () const
 
void setDefaultValue (const TQVariant &value)
 
const TQVariant & defaultValue () const
 
virtual TQVariant read (uint i, const TQVariant &value) const
 
virtual TQString pretty (uint i, const TQVariant &value) const
 

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.

Member Enumeration Documentation

◆ Format

enum KExtHighscore::Item::Format

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.

◆ Special

enum KExtHighscore::Item::Special

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

◆ Item()

KExtHighscore::Item::Item ( const TQVariant &  def = TQVariant::Invalid,
const TQString &  label = TQString(),
int  alignment = TQt::AlignRight 
)

Constructor.

Parameters
defdefault value ; the TQVariant also gives the type of data. Be sure to cast the value to the required type (for e.g. with uint).
labelthe label corresponding to the item. If empty, the item is not shown.
alignmentthe alignment of the item.

Definition at line 36 of file kexthighscore_item.cpp.

Member Function Documentation

◆ alignment()

int KExtHighscore::Item::alignment ( ) const
inline
Returns
the alignment.

Definition at line 119 of file kexthighscore_item.h.

◆ defaultValue()

const TQVariant& KExtHighscore::Item::defaultValue ( ) const
inline
Returns
the default value.

Definition at line 129 of file kexthighscore_item.h.

◆ isVisible()

bool KExtHighscore::Item::isVisible ( ) const
inline
Returns
if the item is shown.

Definition at line 104 of file kexthighscore_item.h.

◆ label()

TQString KExtHighscore::Item::label ( ) const
inline
Returns
the label.

Definition at line 114 of file kexthighscore_item.h.

◆ pretty()

TQString KExtHighscore::Item::pretty ( uint  i,
const TQVariant &  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
ithe element index ("rank" for score / "id" for player)
valuethe value to convert

Definition at line 106 of file kexthighscore_item.cpp.

◆ read()

TQVariant KExtHighscore::Item::read ( uint  i,
const TQVariant &  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
ithe element index ("rank" for score / "id" for player)
valuethe value to convert

Definition at line 44 of file kexthighscore_item.cpp.

◆ setDefaultValue()

void KExtHighscore::Item::setDefaultValue ( const TQVariant &  value)
inline

Set default value.

Definition at line 124 of file kexthighscore_item.h.

◆ setLabel()

void KExtHighscore::Item::setLabel ( const TQString &  label)
inline

Set the label.

Definition at line 109 of file kexthighscore_item.h.

◆ setPrettyFormat()

void KExtHighscore::Item::setPrettyFormat ( Format  format)

Set the display format.

See also
Format

Definition at line 49 of file kexthighscore_item.cpp.

◆ setPrettySpecial()

void KExtHighscore::Item::setPrettySpecial ( Special  special)

Set the special value for display.

See also
Special

Definition at line 73 of file kexthighscore_item.cpp.


The documentation for this class was generated from the following files:
  • kexthighscore_item.h
  • kexthighscore_item.cpp

libtdegames

Skip menu "libtdegames"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdegames

Skip menu "libtdegames"
  • libtdegames
Generated for libtdegames by doxygen 1.9.1
This website is maintained by Timothy Pearson.