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< QByteArray > | names (Options options=Options(IncludeCenter|IncludeFloating)) |
static QStringList | printableNames (Options options=Options(IncludeCenter|IncludeFloating)) |
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 |
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.

- 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; }
Definition at line 61 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
◆ 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()
|
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 188 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()
|
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 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.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Jan 31 2023 04:02:54 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.