25 #ifndef KDGANTTGLOBAL_H
26 #define KDGANTTGLOBAL_H
45 #define KDAB_SET_OBJECT_NAME( x ) __kdab__dereference_for_methodcall( x ).setObjectName( QLatin1String( #x ) )
47 #if defined(_MSC_VER) && _MSC_VER <= 1300
48 #define KDGANTT_DECLARE_PRIVATE_DERIVED( X ) \
51 friend class Private; \
53 inline Private * d_func(); \
54 inline const Private * d_func() const; \
55 explicit inline X( Private * ); \
59 #define KDGANTT_DECLARE_PRIVATE_DERIVED( X ) \
62 friend class Private; \
63 inline Private * d_func(); \
64 inline const Private * d_func() const; \
65 explicit inline X( Private * ); \
70 #if defined(_MSC_VER) && _MSC_VER <= 1300
71 #define KDGANTT_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType ) \
74 friend class Private; \
76 inline Private * d_func(); \
77 inline const Private * d_func() const; \
78 explicit inline X( Private *, ParentType ); \
82 #define KDGANTT_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType ) \
85 friend class Private; \
86 inline Private * d_func(); \
87 inline const Private * d_func() const; \
88 explicit inline X( Private *, ParentType ); \
93 #define KDGANTT_DECLARE_PRIVATE_DERIVED_QWIDGET( X ) \
94 KDGANTT_DECLARE_PRIVATE_DERIVED_PARENT( X, QWidget* )
96 #define KDGANTT_DECLARE_PRIVATE_BASE_VALUE( X ) \
98 inline void swap( X & other ) { qSwap( _d, other._d ); } \
101 friend class Private; \
102 Private * d_func() { return _d; } \
103 const Private * d_func() const { return _d; } \
108 #if defined(_MSC_VER) && _MSC_VER <= 1300
109 #define KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \
112 friend class Private; \
114 Private * d_func() { return _d; } \
115 const Private * d_func() const { return _d; } \
116 explicit inline X( Private * ); \
121 #define KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \
124 friend class Private; \
125 Private * d_func() { return _d; } \
126 const Private * d_func() const { return _d; } \
127 explicit inline X( Private * ); \
133 #if defined(_MSC_VER) && _MSC_VER <= 1300
134 #define KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \
137 friend class Private; \
139 Private * d_func() { return _d; } \
140 const Private * d_func() const { return _d; } \
141 explicit inline X( Private *, QWidget* ); \
146 #define KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \
149 friend class Private; \
150 Private * d_func() { return _d; } \
151 const Private * d_func() const { return _d; } \
152 explicit inline X( Private *, QWidget* ); \
165 #include <QtAlgorithms>
168 #define KDGANTT_DECLARE_SWAP_SPECIALISATION( X ) \
169 template <> inline void qSwap<X>( X & lhs, X & rhs ) \
170 { lhs.swap( rhs ); } \
172 template <> inline void swap<X>( X & lhs, X & rhs ) \
173 { lhs.swap( rhs ); } \
176 #define KDGANTT_DECLARE_SWAP_SPECIALISATION( X ) \
177 template <> inline void qSwap<X>( X & lhs, X & rhs ) \
181 #define KDGANTT_DECLARE_SWAP_SPECIALISATION_DERIVED( X ) \
182 KDGANTT_DECLARE_SWAP_SPECIALISATION( X )
184 #define KDGANTT_DECLARE_SWAP_BASE( X ) \
186 void doSwap( X& other ) \
187 { qSwap( _d, other._d); }
189 #define KDGANTT_DECLARE_SWAP_DERIVED( X ) \
190 void swap( X& other ) { doSwap( other ); }
192 #if defined(Q_OS_WIN) && defined(QT_DLL)
197 template class Q_DECL_IMPORT QVector<QPointF>;
224 inline Span() : m_start( -1 ), m_length( 0 ) {}
225 inline Span( qreal start, qreal length ) : m_start( start ), m_length( length ) {}
226 inline Span(
const Span& other ) : m_start(other.m_start), m_length(other.m_length) {}
229 inline Span&
operator=(
const Span& other ) { m_start=other.m_start; m_length=other.m_length;
return *
this; }
231 inline void setStart( qreal start ) { m_start=start; }
232 inline qreal
start()
const {
return m_start; }
233 inline void setEnd( qreal end ) { m_length = m_start-end; }
234 inline qreal
end()
const {
return m_start+m_length; }
236 inline void setLength( qreal length ) { m_length=length; }
237 inline qreal
length()
const {
return m_length; }
239 inline bool isValid()
const {
return m_start >= 0.;}
242 return m_start == other.m_start && m_length == other.m_length;
245 const qreal new_start = qMin(start(),other.
start());
246 return Span( new_start, (end()<other.
end())?other.
end()-new_start:end()-new_start);
259 DateTimeSpan(
const QDateTime& start,
const QDateTime& end );
265 inline void setStart(
const QDateTime& start ) { m_start=start; }
266 inline QDateTime
start()
const {
return m_start; }
268 inline void setEnd(
const QDateTime& end ) { m_end=end; }
269 inline QDateTime
end()
const {
return m_end; }
271 bool isValid()
const;
284 #ifndef QT_NO_DEBUG_STREAM
bool operator!=(const DateTimeSpan &s1, const DateTimeSpan &s2)
void setEnd(const QDateTime &end)
T & __kdab__dereference_for_methodcall(T &o)
void setLength(qreal length)
QDebug KDGANTT_EXPORT operator<<(QDebug dbg, KDGantt::ItemDataRole r)
A class representing a start point and a length.
bool equals(const DateTimeSpan &other) const
Span expandedTo(const Span &other) const
Span & operator=(const Span &other)
Q_DECLARE_TYPEINFO(KDGantt::Span, Q_MOVABLE_TYPE)
bool equals(const Span &other) const
void setStart(const QDateTime &start)
void setStart(qreal start)
bool operator==(const DateTimeSpan &s1, const DateTimeSpan &s2)
Span(qreal start, qreal length)