27 #include <QStringList> 31 #include <KDABLibFakes> 42 static const char * staticPositionNames[] = {
43 QT_TRANSLATE_NOOP(
"Position",
"Unknown Position"),
44 QT_TRANSLATE_NOOP(
"Position",
"Center"),
45 QT_TRANSLATE_NOOP(
"Position",
"NorthWest"),
46 QT_TRANSLATE_NOOP(
"Position",
"North"),
47 QT_TRANSLATE_NOOP(
"Position",
"NorthEast"),
48 QT_TRANSLATE_NOOP(
"Position",
"East"),
49 QT_TRANSLATE_NOOP(
"Position",
"SouthEast"),
50 QT_TRANSLATE_NOOP(
"Position",
"South"),
51 QT_TRANSLATE_NOOP(
"Position",
"SouthWest"),
52 QT_TRANSLATE_NOOP(
"Position",
"West"),
53 QT_TRANSLATE_NOOP(
"Position",
"Floating")
73 static const int maxPositionValue = 10;
102 assert( 0 <=
value ); assert(
value <= maxPositionValue );
133 return m_value == Position::Unknown.
value();
138 return m_value == Position::SouthWest.
value() ||
139 m_value == Position::West.
value() ||
140 m_value == Position::NorthWest.
value();
144 return m_value == Position::NorthWest.
value() ||
145 m_value == Position::North.
value() ||
146 m_value == Position::NorthEast.
value();
150 return m_value == Position::NorthEast.
value() ||
151 m_value == Position::East.
value() ||
152 m_value == Position::SouthEast.
value();
156 return m_value == Position::SouthWest.
value() ||
157 m_value == Position::South.
value() ||
158 m_value == Position::SouthEast.
value();
163 return m_value == Position::NorthWest.
value() ||
164 m_value == Position::NorthEast.
value() ||
165 m_value == Position::SouthEast.
value() ||
166 m_value == Position::SouthWest.
value();
170 return m_value == Position::North.
value() ||
171 m_value == Position::South.
value();
176 return m_value == Position::Floating.
value();
184 return staticPositionNames[m_value];
192 return tr(staticPositionNames[m_value]);
207 const int end = ( options &
IncludeFloating ) ? maxPositionValue : maxPositionValue-1;
208 for (
int i=start; i<=end; ++i)
209 list.append( staticPositionNames[i] );
224 const int end = ( options &
IncludeFloating ) ? maxPositionValue : maxPositionValue-1;
225 for (
int i=start; i<=end; ++i)
232 for (
int i=1; i<=maxPositionValue; ++i)
233 if ( !qstricmp( name, staticPositionNames[i] ) )
250 return (
value() == value_ );
254 #if !defined(QT_NO_DEBUG_STREAM) 257 dbg <<
"KDChart::Position(" static const Position & East
KDChartEnums::PositionValue value() const
Returns an integer value corresponding to this Position.
Project global class providing some enums needed both by KDChartParams and by KDChartCustomBox.
Definition of global enums.
static const Position & South
static const Position & Center
static const Position & Unknown
Position()
Default constructor.
static const Position & NorthWest
QString printableName() const
Returns a translated string, corresponding to this Position.
static QStringList printableNames(Options options=Options(IncludeCenter|IncludeFloating))
Returns a list of all translated string, corresponding to the pre-defined positions.
bool operator==(const Position &) const
static const Position & West
PositionValue
Numerical values of the static KDChart::Position instances, for using a Position::value() with a swit...
static const Position & NorthEast
static Position fromName(const char *name)
static const Position & North
Defines a position, using compass terminology.
QDebug operator<<(QDebug stream, const DataDimension &r)
static const Position & SouthEast
static const Position & Floating
const char * name() const
Returns a non-translated string in English language, corresponding to this Position.
static QList< QByteArray > names(Options options=Options(IncludeCenter|IncludeFloating))
Returns a list of all string, corresponding to the pre-defined positions.
static const Position & SouthWest