• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

libkdegames/highscore

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

#include <kexthighscore_item.h>

Inheritance diagram for KExtHighscore::Item:
Inheritance graph
[legend]

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(), Qt::AlignmentFlag alignment=Qt::AlignRight)
 
virtual ~Item ()
 
int alignment () const
 
QVariant defaultValue () const
 
bool isVisible () const
 
QString label () const
 
virtual QString pretty (uint i, const QVariant &value) const
 
virtual QVariant read (uint i, const QVariant &value) const
 
void setDefaultValue (const QVariant &value)
 
void setLabel (const QString &label)
 
void setPrettyFormat (Format format)
 
void setPrettySpecial (Special special)
 

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 39 of file kexthighscore_item.h.

Member Enumeration Documentation

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)
Enumerator
NoFormat 
OneDecimal 
Percentage 
MinuteTime 
DateTime 

Definition at line 54 of file kexthighscore_item.h.

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)
Enumerator
NoSpecial 
ZeroNotDefined 
NegativeNotDefined 
DefaultNotDefined 
Anonymous 

Definition at line 71 of file kexthighscore_item.h.

Constructor & Destructor Documentation

KExtHighscore::Item::Item ( const QVariant &  def = QVariant::Invalid,
const QString &  label = QString(),
Qt::AlignmentFlag  alignment = Qt::AlignRight 
)
explicit

Constructor.

Parameters
defdefault value ; the QVariant 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 40 of file kexthighscore_item.cpp.

KExtHighscore::Item::~Item ( )
virtual

Definition at line 45 of file kexthighscore_item.cpp.

Member Function Documentation

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

Definition at line 118 of file kexthighscore_item.h.

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

Definition at line 128 of file kexthighscore_item.h.

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

Definition at line 103 of file kexthighscore_item.h.

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

Definition at line 113 of file kexthighscore_item.h.

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
ithe element index ("rank" for score / "id" for player)
valuethe value to convert

Reimplemented in KExtHighscore::RankItem.

Definition at line 110 of file kexthighscore_item.cpp.

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
ithe element index ("rank" for score / "id" for player)
valuethe value to convert

Reimplemented in KExtHighscore::RankItem.

Definition at line 48 of file kexthighscore_item.cpp.

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

Set default value.

Definition at line 123 of file kexthighscore_item.h.

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

Set the label.

Definition at line 108 of file kexthighscore_item.h.

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

Set the display format.

See also
Format

Definition at line 53 of file kexthighscore_item.cpp.

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

Set the special value for display.

See also
Special

Definition at line 77 of file kexthighscore_item.cpp.


The documentation for this class was generated from the following files:
  • kexthighscore_item.h
  • kexthighscore_item.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:46 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdegames/highscore

Skip menu "libkdegames/highscore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal