#include <KDChartPosition.h>
Collaboration diagram for KDChart::Position:
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.
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; }
Definition at line 75 of file KDChartPosition.h.
Public Types | |
| enum | Option { IncludeCenter = 0, ExcludeCenter = 1 } |
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 | |
| Position | fromName (const QByteArray &name) |
| Position | fromName (const char *name) |
| QList< QByteArray > | names (Options options=IncludeCenter) |
| Returns a list of all string, corresponding to the pre-defined positions. | |
| QStringList | printableNames (Options options=IncludeCenter) |
| Returns a list of all translated string, corresponding to the pre-defined positions. | |
Static Public Attributes | |
| const Position & | Center = staticPositionCenter |
| const Position & | East = staticPositionEast |
| const Position & | Floating = staticPositionFloating |
| const Position & | North = staticPositionNorth |
| const Position & | NorthEast = staticPositionNorthEast |
| const Position & | NorthWest = staticPositionNorthWest |
| const Position & | South = staticPositionSouth |
| const Position & | SouthEast = staticPositionSouthEast |
| const Position & | SouthWest = staticPositionSouthWest |
| const Position & | Unknown = staticPositionUnknown |
| const Position & | West = staticPositionWest |
|
|
Definition at line 113 of file KDChartPosition.h.
00113 { IncludeCenter=0, ExcludeCenter=1 };
|
|
|
Default constructor. Creates a new Position, defaulting it to Position::Unknown. Definition at line 100 of file KDChartPosition.cpp. Referenced by fromName(), and printableNames().
00101 : m_value( KDChartEnums::PositionUnknown )
00102 {
00103
00104 }
|
|
|
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.
Definition at line 124 of file KDChartPosition.cpp.
00125 : m_value( value )
00126 {
00127
00128 }
|
|
|
Definition at line 243 of file KDChartPosition.cpp. References fromName().
00243 {
00244 return fromName( name.data() );
00245 }
|
|
|
Definition at line 235 of file KDChartPosition.cpp. References maxPositionValue, Position(), and staticPositionNames. Referenced by fromName().
00236 {
00237 for( int i=1; i<=maxPositionValue; ++i)
00238 if ( !qstricmp( name, staticPositionNames[i] ) )
00239 return Position(i);
00240 return Position(0);
00241 }
|
|
|
Definition at line 168 of file KDChartPosition.cpp. References value().
00169 {
00170 return m_value == Position::NorthWest.value() ||
00171 m_value == Position::NorthEast.value() ||
00172 m_value == Position::SouthEast.value() ||
00173 m_value == Position::SouthWest.value();
00174 }
|
|
|
Definition at line 155 of file KDChartPosition.cpp. References value().
00156 {
00157 return m_value == Position::NorthEast.value() ||
00158 m_value == Position::East.value() ||
00159 m_value == Position::SouthEast.value();
00160 }
|
|
|
Definition at line 181 of file KDChartPosition.cpp. References value(). Referenced by KDChart::Chart::reLayoutFloatingLegends().
00182 {
00183 return m_value == Position::Floating.value();
00184 }
|
|
|
Definition at line 149 of file KDChartPosition.cpp. References value().
00150 {
00151 return m_value == Position::NorthWest.value() ||
00152 m_value == Position::North.value() ||
00153 m_value == Position::NorthEast.value();
00154 }
|
|
|
Definition at line 175 of file KDChartPosition.cpp. References value().
00176 {
00177 return m_value == Position::North.value() ||
00178 m_value == Position::South.value();
00179 }
|
|
|
Definition at line 161 of file KDChartPosition.cpp. References value().
00162 {
00163 return m_value == Position::SouthWest.value() ||
00164 m_value == Position::South.value() ||
00165 m_value == Position::SouthEast.value();
00166 }
|
|
|
Definition at line 138 of file KDChartPosition.cpp. References value().
00139 {
00140 return m_value == Position::Unknown.value();
00141 }
|
|
|
Definition at line 143 of file KDChartPosition.cpp. References value().
00144 {
00145 return m_value == Position::SouthWest.value() ||
00146 m_value == Position::West.value() ||
00147 m_value == Position::NorthWest.value();
00148 }
|
|
|
Returns a non-translated string in English language, corresponding to this Position.
Definition at line 189 of file KDChartPosition.cpp. References staticPositionNames. Referenced by operator<<().
00190 {
00191 return staticPositionNames[m_value];
00192 }
|
|
|
Returns a list of all string, corresponding to the pre-defined positions.
Definition at line 210 of file KDChartPosition.cpp. References IncludeCenter, maxPositionValue, and staticPositionNames.
00211 {
00212 QList<QByteArray> list;
00213 const int start = ( options & IncludeCenter ) ? 1 : 2;
00214 for( int i=start; i<=maxPositionValue; ++i)
00215 list.append( staticPositionNames[i] );
00216 return list;
00217 }
|
|
|
Definition at line 132 of file KDChartPosition.h. References operator==().
00132 { return !operator==( other ); }
|
|
|
Definition at line 131 of file KDChartPosition.h. References operator==().
00131 { return !operator==( other ); }
|
|
|
Definition at line 253 of file KDChartPosition.cpp. References value().
00254 {
00255 return ( value() == value_ );
00256 }
|
|
|
Definition at line 247 of file KDChartPosition.cpp. References value(). Referenced by operator!=().
|
|
|
Returns a translated string, corresponding to this Position.
Definition at line 197 of file KDChartPosition.cpp. References staticPositionNames. Referenced by printableNames().
00198 {
00199 return tr(staticPositionNames[m_value]);
00200 }
|
|
|
Returns a list of all translated string, corresponding to the pre-defined positions.
Definition at line 226 of file KDChartPosition.cpp. References IncludeCenter, maxPositionValue, Position(), and printableName().
00227 {
00228 QStringList list;
00229 const int start = ( options & IncludeCenter ) ? 1 : 2;
00230 for( int i=start; i<=maxPositionValue; ++i)
00231 list.append( Position(i).printableName() );
00232 return list;
00233 }
|
|
|
Returns an integer value corresponding to this Position.
Definition at line 133 of file KDChartPosition.cpp. Referenced by isCorner(), isEastSide(), isFloating(), isNorthSide(), isPole(), isSouthSide(), isUnknown(), isWestSide(), operator==(), KDChart::PolarDiagram::setShowDelimitersAtPosition(), KDChart::PolarDiagram::setShowLabelsAtPosition(), KDChart::PolarDiagram::showDelimitersAtPosition(), and KDChart::PolarDiagram::showLabelsAtPosition().
00134 {
00135 return static_cast<KDChartEnums::PositionValue>( m_value );
00136 }
|
|
|
Definition at line 85 of file KDChartPosition.cpp. |
|
|
Definition at line 89 of file KDChartPosition.cpp. |
|
|
Definition at line 94 of file KDChartPosition.cpp. |
|
|
Definition at line 87 of file KDChartPosition.cpp. |
|
|
Definition at line 88 of file KDChartPosition.cpp. |
|
|
Definition at line 86 of file KDChartPosition.cpp. |
|
|
Definition at line 91 of file KDChartPosition.cpp. |
|
|
Definition at line 90 of file KDChartPosition.cpp. |
|
|
Definition at line 92 of file KDChartPosition.cpp. |
|
|
Definition at line 84 of file KDChartPosition.cpp. |
|
|
Definition at line 93 of file KDChartPosition.cpp. |
1.3.6