KD Chart API Documentation 3.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
KDChart::Position Class Reference

Defines a position, using compass terminology. More...

#include <KDChartPosition.h>

Collaboration diagram for KDChart::Position:
Collaboration graph
[legend]

Public Types

enum  Option { IncludeCenter = 0x1 , IncludeFloating = 0x2 }
 

Public Member Functions

 Position ()
 
 Position (KDChartEnums::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
 
KDChartEnums::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))
 Returns a list of all string, corresponding to the pre-defined positions.
 
static QStringList printableNames (Options options=Options(IncludeCenter|IncludeFloating))
 Returns a list of all translated string, corresponding to the pre-defined positions.
 

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 KDChartPosition 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 KDChart::Position within KDChart
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 KDChartEnums, like this:

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

Definition at line 62 of file KDChartPosition.h.

Member Enumeration Documentation

◆ Option

Enumerator
IncludeCenter 
IncludeFloating 

Definition at line 102 of file KDChartPosition.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 KDChartPosition.cpp.

Referenced by fromName().

◆ Position() [2/2]

Position::Position ( KDChartEnums::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 KDChart::Position myPosition = KDChart::Position::NorthEast;
* 

Definition at line 101 of file KDChartPosition.cpp.

Member Function Documentation

◆ fromName() [1/2]

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

Definition at line 200 of file KDChartPosition.cpp.

References Position(), and name().

Referenced by fromName().

◆ fromName() [2/2]

Position Position::fromName ( const QByteArray name)
static

Definition at line 208 of file KDChartPosition.cpp.

References fromName(), and name().

◆ isCorner()

bool Position::isCorner ( ) const

Definition at line 136 of file KDChartPosition.cpp.

References NorthEast, NorthWest, SouthEast, SouthWest, and value().

◆ isEastSide()

bool Position::isEastSide ( ) const

Definition at line 127 of file KDChartPosition.cpp.

References East, NorthEast, SouthEast, and value().

◆ isFloating()

bool Position::isFloating ( ) const

Definition at line 145 of file KDChartPosition.cpp.

References Floating, and value().

Referenced by KDChart::Chart::reLayoutFloatingLegends().

◆ isNorthSide()

bool Position::isNorthSide ( ) const

Definition at line 123 of file KDChartPosition.cpp.

References North, NorthEast, NorthWest, and value().

◆ isPole()

bool Position::isPole ( ) const

Definition at line 140 of file KDChartPosition.cpp.

References North, South, and value().

◆ isSouthSide()

bool Position::isSouthSide ( ) const

Definition at line 131 of file KDChartPosition.cpp.

References South, SouthEast, SouthWest, and value().

◆ isUnknown()

bool Position::isUnknown ( ) const

Definition at line 114 of file KDChartPosition.cpp.

References Unknown, and value().

◆ isWestSide()

bool Position::isWestSide ( ) const

Definition at line 119 of file KDChartPosition.cpp.

References NorthWest, SouthWest, value(), and West.

◆ name()

const char * Position::name ( ) const

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

Definition at line 153 of file KDChartPosition.cpp.

Referenced by fromName(), fromName(), and operator<<().

◆ 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 173 of file KDChartPosition.cpp.

References QList::append(), IncludeCenter, and IncludeFloating.

◆ operator!=() [1/2]

bool KDChart::Position::operator!= ( const Position other) const
inline

Definition at line 128 of file KDChartPosition.h.

References operator==().

◆ operator!=() [2/2]

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

Definition at line 132 of file KDChartPosition.h.

References operator==().

◆ operator==() [1/2]

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

Definition at line 213 of file KDChartPosition.cpp.

References value().

Referenced by operator!=(), and operator!=().

◆ operator==() [2/2]

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

Definition at line 218 of file KDChartPosition.cpp.

References value().

◆ printableName()

QString Position::printableName ( ) const

Returns a translated string, corresponding to this Position.

Definition at line 161 of file KDChartPosition.cpp.

Referenced by printableNames().

◆ 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 190 of file KDChartPosition.cpp.

References QList::append(), IncludeCenter, IncludeFloating, and printableName().

◆ value()

KDChartEnums::PositionValue Position::value ( ) const

Member Data Documentation

◆ Center

const Position & Position::Center = staticPositionCenter
static

Definition at line 89 of file KDChartPosition.h.

Referenced by KDChart::PolarDiagram::paint(), and KDChart::RadarDiagram::paint().

◆ East

const Position & Position::East = staticPositionEast
static

Definition at line 93 of file KDChartPosition.h.

Referenced by isEastSide().

◆ Floating

const Position & Position::Floating = staticPositionFloating
static

Definition at line 99 of file KDChartPosition.h.

Referenced by isFloating(), and KDChart::Legend::setFloatingPosition().

◆ North

const Position & Position::North = staticPositionNorth
static

Definition at line 91 of file KDChartPosition.h.

Referenced by isNorthSide(), and isPole().

◆ NorthEast

const Position & Position::NorthEast = staticPositionNorthEast
static

Definition at line 92 of file KDChartPosition.h.

Referenced by isCorner(), isEastSide(), and isNorthSide().

◆ NorthWest

const Position & Position::NorthWest = staticPositionNorthWest
static

Definition at line 90 of file KDChartPosition.h.

Referenced by isCorner(), isNorthSide(), and isWestSide().

◆ South

const Position & Position::South = staticPositionSouth
static

Definition at line 95 of file KDChartPosition.h.

Referenced by isPole(), and isSouthSide().

◆ SouthEast

const Position & Position::SouthEast = staticPositionSouthEast
static

Definition at line 94 of file KDChartPosition.h.

Referenced by isCorner(), isEastSide(), and isSouthSide().

◆ SouthWest

const Position & Position::SouthWest = staticPositionSouthWest
static

Definition at line 96 of file KDChartPosition.h.

Referenced by isCorner(), isSouthSide(), and isWestSide().

◆ Unknown

const Position & Position::Unknown = staticPositionUnknown
static

◆ West

const Position & Position::West = staticPositionWest
static

Definition at line 97 of file KDChartPosition.h.

Referenced by isWestSide().


The documentation for this class was generated from the following files:

© 2001 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-chart/
Generated on Fri Apr 26 2024 00:04:57 for KD Chart API Documentation by doxygen 1.9.8