KD Chart API Documentation 3.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
KDGantt::Constraint Class Reference

A class used to represent a dependency. More...

#include <kdganttconstraint.h>

Public Types

enum  ConstraintDataRole { ValidConstraintPen = Qt::UserRole , InvalidConstraintPen }
 Data roles used when specifying the pen to draw constraints with. More...
 
enum  RelationType { FinishStart = 0 , FinishFinish = 1 , StartStart = 2 , StartFinish = 3 }
 
enum  Type { TypeSoft = 0 , TypeHard = 1 }
 This enum is unused for now. More...
 

Public Member Functions

 Constraint ()
 Default constructor, created an invalid constraint.
 
 Constraint (const Constraint &other)
 Copy-Constructor.
 
 Constraint (const QModelIndex &idx1, const QModelIndex &idx2, Type type=TypeSoft, RelationType relType=FinishStart, const DataMap &datamap=DataMap())
 Constructor.
 
 ~Constraint ()
 Destructor.
 
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)
 Assignment operator.
 
bool operator== (const Constraint &other) const
 Compare two Constraint objects.
 
RelationType relationType () const
 This is unused for now.
 
void setData (int role, const QVariant &value)
 Set data on this index for the specified role.
 
void setDataMap (const QMap< int, QVariant > &datamap)
 Set data on this constraint to the keys/values in datamap.
 
QModelIndex startIndex () const
 
Type type () const
 This is unused for now.
 

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 28 of file kdganttconstraint.h.

Member Enumeration Documentation

◆ ConstraintDataRole

Data roles used when specifying the pen to draw constraints with.

See also
setData
Enumerator
ValidConstraintPen 
InvalidConstraintPen 

Definition at line 46 of file kdganttconstraint.h.

◆ RelationType

Enumerator
FinishStart 
FinishFinish 
StartStart 
StartFinish 

Definition at line 38 of file kdganttconstraint.h.

◆ Type

This enum is unused for now.

Enumerator
TypeSoft 
TypeHard 

Definition at line 33 of file kdganttconstraint.h.

Constructor & Destructor Documentation

◆ Constraint() [1/3]

Constraint::Constraint ( )

Default constructor, created an invalid constraint.

Definition at line 79 of file kdganttconstraint.cpp.

◆ Constraint() [2/3]

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 63 of file kdganttconstraint.cpp.

References QSharedDataPointer::data(), QModelIndex::isValid(), relationType(), and type().

◆ Constraint() [3/3]

Constraint::Constraint ( const Constraint other)

Copy-Constructor.

Definition at line 85 of file kdganttconstraint.cpp.

◆ ~Constraint()

Constraint::~Constraint ( )

Destructor.

Definition at line 91 of file kdganttconstraint.cpp.

Member Function Documentation

◆ compareIndexes()

bool Constraint::compareIndexes ( const Constraint other) const

◆ data()

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 130 of file kdganttconstraint.cpp.

References QSharedDataPointer::data().

Referenced by KDGantt::ConstraintGraphicsItem::ganttToolTip().

◆ dataMap()

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

Definition at line 155 of file kdganttconstraint.cpp.

References QSharedDataPointer::data().

Referenced by KDGantt::ConstraintModel::addConstraint(), and KDGantt::ConstraintGraphicsItem::proxyConstraint().

◆ debug()

QDebug Constraint::debug ( QDebug  dbg) const

Definition at line 189 of file kdganttconstraint.cpp.

References QSharedDataPointer::data().

Referenced by operator<<().

◆ endIndex()

QModelIndex Constraint::endIndex ( ) const

◆ hash()

uint Constraint::hash ( ) const

Definition at line 177 of file kdganttconstraint.cpp.

References KDGantt::qHash().

Referenced by KDGantt::qHash().

◆ operator!=()

bool KDGantt::Constraint::operator!= ( const Constraint other) const
inline

Definition at line 77 of file kdganttconstraint.h.

◆ operator=()

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

Assignment operator.

Definition at line 96 of file kdganttconstraint.cpp.

◆ operator==()

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 169 of file kdganttconstraint.cpp.

◆ relationType()

Constraint::RelationType Constraint::relationType ( ) const

◆ setData()

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 140 of file kdganttconstraint.cpp.

References QSharedDataPointer::data().

◆ setDataMap()

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 148 of file kdganttconstraint.cpp.

References QSharedDataPointer::data().

◆ startIndex()

QModelIndex Constraint::startIndex ( ) const

◆ type()

Constraint::Type Constraint::type ( ) const

This is unused for now.

Definition at line 103 of file kdganttconstraint.cpp.

Referenced by Constraint(), KDAB_SCOPED_UNITTEST_SIMPLE(), and KDGantt::ConstraintGraphicsItem::proxyConstraint().


The documentation for this class was generated from the following files:

© 2001 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-chart/
Generated on Fri Apr 26 2024 00:04:58 for KD Chart API Documentation by doxygen 1.9.8