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.
Member Typedef Documentation
◆ Options
QFlags< Option > KChart::Position::Options |
Definition at line 103 of file KChartPosition.h.
Member Enumeration Documentation
◆ Option
enum KChart::Position::Option |
Definition at line 100 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
◆ fromName() [1/2]
|
static |
Definition at line 215 of file KChartPosition.cpp.
◆ fromName() [2/2]
|
static |
Definition at line 223 of file KChartPosition.cpp.
◆ isCorner()
bool Position::isCorner | ( | ) | const |
Definition at line 146 of file KChartPosition.cpp.
◆ isEastSide()
bool Position::isEastSide | ( | ) | const |
Definition at line 133 of file KChartPosition.cpp.
◆ isFloating()
bool Position::isFloating | ( | ) | const |
Definition at line 159 of file KChartPosition.cpp.
◆ isNorthSide()
bool Position::isNorthSide | ( | ) | const |
Definition at line 127 of file KChartPosition.cpp.
◆ isPole()
bool Position::isPole | ( | ) | const |
Definition at line 153 of file KChartPosition.cpp.
◆ isSouthSide()
bool Position::isSouthSide | ( | ) | const |
Definition at line 139 of file KChartPosition.cpp.
◆ isUnknown()
bool Position::isUnknown | ( | ) | const |
Definition at line 116 of file KChartPosition.cpp.
◆ isWestSide()
bool Position::isWestSide | ( | ) | const |
Definition at line 121 of file KChartPosition.cpp.
◆ 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.
◆ operator!=() [1/2]
|
inline |
Definition at line 124 of file KChartPosition.h.
◆ operator!=() [2/2]
|
inline |
Definition at line 125 of file KChartPosition.h.
◆ operator==() [1/2]
bool Position::operator== | ( | const Position & | r | ) | const |
Definition at line 227 of file KChartPosition.cpp.
◆ operator==() [2/2]
bool Position::operator== | ( | int | value_ | ) | const |
Definition at line 233 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.
Member Data Documentation
◆ Center
|
static |
Definition at line 87 of file KChartPosition.h.
◆ East
|
static |
Definition at line 91 of file KChartPosition.h.
◆ Floating
|
static |
Definition at line 97 of file KChartPosition.h.
◆ North
|
static |
Definition at line 89 of file KChartPosition.h.
◆ NorthEast
|
static |
Definition at line 90 of file KChartPosition.h.
◆ NorthWest
|
static |
Definition at line 88 of file KChartPosition.h.
◆ South
|
static |
Definition at line 93 of file KChartPosition.h.
◆ SouthEast
|
static |
Definition at line 92 of file KChartPosition.h.
◆ SouthWest
|
static |
Definition at line 94 of file KChartPosition.h.
◆ Unknown
|
static |
Definition at line 86 of file KChartPosition.h.
◆ West
|
static |
Definition at line 95 of file KChartPosition.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.