27 #ifndef KDGANTTGLOBAL_H 28 #define KDGANTTGLOBAL_H 35 #include "kdchart_export.h" 37 #if (defined(__MINGW32__) || defined(__MINGW64__)) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 4) && (__GNUC_PATCHLEVEL__ == 0) 39 int swprintf (
wchar_t *,
size_t,
const wchar_t *, ...);
40 int vswprintf(
wchar_t *,
const wchar_t *, va_list);
43 #ifndef KDAB_SET_OBJECT_NAME 54 #define KDAB_SET_OBJECT_NAME( x ) __kdab__dereference_for_methodcall( x ).setObjectName( QLatin1String( #x ) ) 57 #if defined(_MSC_VER) && _MSC_VER <= 1300 58 #define KDGANTT_DECLARE_PRIVATE_DERIVED( X ) \ 61 friend class Private; \ 63 inline Private * d_func(); \ 64 inline const Private * d_func() const; \ 65 explicit inline X( Private * ); \ 69 #define KDGANTT_DECLARE_PRIVATE_DERIVED( X ) \ 72 friend class Private; \ 73 inline Private * d_func(); \ 74 inline const Private * d_func() const; \ 75 explicit inline X( Private * ); \ 80 #if defined(_MSC_VER) && _MSC_VER <= 1300 81 #define KDGANTT_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType ) \ 84 friend class Private; \ 86 inline Private * d_func(); \ 87 inline const Private * d_func() const; \ 88 explicit inline X( Private *, ParentType ); \ 92 #define KDGANTT_DECLARE_PRIVATE_DERIVED_PARENT( X, ParentType ) \ 95 friend class Private; \ 96 inline Private * d_func(); \ 97 inline const Private * d_func() const; \ 98 explicit inline X( Private *, ParentType ); \ 103 #define KDGANTT_DECLARE_PRIVATE_DERIVED_QWIDGET( X ) \ 104 KDGANTT_DECLARE_PRIVATE_DERIVED_PARENT( X, QWidget* ) 106 #define KDGANTT_DECLARE_PRIVATE_BASE_VALUE( X ) \ 108 inline void swap( X & other ) { qSwap( _d, other._d ); } \ 111 friend class Private; \ 112 Private * d_func() { return _d; } \ 113 const Private * d_func() const { return _d; } \ 118 #if defined(_MSC_VER) && _MSC_VER <= 1300 119 #define KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \ 122 friend class Private; \ 124 Private * d_func() { return _d; } \ 125 const Private * d_func() const { return _d; } \ 126 explicit inline X( Private * ); \ 131 #define KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC( X ) \ 134 friend class Private; \ 135 Private * d_func() { return _d; } \ 136 const Private * d_func() const { return _d; } \ 137 explicit inline X( Private * ); \ 143 #if defined(_MSC_VER) && _MSC_VER <= 1300 144 #define KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \ 147 friend class Private; \ 149 Private * d_func() { return _d; } \ 150 const Private * d_func() const { return _d; } \ 151 explicit inline X( Private *, QWidget* ); \ 156 #define KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET( X ) \ 159 friend class Private; \ 160 Private * d_func() { return _d; } \ 161 const Private * d_func() const { return _d; } \ 162 explicit inline X( Private *, QWidget* ); \ 175 #include <QtAlgorithms> 178 #define KDGANTT_DECLARE_SWAP_SPECIALISATION( X ) \ 180 template <> inline void qSwap<X>( X & lhs, X & rhs ) \ 181 { lhs.swap( rhs ); } \ 184 template <> inline void swap<X>( X & lhs, X & rhs ) \ 185 { lhs.swap( rhs ); } \ 188 #define KDGANTT_DECLARE_SWAP_SPECIALISATION( X ) \ 190 template <> inline void qSwap<X>( X & lhs, X & rhs ) \ 191 { lhs.swap( rhs ); } \ 195 #define KDGANTT_DECLARE_SWAP_SPECIALISATION_DERIVED( X ) \ 196 KDGANTT_DECLARE_SWAP_SPECIALISATION( X ) 198 #define KDGANTT_DECLARE_SWAP_BASE( X ) \ 200 void doSwap( X& other ) \ 201 { qSwap( _d, other._d); } 203 #define KDGANTT_DECLARE_SWAP_DERIVED( X ) \ 204 void swap( X& other ) { doSwap( other ); } 206 #if defined(Q_OS_WIN) && defined(QT_DLL) 207 #if defined(_MSC_VER) && _MSC_VER >= 1300 238 inline Span() : m_start( -1 ), m_length( 0 ) {}
239 inline Span( qreal start, qreal length ) : m_start( start ), m_length( length ) {}
240 inline Span(
const Span& other ) : m_start(other.m_start), m_length(other.m_length) {}
242 inline Span&
operator=(
const Span& other ) { m_start=other.m_start; m_length=other.m_length;
return *
this; }
244 inline void setStart( qreal start ) { m_start=start; }
245 inline qreal
start()
const {
return m_start; }
246 inline void setEnd( qreal end ) { m_length = m_start-end; }
247 inline qreal
end()
const {
return m_start+m_length; }
249 inline void setLength( qreal length ) { m_length=length; }
250 inline qreal
length()
const {
return m_length; }
252 inline bool isValid()
const {
return m_start >= 0.;}
255 return m_start == other.m_start && m_length == other.m_length;
258 const qreal new_start = qMin(start(),other.
start());
259 return Span( new_start, (end()<other.
end())?other.
end()-new_start:end()-new_start);
272 DateTimeSpan(
const QDateTime& start,
const QDateTime& end );
278 inline void setStart(
const QDateTime& start ) { m_start=start; }
279 inline QDateTime
start()
const {
return m_start; }
281 inline void setEnd(
const QDateTime& end ) { m_end=end; }
282 inline QDateTime
end()
const {
return m_end; }
284 bool isValid()
const;
295 #ifndef QT_NO_DEBUG_STREAM
void setStart(qreal start)
Span(qreal start, qreal length)
bool operator==(const DateTimeSpan &s1, const DateTimeSpan &s2)
T & __kdab__dereference_for_methodcall(T &o)
bool equals(const Span &other) const
QDebug KDGANTT_EXPORT operator<<(QDebug dbg, KDGantt::ItemDataRole r)
A class representing a start point and a length.
QT_BEGIN_NAMESPACE Q_DECLARE_TYPEINFO(KDGantt::Span, Q_MOVABLE_TYPE)
Span & operator=(const Span &other)
void setLength(qreal length)
void setEnd(const QDateTime &end)
Span expandedTo(const Span &other) const
bool operator!=(const DateTimeSpan &s1, const DateTimeSpan &s2)
void setStart(const QDateTime &start)
bool equals(const DateTimeSpan &other) const