KGantt::Constraint

Search for usage in LXR

KGantt::Constraint Class Reference

#include <kganttconstraint.h>

Public Types

enum  ConstraintDataRole { ValidConstraintPen = Qt::UserRole, InvalidConstraintPen }
 
typedef QMap< int, QVariantDataMap
 
enum  RelationType { FinishStart = 0, FinishFinish = 1, StartStart = 2, StartFinish = 3 }
 
enum  Type { TypeSoft = 0, TypeHard = 1 }
 

Public Member Functions

 Constraint ()
 
 Constraint (const QModelIndex &idx1, const QModelIndex &idx2, Type type=TypeSoft, RelationType relType=FinishStart, const DataMap &datamap=DataMap())
 
 Constraint (const Constraint &other)
 
 ~Constraint ()
 
bool compareIndexes (const Constraint &other) const
 
QVariant data (int role) const
 
QMap< int, QVariantdataMap () const
 
QDebug debug (QDebug dbg) const
 
QModelIndex endIndex () const
 
uint hash () const
 
bool operator!= (const Constraint &other) const
 
Constraintoperator= (const Constraint &other)
 
bool operator== (const Constraint &other) const
 
RelationType relationType () const
 
void setData (int role, const QVariant &value)
 
void setDataMap (const QMap< int, QVariant > &datamap)
 
QModelIndex startIndex () const
 
Type type () const
 

Detailed Description

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 34 of file kganttconstraint.h.

Constructor & Destructor Documentation

Constraint::Constraint ( )

Default constructor, created an invalid constraint.

Definition at line 48 of file kganttconstraint.cpp.

Constraint::Constraint ( const QModelIndex idx1,
const QModelIndex idx2,
Constraint::Type  type = TypeSoft,
Constraint::RelationType  relationType = FinishStart,
const DataMap datamap = DataMap() 
)

Constructor. Creates a dependency for idx2 on idx1.

Parameters
typecontrols 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.

Parameters
relationTypedefines how the tasks depends on each other. relationType can be FinishStart (default), FinishFinish, StartStart or StartFinish.

Definition at line 33 of file kganttconstraint.cpp.

Constraint::Constraint ( const Constraint other)

Copy-Constructor.

Definition at line 53 of file kganttconstraint.cpp.

Constraint::~Constraint ( )

Destructor

Definition at line 58 of file kganttconstraint.cpp.

Member Function Documentation

QVariant Constraint::data ( int  role) const
Returns
The data associated with this index for the specified role.
Parameters
roleThe role to fetch the data for.
See also
ConstraintDataRole

Definition at line 88 of file kganttconstraint.cpp.

QMap< int, QVariant > Constraint::dataMap ( ) const
Returns
all the data set on this constraint.
See also
setDataMap

Definition at line 103 of file kganttconstraint.cpp.

QModelIndex Constraint::endIndex ( ) const
Returns
The constrained index

Definition at line 83 of file kganttconstraint.cpp.

uint Constraint::hash ( ) const

Definition at line 120 of file kganttconstraint.cpp.

Constraint & Constraint::operator= ( const Constraint other)

Assignment operator.

Definition at line 62 of file kganttconstraint.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 114 of file kganttconstraint.cpp.

Constraint::RelationType Constraint::relationType ( ) const

This is unused for now.

Definition at line 73 of file kganttconstraint.cpp.

void Constraint::setData ( int  role,
const QVariant value 
)

Set data on this index for the specified role.

Parameters
roleThe role to set the data for.
valueThe data to set on the index.
See also
ConstraintDataRole

Definition at line 93 of file kganttconstraint.cpp.

void Constraint::setDataMap ( const QMap< int, QVariant > &  datamap)

Set data on this constraint to the keys/values in datamap. Clears any existing data from the constraint.

Definition at line 98 of file kganttconstraint.cpp.

QModelIndex Constraint::startIndex ( ) const
Returns
The dependency index

Definition at line 78 of file kganttconstraint.cpp.

Constraint::Type Constraint::type ( ) const

This is unused for now.

Definition at line 68 of file kganttconstraint.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Nov 29 2021 22:32:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.