24 #include "kdganttconstraint_p.h" 48 Constraint::Private::Private()
50 relationType( FinishStart )
54 Constraint::Private::Private(
const Private& other )
55 : QSharedData( other ),
59 relationType( other.relationType ),
78 const QModelIndex& idx2,
89 Q_ASSERT_X( idx1 != idx2 || !idx1.isValid(),
"Constraint::Constraint",
"cannot create a constraint with idx1 == idx2" );
125 return d->relationType;
146 return d->data.value( role );
156 d->data.insert( role, value );
178 && (d->end==other.
endIndex() || (!d->end.isValid() && !other.
endIndex().isValid()));
186 if ( d == other.d )
return true;
187 return ( *d ).equals( *( other.d ) );
196 #ifndef QT_NO_DEBUG_STREAM 200 return c.
debug( dbg );
205 dbg <<
"KDGantt::Constraint[ start=" << d->start <<
"end=" << d->end <<
"relationType=" << d->relationType <<
"], data=" << d->data;
211 #ifndef KDAB_NO_UNIT_TESTS 213 #include <QStandardItemModel> 219 QStandardItemModel dummyModel( 100, 100 );
220 QModelIndex idx1 = dummyModel.index( 7, 17, QModelIndex() );
221 QModelIndex idx2 = dummyModel.index( 42, 17, QModelIndex() );
243 dummyModel.removeRow( 8 );
QDebug debug(QDebug dbg) const
void setDataMap(const QMap< int, QVariant > &datamap)
void setData(int role, const QVariant &value)
bool operator==(const Constraint &other) const
QVariant data(int role) const
A class used to represent a dependency.
QDebug operator<<(QDebug dbg, const Constraint &c)
#define assertNotEqual(x, y)
KDAB_SCOPED_UNITTEST_SIMPLE(KDGantt, Constraint,"test")
RelationType relationType() const
Constraint & operator=(const Constraint &other)
QModelIndex endIndex() const
uint qHash(const Constraint &c)
QMap< int, QVariant > dataMap() const
bool compareIndexes(const Constraint &other) const
QModelIndex startIndex() const
#define assertEqual(x, y)