20 #ifndef KCHARTPOSITION_H 21 #define KCHARTPOSITION_H 26 #include <QCoreApplication> 33 template <
typename T>
class QList;
82 const char *name()
const;
85 bool isUnknown()
const;
87 bool isWestSide()
const;
88 bool isNorthSide()
const;
89 bool isEastSide()
const;
90 bool isSouthSide()
const;
92 bool isCorner()
const;
95 bool isFloating()
const;
97 static const Position& Unknown;
98 static const Position& Center;
99 static const Position& NorthWest;
100 static const Position& North;
101 static const Position& NorthEast;
102 static const Position& East;
103 static const Position& SouthEast;
104 static const Position& South;
105 static const Position& SouthWest;
106 static const Position& West;
108 static const Position& Floating;
113 IncludeFloating = 0x2 };
114 Q_DECLARE_FLAGS(
Options, Option )
123 static Position fromName(
const char * name);
124 static Position fromName(
const QByteArray & name);
126 bool operator==(
const Position& )
const;
127 bool operator==(
int )
const;
128 bool operator!=(
const Position& )
const;
129 bool operator!=(
int )
const;
135 inline bool Position::operator!=(
const Position & other )
const {
return !operator==( other ); }
136 inline bool Position::operator!=(
int other )
const {
return !operator==( other ); }
157 : mPositionCenter( center )
158 , mPositionNorthWest( northWest )
159 , mPositionNorth( north )
160 , mPositionNorthEast( northEast )
161 , mPositionEast( east )
162 , mPositionSouthEast( southEast )
163 , mPositionSouth( south )
164 , mPositionSouthWest( southWest )
165 , mPositionWest( west )
168 const QPointF& onePointForAllPositions )
169 : mPositionCenter( onePointForAllPositions )
170 , mPositionNorthWest( onePointForAllPositions )
171 , mPositionNorth( onePointForAllPositions )
172 , mPositionNorthEast( onePointForAllPositions )
173 , mPositionEast( onePointForAllPositions )
174 , mPositionSouthEast( onePointForAllPositions )
175 , mPositionSouth( onePointForAllPositions )
176 , mPositionSouthWest( onePointForAllPositions )
177 , mPositionWest( onePointForAllPositions )
183 mPositionCenter = r.
center();
184 mPositionNorthWest = r.topLeft();
185 mPositionNorth =
QPointF(r.center().x(), r.top());
186 mPositionNorthEast = r.topRight();
187 mPositionEast =
QPointF(r.right(), r.center().y());
188 mPositionSouthEast = r.bottomRight();
189 mPositionSouth =
QPointF(r.center().x(), r.bottom());
190 mPositionSouthWest = r.bottomLeft();
191 mPositionWest =
QPointF(r.left(), r.center().y());
198 : mPositionCenter( (northWest + southEast) / 2.0 )
199 , mPositionNorthWest( northWest )
200 , mPositionNorth( (northWest + northEast) / 2.0 )
201 , mPositionNorthEast( northEast )
202 , mPositionEast( (northEast + southEast) / 2.0 )
203 , mPositionSouthEast( southEast )
204 , mPositionSouth( (southWest + southEast) / 2.0 )
205 , mPositionSouthWest( southWest )
206 , mPositionWest( (northWest + southWest) / 2.0 )
211 mapOfDegrees[pos] = degrees;
214 #if defined(Q_COMPILER_MANGLES_RETURN_TYPE) 220 if ( mapOfDegrees.contains(pos) )
221 return mapOfDegrees[pos];
225 #if defined(Q_COMPILER_MANGLES_RETURN_TYPE) 232 if ( position == Position::Center)
233 return mPositionCenter;
234 if ( position == Position::NorthWest)
235 return mPositionNorthWest;
236 if ( position == Position::North)
237 return mPositionNorth;
238 if ( position == Position::NorthEast)
239 return mPositionNorthEast;
240 if ( position == Position::East)
241 return mPositionEast;
242 if ( position == Position::SouthEast)
243 return mPositionSouthEast;
244 if ( position == Position::South)
245 return mPositionSouth;
246 if ( position == Position::SouthWest)
247 return mPositionSouthWest;
248 if ( position == Position::West)
249 return mPositionWest;
250 return mPositionUnknown;
256 mPositionUnknown.
isNull() &&
257 mPositionCenter.isNull() &&
258 mPositionNorthWest.isNull() &&
259 mPositionNorth.isNull() &&
260 mPositionNorthEast.isNull() &&
261 mPositionEast.isNull() &&
262 mPositionSouthEast.isNull() &&
263 mPositionSouth.isNull() &&
264 mPositionSouthWest.isNull() &&
265 mPositionWest.isNull();
286 #if !defined(QT_NO_DEBUG_STREAM) 297 #endif // KCHARTPOSITION_H PositionValue
Numerical values of the static KChart::Position instances, for using a Position::value() with a switc...
Defines a position, using compass terminology.
Stores the absolute target points of a Position.
QRectF normalized() const const
QPointF center() const const
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Definition of global enums.
bool isNull() const const