KDChart::Position Class Reference

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

#include <KDChartPosition.h>

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

List of all members.

Public Types

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

Public Member Functions

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
 Returns a non-translated string in English language, corresponding to this Position.
bool operator!= (int) const
bool operator!= (const Position &) const
bool operator== (int) const
bool operator== (const Position &) const
 Position (KDChartEnums::PositionValue value)
 Constructor.
 Position ()
 Default constructor.
QString printableName () const
 Returns a translated string, corresponding to this Position.
KDChartEnums::PositionValue value () const
 Returns an integer value corresponding to this Position.

Static Public Member Functions

static Position fromName (const QByteArray &name)
static Position fromName (const char *name)
static QList< QByteArray > names (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.

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 67 of file KDChartPosition.h.


Member Enumeration Documentation

Enumerator:
IncludeCenter 
IncludeFloating 

Definition at line 106 of file KDChartPosition.h.


Constructor & Destructor Documentation

Position::Position (  ) 

Default constructor.

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

Definition at line 93 of file KDChartPosition.cpp.

Referenced by fromName().

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


Member Function Documentation

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

Definition at line 238 of file KDChartPosition.cpp.

References fromName().

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

Definition at line 230 of file KDChartPosition.cpp.

References Position().

Referenced by fromName().

bool Position::isCorner (  )  const

Definition at line 161 of file KDChartPosition.cpp.

References value().

bool Position::isEastSide (  )  const

Definition at line 148 of file KDChartPosition.cpp.

References value().

bool Position::isFloating (  )  const

Definition at line 174 of file KDChartPosition.cpp.

References value().

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

bool Position::isNorthSide (  )  const

Definition at line 142 of file KDChartPosition.cpp.

References value().

bool Position::isPole (  )  const

Definition at line 168 of file KDChartPosition.cpp.

References value().

bool Position::isSouthSide (  )  const

Definition at line 154 of file KDChartPosition.cpp.

References value().

bool Position::isUnknown (  )  const

Definition at line 131 of file KDChartPosition.cpp.

References value().

bool Position::isWestSide (  )  const

Definition at line 136 of file KDChartPosition.cpp.

References value().

const char * Position::name (  )  const

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

Definition at line 182 of file KDChartPosition.cpp.

Referenced by operator<<().

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

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

Parameters:
options if set to ExcludeCenter, the returned list does not contain the Center position.

Definition at line 203 of file KDChartPosition.cpp.

References IncludeCenter, and IncludeFloating.

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

Definition at line 131 of file KDChartPosition.h.

References operator==().

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

Definition at line 130 of file KDChartPosition.h.

References KDGantt::operator==().

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

Definition at line 248 of file KDChartPosition.cpp.

References value().

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

Definition at line 242 of file KDChartPosition.cpp.

References value().

Referenced by operator!=().

QString Position::printableName (  )  const

Returns a translated string, corresponding to this Position.

Definition at line 190 of file KDChartPosition.cpp.

Referenced by printableNames().

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

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

Parameters:
options if set to ExcludeCenter, the returned list does not contain the Center position.

Definition at line 220 of file KDChartPosition.cpp.

References IncludeCenter, IncludeFloating, and printableName().

KDChartEnums::PositionValue Position::value (  )  const

Member Data Documentation

const Position & Position::Center = staticPositionCenter [static]
const Position & Position::East = staticPositionEast [static]

Definition at line 97 of file KDChartPosition.h.

Referenced by KDChart::PositionPoints::point().

const Position & Position::Floating = staticPositionFloating [static]

Definition at line 103 of file KDChartPosition.h.

Referenced by KDChart::Legend::setFloatingPosition().

const Position & Position::North = staticPositionNorth [static]

Definition at line 95 of file KDChartPosition.h.

Referenced by KDChart::PositionPoints::point().

const Position & Position::NorthEast = staticPositionNorthEast [static]

Definition at line 96 of file KDChartPosition.h.

Referenced by KDChart::PositionPoints::point().

const Position & Position::NorthWest = staticPositionNorthWest [static]

Definition at line 94 of file KDChartPosition.h.

Referenced by KDChart::PositionPoints::point().

const Position & Position::South = staticPositionSouth [static]

Definition at line 99 of file KDChartPosition.h.

Referenced by KDChart::PositionPoints::point().

const Position & Position::SouthEast = staticPositionSouthEast [static]

Definition at line 98 of file KDChartPosition.h.

Referenced by KDChart::PositionPoints::point().

const Position & Position::SouthWest = staticPositionSouthWest [static]

Definition at line 100 of file KDChartPosition.h.

Referenced by KDChart::PositionPoints::point().

const Position & Position::Unknown = staticPositionUnknown [static]

Definition at line 92 of file KDChartPosition.h.

Referenced by KDChart::RelativePosition::resetReferencePosition().

const Position & Position::West = staticPositionWest [static]

Definition at line 101 of file KDChartPosition.h.

Referenced by KDChart::PositionPoints::point().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-chart/