A class used to represent a dependency. More...
#include <kdganttconstraint.h>
Public Types | |
enum | ConstraintDataRole { ValidConstraintPen = Qt::UserRole, InvalidConstraintPen } |
enum | RelationType { FinishStart = 0, FinishFinish = 1, StartStart = 2, StartFinish = 3 } |
enum | Type { TypeSoft = 0, TypeHard = 1 } |
Public Member Functions | |
Constraint (const QModelIndex &idx1, const QModelIndex &idx2, Type type=TypeSoft, RelationType=FinishStart) | |
Constraint (const Constraint &other) | |
QVariant | data (int role) const |
QDebug | debug (QDebug dbg) const |
QModelIndex | endIndex () const |
uint | hash () const |
bool | operator!= (const Constraint &other) const |
Constraint & | operator= (const Constraint &other) |
bool | operator== (const Constraint &other) const |
RelationType | relationType () const |
void | setData (int role, const QVariant &value) |
QModelIndex | startIndex () const |
Type | type () const |
~Constraint () |
A class used to represent a dependency.
Instances of this class represent a dependency between the data items pointed to by a start-QModelIndex and an end-QModelIndex.
Definition at line 36 of file kdganttconstraint.h.
Data roles used when specifying the pen to draw constraints with.
Definition at line 52 of file kdganttconstraint.h.
Definition at line 44 of file kdganttconstraint.h.
This enum is unused for now.
Definition at line 39 of file kdganttconstraint.h.
Constraint::Constraint | ( | const QModelIndex & | idx1, | |
const QModelIndex & | idx2, | |||
Constraint::Type | type = TypeSoft , |
|||
Constraint::RelationType | relationType = FinishStart | |||
) |
Constructor. Creates a dependency for idx2 on idx1.
type | controls if the constraint is a soft one that is allowed to be broken (ie, go backwards in time) or a hard constraint that will not allow the user to move an item so that the constraint would have to go backwards. The default is TypeSoft. |
Actually enforcing hard constraints is the responsibility of the AbstractGrid subclass used in the view.
relationType | defines how the tasks depends on each other. relationType can be FinishStart (default), FinishFinish, StartStart or StartFinish. |
Definition at line 76 of file kdganttconstraint.cpp.
Constraint::Constraint | ( | const Constraint & | other | ) |
Copy-Constructor.
Definition at line 87 of file kdganttconstraint.cpp.
Constraint::~Constraint | ( | ) |
Destructor
Definition at line 93 of file kdganttconstraint.cpp.
QVariant Constraint::data | ( | int | role | ) | const |
role | The role to fetch the data for. |
Definition at line 132 of file kdganttconstraint.cpp.
Referenced by KDGantt::ConstraintGraphicsItem::ganttToolTip().
QDebug Constraint::debug | ( | QDebug | dbg | ) | const |
Definition at line 169 of file kdganttconstraint.cpp.
Referenced by operator<<().
QModelIndex Constraint::endIndex | ( | ) | const |
Definition at line 123 of file kdganttconstraint.cpp.
Referenced by KDGantt::ConstraintModel::addConstraint(), KDGantt::ConstraintModel::cleanup(), KDGantt::ConstraintModel::constraintsForIndex(), KDGantt::GraphicsScene::insertItem(), KDGantt::AbstractGrid::isSatisfiedConstraint(), KDGantt::DateTimeGrid::mapFromChart(), KDGantt::ConstraintGraphicsItem::proxyConstraint(), and KDGantt::ConstraintModel::removeConstraint().
uint Constraint::hash | ( | ) | const |
Definition at line 157 of file kdganttconstraint.cpp.
References KDGantt::qHash().
Referenced by KDGantt::qHash().
bool KDGantt::Constraint::operator!= | ( | const Constraint & | other | ) | const |
Definition at line 74 of file kdganttconstraint.h.
References KDGantt::operator==().
Constraint & Constraint::operator= | ( | const Constraint & | other | ) |
Assignment operator.
Definition at line 98 of file kdganttconstraint.cpp.
bool Constraint::operator== | ( | const Constraint & | other | ) | const |
Compare two Constraint objects. Two Constraints are equal if the have the same start and end indexes
Definition at line 150 of file kdganttconstraint.cpp.
Constraint::RelationType Constraint::relationType | ( | ) | const |
This is unused for now.
Definition at line 111 of file kdganttconstraint.cpp.
Referenced by KDGantt::ItemDelegate::constraintBoundingRect(), and KDGantt::ItemDelegate::paintConstraintItem().
void Constraint::setData | ( | int | role, | |
const QVariant & | value | |||
) |
Set data on this index for the specified role.
role | The role to set the data for. | |
value | The data to set on the index. |
Definition at line 142 of file kdganttconstraint.cpp.
QModelIndex Constraint::startIndex | ( | ) | const |
Definition at line 117 of file kdganttconstraint.cpp.
Referenced by KDGantt::ConstraintModel::addConstraint(), KDGantt::ConstraintModel::cleanup(), KDGantt::ConstraintModel::constraintsForIndex(), KDGantt::GraphicsScene::insertItem(), KDGantt::AbstractGrid::isSatisfiedConstraint(), KDGantt::DateTimeGrid::mapFromChart(), KDGantt::ConstraintGraphicsItem::proxyConstraint(), and KDGantt::ConstraintModel::removeConstraint().
Constraint::Type Constraint::type | ( | ) | const |
This is unused for now.
Definition at line 105 of file kdganttconstraint.cpp.
Referenced by KDAB_SCOPED_UNITTEST_SIMPLE(), KDGantt::DateTimeGrid::mapFromChart(), and KDGantt::ConstraintGraphicsItem::proxyConstraint().