KChart::Position

Search for usage in LXR

#include <KChartPosition.h>

Public Types

enum  Option { IncludeCenter = 0x1 , IncludeFloating = 0x2 }
 
typedef QFlags< Option > Options
 

Public Member Functions

 Position ()
 
 Position (KChartEnums::PositionValue value)
 
bool isCorner () const
 
bool isEastSide () const
 
bool isFloating () const
 
bool isNorthSide () const
 
bool isPole () const
 
bool isSouthSide () const
 
bool isUnknown () const
 
bool isWestSide () const
 
const char * name () const
 
bool operator!= (const Position &) const
 
bool operator!= (int) const
 
bool operator== (const Position &) const
 
bool operator== (int) const
 
QString printableName () const
 
KChartEnums::PositionValue value () const
 

Static Public Member Functions

static Position fromName (const char *name)
 
static Position fromName (const QByteArray &name)
 
static QList< QByteArraynames (Options options=Options(IncludeCenter|IncludeFloating))
 
static QStringList printableNames (Options options=Options(IncludeCenter|IncludeFloating))
 

Static Public Attributes

static const PositionCenter = staticPositionCenter
 
static const PositionEast = staticPositionEast
 
static const PositionFloating = staticPositionFloating
 
static const PositionNorth = staticPositionNorth
 
static const PositionNorthEast = staticPositionNorthEast
 
static const PositionNorthWest = staticPositionNorthWest
 
static const PositionSouth = staticPositionSouth
 
static const PositionSouthEast = staticPositionSouthEast
 
static const PositionSouthWest = staticPositionSouthWest
 
static const PositionUnknown = staticPositionUnknown
 
static const PositionWest = staticPositionWest
 

Detailed Description

Defines a position, using compass terminology.

Using KChart::Position you can specify one of nine pre-defined, logical points (see the static const getter methods below), in a similar way, as you would use a compass to navigate on a map.

For each piece (slice/bar, etc.) of a chart for example, you can specify the position of the value labels. Figure 1 illustrates which cardinal points refer to which points on a pie or bar chart, resp. In the graphic, "N" stands for North, "S" for South, etc.

Figure 1: Different interpretations of KChart::Position within KChart
Note
Often you will declare a Position together with the RelativePosition class, to specify a logical point, which then will be used to layout your chart at runtime, e.g. for specifying the location of a floating Legend box.

For comparing a Position's value with a switch () statement, you can use numeric values defined in KChartEnums, like this:

switch ( yourPosition().value() ) {
    case KChartEnums::PositionNorthWest:
        // your code ...
        break;
    case KChartEnums::PositionNorth:
        // your code ...
        break;
}
See also
RelativePosition, KChartEnums::PositionValue

Definition at line 61 of file KChartPosition.h.

Member Typedef Documentation

◆ Options

Definition at line 103 of file KChartPosition.h.

Member Enumeration Documentation

◆ Option

enum KChart::Position::Option

Definition at line 100 of file KChartPosition.h.

Constructor & Destructor Documentation

◆ Position() [1/2]

Position::Position ( )

Default constructor.

Creates a new Position, defaulting it to Position::Unknown.

Definition at line 78 of file KChartPosition.cpp.

◆ Position() [2/2]

Position::Position ( KChartEnums::PositionValue value)

Constructor.

Creates a new Position, defaulting it to the respective value.

Valid values ranging from zero (unknown value) to 10. If invalid value is passed, a Position::Unknown is created.

Note
Normally there is no need to call this constructor, but you would rather use one of the nine pre-defined, static values, e.g. like this:
* const KChart::Position myPosition = KChart::Position::NorthEast;
* 

Definition at line 102 of file KChartPosition.cpp.

Member Function Documentation

◆ fromName() [1/2]

Position Position::fromName ( const char * name)
static

Definition at line 215 of file KChartPosition.cpp.

◆ fromName() [2/2]

Position Position::fromName ( const QByteArray & name)
static

Definition at line 223 of file KChartPosition.cpp.

◆ isCorner()

bool Position::isCorner ( ) const

Definition at line 146 of file KChartPosition.cpp.

◆ isEastSide()

bool Position::isEastSide ( ) const

Definition at line 133 of file KChartPosition.cpp.

◆ isFloating()

bool Position::isFloating ( ) const

Definition at line 159 of file KChartPosition.cpp.

◆ isNorthSide()

bool Position::isNorthSide ( ) const

Definition at line 127 of file KChartPosition.cpp.

◆ isPole()

bool Position::isPole ( ) const

Definition at line 153 of file KChartPosition.cpp.

◆ isSouthSide()

bool Position::isSouthSide ( ) const

Definition at line 139 of file KChartPosition.cpp.

◆ isUnknown()

bool Position::isUnknown ( ) const

Definition at line 116 of file KChartPosition.cpp.

◆ isWestSide()

bool Position::isWestSide ( ) const

Definition at line 121 of file KChartPosition.cpp.

◆ name()

const char * Position::name ( ) const

Returns a non-translated string in English language, corresponding to this Position.

Definition at line 167 of file KChartPosition.cpp.

◆ names()

QList< QByteArray > Position::names ( Options options = Options(IncludeCenter | IncludeFloating))
static

Returns a list of all string, corresponding to the pre-defined positions.

Parameters
optionsif set to ExcludeCenter, the returned list does not contain the Center position.

Definition at line 188 of file KChartPosition.cpp.

◆ operator!=() [1/2]

bool KChart::Position::operator!= ( const Position & other) const
inline

Definition at line 124 of file KChartPosition.h.

◆ operator!=() [2/2]

bool KChart::Position::operator!= ( int other) const
inline

Definition at line 125 of file KChartPosition.h.

◆ operator==() [1/2]

bool Position::operator== ( const Position & r) const

Definition at line 227 of file KChartPosition.cpp.

◆ operator==() [2/2]

bool Position::operator== ( int value_) const

Definition at line 233 of file KChartPosition.cpp.

◆ printableName()

QString Position::printableName ( ) const

Returns a translated string, corresponding to this Position.

Definition at line 175 of file KChartPosition.cpp.

◆ printableNames()

QStringList Position::printableNames ( Options options = Options(IncludeCenter | IncludeFloating))
static

Returns a list of all translated string, corresponding to the pre-defined positions.

Parameters
optionsif set to ExcludeCenter, the returned list does not contain the Center position.

Definition at line 205 of file KChartPosition.cpp.

◆ value()

KChartEnums::PositionValue Position::value ( ) const

Returns an integer value corresponding to this Position.

Definition at line 111 of file KChartPosition.cpp.

Member Data Documentation

◆ Center

const Position & Position::Center = staticPositionCenter
static

Definition at line 87 of file KChartPosition.h.

◆ East

const Position & Position::East = staticPositionEast
static

Definition at line 91 of file KChartPosition.h.

◆ Floating

const Position & Position::Floating = staticPositionFloating
static

Definition at line 97 of file KChartPosition.h.

◆ North

const Position & Position::North = staticPositionNorth
static

Definition at line 89 of file KChartPosition.h.

◆ NorthEast

const Position & Position::NorthEast = staticPositionNorthEast
static

Definition at line 90 of file KChartPosition.h.

◆ NorthWest

const Position & Position::NorthWest = staticPositionNorthWest
static

Definition at line 88 of file KChartPosition.h.

◆ South

const Position & Position::South = staticPositionSouth
static

Definition at line 93 of file KChartPosition.h.

◆ SouthEast

const Position & Position::SouthEast = staticPositionSouthEast
static

Definition at line 92 of file KChartPosition.h.

◆ SouthWest

const Position & Position::SouthWest = staticPositionSouthWest
static

Definition at line 94 of file KChartPosition.h.

◆ Unknown

const Position & Position::Unknown = staticPositionUnknown
static

Definition at line 86 of file KChartPosition.h.

◆ West

const Position & Position::West = staticPositionWest
static

Definition at line 95 of file KChartPosition.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.