KD Chart API Documentation  3.1
Signals | Public Member Functions | List of all members
KDGantt::ConstraintModel Class Reference

The ConstraintModel keeps track of the interdependencies between gantt items in a View. More...

#include <kdganttconstraintmodel.h>

Inheritance diagram for KDGantt::ConstraintModel:

Signals

void constraintAdded (const KDGantt::Constraint &)
 
void constraintRemoved (const KDGantt::Constraint &)
 

Public Member Functions

 ConstraintModel (QObject *parent=nullptr)
 Constructor. More...
 
 ~ConstraintModel () override
 Destroys this ConstraintModel. More...
 
virtual void addConstraint (const Constraint &c)
 Adds the constraint c to this ConstraintModel If the Constraint c is already in this ConstraintModel, nothing happens. More...
 
void cleanup ()
 Not used. More...
 
void clear ()
 Removes all Constraints from this model The signal constraintRemoved(const Constraint&) is emitted for every Constraint that is removed. More...
 
QList< Constraintconstraints () const
 
QList< ConstraintconstraintsForIndex (const QModelIndex &) const
 
bool hasConstraint (const Constraint &c) const
 Returns true if a Constraint with start s and end e exists, otherwise false. More...
 
bool hasConstraint (const QModelIndex &s, const QModelIndex &e) const
 
virtual bool removeConstraint (const Constraint &c)
 Removes the Constraint c from this ConstraintModel. More...
 

Detailed Description

The ConstraintModel keeps track of the interdependencies between gantt items in a View.

Definition at line 21 of file kdganttconstraintmodel.h.

Constructor & Destructor Documentation

◆ ConstraintModel()

ConstraintModel::ConstraintModel ( QObject *  parent = nullptr)
explicit

Constructor.

Creates an empty ConstraintModel with parent parent

Definition at line 61 of file kdganttconstraintmodel.cpp.

◆ ~ConstraintModel()

ConstraintModel::~ConstraintModel ( )
override

Destroys this ConstraintModel.

Definition at line 77 of file kdganttconstraintmodel.cpp.

Member Function Documentation

◆ addConstraint()

void ConstraintModel::addConstraint ( const Constraint c)
virtual

Adds the constraint c to this ConstraintModel If the Constraint c is already in this ConstraintModel, nothing happens.

Subclassing ConstraintModel and overriding addConstraint() and removeConstraint() can provide re-entrancy issues in the ConstraintModel<->ConstraintProxy interaction. Therefore it is recommended to better subclass GraphicsView and override addConstraint() there.

Definition at line 108 of file kdganttconstraintmodel.cpp.

References constraintAdded(), d, KDGantt::Constraint::dataMap(), KDGantt::Constraint::endIndex(), removeConstraint(), and KDGantt::Constraint::startIndex().

Referenced by KDGantt::GraphicsView::addConstraint(), and KDAB_SCOPED_UNITTEST_SIMPLE().

◆ cleanup()

void ConstraintModel::cleanup ( )

◆ clear()

void ConstraintModel::clear ( )

Removes all Constraints from this model The signal constraintRemoved(const Constraint&) is emitted for every Constraint that is removed.

Definition at line 161 of file kdganttconstraintmodel.cpp.

References constraints(), and removeConstraint().

◆ constraintAdded

void KDGantt::ConstraintModel::constraintAdded ( const KDGantt::Constraint )
signal

◆ constraintRemoved

void KDGantt::ConstraintModel::constraintRemoved ( const KDGantt::Constraint )
signal

◆ constraints()

QList< Constraint > ConstraintModel::constraints ( ) const
Returns
A list of all Constraints in this ConstraintModel.

Definition at line 185 of file kdganttconstraintmodel.cpp.

References d.

Referenced by clear(), KDAB_SCOPED_UNITTEST_SIMPLE(), and operator<<().

◆ constraintsForIndex()

QList< Constraint > ConstraintModel::constraintsForIndex ( const QModelIndex &  idx) const
Returns
A list of all Constraints in this ConstraintModel that have an endpoint at idx.

Definition at line 194 of file kdganttconstraintmodel.cpp.

References d, KDGantt::Constraint::endIndex(), and KDGantt::Constraint::startIndex().

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

◆ hasConstraint() [1/2]

bool ConstraintModel::hasConstraint ( const Constraint c) const

Returns true if a Constraint with start s and end e exists, otherwise false.

Definition at line 221 of file kdganttconstraintmodel.cpp.

References KDGantt::Constraint::compareIndexes(), and d.

Referenced by KDGantt::GraphicsView::addConstraint(), hasConstraint(), and KDAB_SCOPED_UNITTEST_SIMPLE().

◆ hasConstraint() [2/2]

bool KDGantt::ConstraintModel::hasConstraint ( const QModelIndex &  s,
const QModelIndex &  e 
) const
inline

Definition at line 64 of file kdganttconstraintmodel.h.

References hasConstraint().

◆ removeConstraint()

bool ConstraintModel::removeConstraint ( const Constraint c)
virtual

Removes the Constraint c from this ConstraintModel.

If c was found and removed, the signal constraintRemoved(const Constraint&) is emitted.

Returns
If c was found and removed, it returns true, otherwise it returns false.

Definition at line 137 of file kdganttconstraintmodel.cpp.

References KDGantt::Constraint::compareIndexes(), constraintRemoved(), d, KDGantt::Constraint::endIndex(), and KDGantt::Constraint::startIndex().

Referenced by addConstraint(), KDGantt::GraphicsView::addConstraint(), clear(), and KDAB_SCOPED_UNITTEST_SIMPLE().


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 by doxygen 1.9.1