#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.
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.
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 | |
| static Position | fromName (const QByteArray &name) |
| static Position | fromName (const char *name) |
| static QList< QByteArray > | names (Options options=IncludeCenter) |
| Returns a list of all string, corresponding to the pre-defined positions. | |
| static QStringList | printableNames (Options options=IncludeCenter) |
| Returns a list of all translated string, corresponding to the pre-defined positions. | |
Static Public Attributes | |
| static const Position & | Center |
| static const Position & | East |
| static const Position & | Floating |
| static const Position & | North |
| static const Position & | NorthEast |
| static const Position & | NorthWest |
| static const Position & | South |
| static const Position & | SouthEast |
| static const Position & | SouthWest |
| static const Position & | Unknown |
| static const Position & | West |
| Position::Position | ( | ) |
Default constructor.
Creates a new Position, defaulting it to Position::Unknown.
Definition at line 100 of file KDChartPosition.cpp.
Referenced by fromName().
00101 : m_value( KDChartEnums::PositionUnknown ) 00102 { 00103 00104 }
| 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 124 of file KDChartPosition.cpp.
00125 : m_value( value ) 00126 { 00127 00128 }
| Position Position::fromName | ( | const QByteArray & | name | ) | [static] |
| Position Position::fromName | ( | const char * | name | ) | [static] |
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 }
| bool Position::isCorner | ( | ) | const |
Definition at line 168 of file KDChartPosition.cpp.
References NorthEast, NorthWest, SouthEast, SouthWest, and 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 }
| bool Position::isEastSide | ( | ) | const |
Definition at line 155 of file KDChartPosition.cpp.
References East, NorthEast, SouthEast, and value().
00156 { 00157 return m_value == Position::NorthEast.value() || 00158 m_value == Position::East.value() || 00159 m_value == Position::SouthEast.value(); 00160 }
| bool Position::isFloating | ( | ) | const |
Definition at line 181 of file KDChartPosition.cpp.
References Floating, and value().
Referenced by KDChart::Chart::reLayoutFloatingLegends().
00182 { 00183 return m_value == Position::Floating.value(); 00184 }
| bool Position::isNorthSide | ( | ) | const |
Definition at line 149 of file KDChartPosition.cpp.
References North, NorthEast, NorthWest, and value().
00150 { 00151 return m_value == Position::NorthWest.value() || 00152 m_value == Position::North.value() || 00153 m_value == Position::NorthEast.value(); 00154 }
| bool Position::isPole | ( | ) | const |
Definition at line 175 of file KDChartPosition.cpp.
References North, South, and value().
00176 { 00177 return m_value == Position::North.value() || 00178 m_value == Position::South.value(); 00179 }
| bool Position::isSouthSide | ( | ) | const |
Definition at line 161 of file KDChartPosition.cpp.
References South, SouthEast, SouthWest, and value().
00162 { 00163 return m_value == Position::SouthWest.value() || 00164 m_value == Position::South.value() || 00165 m_value == Position::SouthEast.value(); 00166 }
| bool Position::isUnknown | ( | ) | const |
Definition at line 138 of file KDChartPosition.cpp.
References Unknown, and value().
00139 { 00140 return m_value == Position::Unknown.value(); 00141 }
| bool Position::isWestSide | ( | ) | const |
Definition at line 143 of file KDChartPosition.cpp.
References NorthWest, SouthWest, value(), and West.
00144 { 00145 return m_value == Position::SouthWest.value() || 00146 m_value == Position::West.value() || 00147 m_value == Position::NorthWest.value(); 00148 }
| const char * Position::name | ( | ) | const |
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 }
| QList< QByteArray > Position::names | ( | Options | options = IncludeCenter |
) | [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 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 }
| bool KDChart::Position::operator!= | ( | int | ) | const |
Definition at line 132 of file KDChartPosition.h.
References operator==().
00132 { return !operator==( other ); }
| bool KDChart::Position::operator!= | ( | const Position & | ) | const |
| bool Position::operator== | ( | int | ) | const |
Definition at line 253 of file KDChartPosition.cpp.
References value().
00254 { 00255 return ( value() == value_ ); 00256 }
| bool Position::operator== | ( | const Position & | ) | const |
| QString Position::printableName | ( | ) | const |
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 }
| QStringList Position::printableNames | ( | Options | options = IncludeCenter |
) | [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 226 of file KDChartPosition.cpp.
References IncludeCenter, maxPositionValue, 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 }
| KDChartEnums::PositionValue Position::value | ( | ) | const |
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::TernaryAxis::setPosition(), KDChart::PolarDiagram::setShowDelimitersAtPosition(), KDChart::PolarDiagram::setShowLabelsAtPosition(), KDChart::PolarDiagram::showDelimitersAtPosition(), and KDChart::PolarDiagram::showLabelsAtPosition().
const Position & Position::Center [static] |
const Position & Position::East [static] |
Definition at line 105 of file KDChartPosition.h.
Referenced by isEastSide(), and KDChart::PositionPoints::point().
const Position & Position::Floating [static] |
Definition at line 111 of file KDChartPosition.h.
Referenced by isFloating(), and KDChart::Legend::setFloatingPosition().
const Position & Position::North [static] |
Definition at line 103 of file KDChartPosition.h.
Referenced by isNorthSide(), isPole(), and KDChart::PositionPoints::point().
const Position & Position::NorthEast [static] |
Definition at line 104 of file KDChartPosition.h.
Referenced by isCorner(), isEastSide(), isNorthSide(), and KDChart::PositionPoints::point().
const Position & Position::NorthWest [static] |
Definition at line 102 of file KDChartPosition.h.
Referenced by isCorner(), isNorthSide(), isWestSide(), and KDChart::PositionPoints::point().
const Position & Position::South [static] |
Definition at line 107 of file KDChartPosition.h.
Referenced by isPole(), isSouthSide(), and KDChart::PositionPoints::point().
const Position & Position::SouthEast [static] |
Definition at line 106 of file KDChartPosition.h.
Referenced by isCorner(), isEastSide(), isSouthSide(), and KDChart::PositionPoints::point().
const Position & Position::SouthWest [static] |
Definition at line 108 of file KDChartPosition.h.
Referenced by isCorner(), isSouthSide(), isWestSide(), and KDChart::PositionPoints::point().
const Position & Position::Unknown [static] |
Definition at line 100 of file KDChartPosition.h.
Referenced by isUnknown(), and KDChart::RelativePosition::resetReferencePosition().
const Position & Position::West [static] |
Definition at line 109 of file KDChartPosition.h.
Referenced by isWestSide(), and KDChart::PositionPoints::point().
1.5.1