14DateTimeSpan::DateTimeSpan()
23DateTimeSpan::DateTimeSpan(
const DateTimeSpan& other )
28DateTimeSpan::~DateTimeSpan()
32DateTimeSpan& DateTimeSpan::operator=(
const DateTimeSpan& other )
34 if (
this != &other ) {
35 m_start = other.m_start;
41bool DateTimeSpan::isValid()
const
46bool DateTimeSpan::equals(
const DateTimeSpan& other )
const
48 return m_start==other.m_start && m_end==other.m_end;
51#ifndef QT_NO_DEBUG_STREAM
61 default: dbg << static_cast<Qt::ItemDataRole>(r);
69 case KGantt::TypeNone: dbg <<
"KGantt::TypeNone";
break;
70 case KGantt::TypeEvent: dbg <<
"KGantt::TypeEvent";
break;
71 case KGantt::TypeTask: dbg <<
"KGantt::TypeTask";
break;
72 case KGantt::TypeSummary: dbg <<
"KGantt::TypeSummary";
break;
73 case KGantt::TypeMulti: dbg <<
"KGantt::TypeMulti";
break;
74 case KGantt::TypeUser: dbg <<
"KGantt::TypeUser";
break;
75 default: dbg << static_cast<int>(t);
82 dbg <<
"KGantt::Span[ start="<<s.start()<<
" length="<<s.length()<<
"]";
87 dbg <<
"KGantt::DateTimeSpan[ start="<<s.start()<<
" end="<<s.end()<<
"]";
93#ifndef KDAB_NO_UNIT_TESTS
97static std::ostream&
operator<<( std::ostream& os,
const Span& span )
99 os <<
"Span[ start="<<span.start()<<
", length="<<span.length()<<
"]";
103static std::ostream&
operator<<( std::ostream& os,
const DateTimeSpan& span )
115#include "unittest/test.h"
117KDAB_SCOPED_UNITTEST_SIMPLE(
KGantt,
Span,
"test" ) {
119 assertFalse( s1.isValid() );
123 Span s2( s1.start(), s1.length() );
124 assertEqual( s1, s2 );
127KDAB_SCOPED_UNITTEST_SIMPLE(
KGantt, DateTimeSpan,
"test" ) {
129 assertFalse( s1.isValid() );
135 DateTimeSpan s2( dt, dt.
addDays( 1 ) );
137 assertEqual( s1, s2 );
141 assertNotEqual( s1, s3 );
A class representing a start point and a length.
Q_SCRIPTABLE Q_NOREPLY void start()
@ ItemTypeRole
The item type.
@ StartTimeRole
Start time (or other start value) for a gantt item.
@ TaskCompletionRole
Task completion percentage used by Task items. Should be an integer og a qreal between 0 and 100.
@ LegendRole
The Legend text.
@ EndTimeRole
End time (or other end value) for a gantt item.
const QList< QKeySequence > & end()
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
const char * constData() const const
QDateTime addDays(qint64 ndays) const const
QDateTime currentDateTime()
bool isValid() const const
QString toString(QStringView format, QCalendar cal) const const
QByteArray toLatin1() const const
std::string toStdString() const const