KChart::Position

#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.

position-alignments.png
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 72 of file KChartPosition.h.

Constructor & Destructor Documentation

Position::Position ( )

Default constructor.

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

Definition at line 90 of file KChartPosition.cpp.

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 114 of file KChartPosition.cpp.

Member Function Documentation

const char * Position::name ( ) const

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

Definition at line 179 of file KChartPosition.cpp.

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 200 of file KChartPosition.cpp.

QString Position::printableName ( ) const

Returns a translated string, corresponding to this Position.

Definition at line 187 of file KChartPosition.cpp.

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 217 of file KChartPosition.cpp.

KChartEnums::PositionValue Position::value ( ) const

Returns an integer value corresponding to this Position.

Definition at line 123 of file KChartPosition.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Aug 9 2020 22:38:08 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.