KD Chart 2
[rev.2.7]
|
Defines a position, using compass terminology. More...
#include <KDChartPosition.h>
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. More... | |
bool | operator!= (const Position &) const |
bool | operator!= (int) const |
bool | operator== (const Position &) const |
bool | operator== (int) const |
Position () | |
Default constructor. More... | |
Position (KDChartEnums::PositionValue value) | |
Constructor. More... | |
QString | printableName () const |
Returns a translated string, corresponding to this Position. More... | |
KDChartEnums::PositionValue | value () const |
Returns an integer value corresponding to this Position. More... | |
Static Public Member Functions | |
static Position | fromName (const char *name) |
static Position | fromName (const QByteArray &name) |
static QList< QByteArray > | names (Options options=Options(IncludeCenter|IncludeFloating)) |
Returns a list of all string, corresponding to the pre-defined positions. More... | |
static QStringList | printableNames (Options options=Options(IncludeCenter|IncludeFloating)) |
Returns a list of all translated string, corresponding to the pre-defined positions. More... | |
Static Public Attributes | |
static const Position & | Center = staticPositionCenter |
static const Position & | East = staticPositionEast |
static const Position & | Floating = staticPositionFloating |
static const Position & | North = staticPositionNorth |
static const Position & | NorthEast = staticPositionNorthEast |
static const Position & | NorthWest = staticPositionNorthWest |
static const Position & | South = staticPositionSouth |
static const Position & | SouthEast = staticPositionSouthEast |
static const Position & | SouthWest = staticPositionSouthWest |
static const Position & | Unknown = staticPositionUnknown |
static const Position & | West = staticPositionWest |
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.
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; }
Definition at line 75 of file KDChartPosition.h.
Enumerator | |
---|---|
IncludeCenter | |
IncludeFloating |
Definition at line 114 of file KDChartPosition.h.
Position::Position | ( | ) |
Default constructor.
Creates a new Position, defaulting it to Position::Unknown.
Definition at line 93 of file KDChartPosition.cpp.
References value().
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.
* const KDChart::Position myPosition = KDChart::Position::NorthEast; *
Definition at line 117 of file KDChartPosition.cpp.
|
static |
Definition at line 230 of file KDChartPosition.cpp.
References Position().
Referenced by fromName().
|
static |
Definition at line 238 of file KDChartPosition.cpp.
References 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<<().
|
static |
Returns a list of all string, corresponding to the pre-defined positions.
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!= | ( | const Position & | other | ) | const |
Definition at line 138 of file KDChartPosition.h.
References KDGantt::operator==().
bool KDChart::Position::operator!= | ( | int | other | ) | const |
Definition at line 139 of file KDChartPosition.h.
References KDGantt::operator==().
bool Position::operator== | ( | const Position & | r | ) | const |
Definition at line 242 of file KDChartPosition.cpp.
References value().
bool Position::operator== | ( | int | value_ | ) | const |
Definition at line 248 of file KDChartPosition.cpp.
References value().
QString Position::printableName | ( | ) | const |
Returns a translated string, corresponding to this Position.
Definition at line 190 of file KDChartPosition.cpp.
Referenced by printableNames().
|
static |
Returns a list of all translated string, corresponding to the pre-defined positions.
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 |
Returns an integer value corresponding to this Position.
Definition at line 126 of file KDChartPosition.cpp.
Referenced by KDChart::Chart::addHeaderFooter(), KDChart::Chart::addLegend(), isCorner(), isEastSide(), isFloating(), isNorthSide(), isPole(), isSouthSide(), isUnknown(), isWestSide(), operator==(), Position(), KDChart::TernaryAxis::setPosition(), KDChart::PolarDiagram::setShowDelimitersAtPosition(), KDChart::PolarDiagram::setShowLabelsAtPosition(), KDChart::PolarDiagram::showDelimitersAtPosition(), and KDChart::PolarDiagram::showLabelsAtPosition().
|
static |
Definition at line 101 of file KDChartPosition.h.
Referenced by labelAttachmentLine(), KDChart::RadarDiagram::paint(), KDChart::PolarDiagram::paint(), KDChart::PositionPoints::point(), and KDChart::PolarDiagram::~PolarDiagram().
|
static |
Definition at line 105 of file KDChartPosition.h.
Referenced by KDChart::PositionPoints::point(), and KDChart::PolarDiagram::~PolarDiagram().
|
static |
Definition at line 111 of file KDChartPosition.h.
Referenced by KDChart::Legend::setFloatingPosition(), and KDChart::PolarDiagram::~PolarDiagram().
|
static |
Definition at line 103 of file KDChartPosition.h.
Referenced by KDChart::PositionPoints::point(), and KDChart::PolarDiagram::~PolarDiagram().
|
static |
Definition at line 104 of file KDChartPosition.h.
Referenced by KDChart::PositionPoints::point(), KDChart::Legend::~Legend(), and KDChart::PolarDiagram::~PolarDiagram().
|
static |
Definition at line 102 of file KDChartPosition.h.
Referenced by KDChart::PositionPoints::point(), and KDChart::PolarDiagram::~PolarDiagram().
|
static |
Definition at line 107 of file KDChartPosition.h.
Referenced by KDChart::PositionPoints::point(), and KDChart::PolarDiagram::~PolarDiagram().
|
static |
Definition at line 106 of file KDChartPosition.h.
Referenced by KDChart::PositionPoints::point(), and KDChart::PolarDiagram::~PolarDiagram().
|
static |
Definition at line 108 of file KDChartPosition.h.
Referenced by KDChart::PositionPoints::point(), and KDChart::PolarDiagram::~PolarDiagram().
|
static |
Definition at line 100 of file KDChartPosition.h.
Referenced by KDChart::RelativePosition::resetReferencePosition(), and KDChart::PolarDiagram::~PolarDiagram().
|
static |
Definition at line 109 of file KDChartPosition.h.
Referenced by KDChart::PositionPoints::point(), and KDChart::PolarDiagram::~PolarDiagram().