KD Chart API Documentation  3.1
kdganttconstraintmodel.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** This file is part of the KD Chart library.
4 **
5 ** SPDX-FileCopyrightText: 2001 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6 **
7 ** SPDX-License-Identifier: MIT
8 **
9 ****************************************************************************/
10 
11 #ifndef KDGANTTCONSTRAINTMODEL_H
12 #define KDGANTTCONSTRAINTMODEL_H
13 
14 #include <QDebug>
15 #include <QModelIndex>
16 
17 #include "kdganttconstraint.h"
18 #include "kdganttglobal.h"
19 
20 namespace KDGantt {
21 class KDGANTT_EXPORT ConstraintModel : public QObject
22 {
23  Q_OBJECT
25 public:
26  explicit ConstraintModel(QObject *parent = nullptr);
27  ~ConstraintModel() override;
28 
34  virtual void addConstraint(const Constraint &c);
35  virtual bool removeConstraint(const Constraint &c);
36 
37  void clear();
38  void cleanup();
39 
40  QList<Constraint> constraints() const;
41 
42  bool hasConstraint(const Constraint &c) const;
43  inline bool hasConstraint(const QModelIndex &s,
44  const QModelIndex &e) const;
45 
46  QList<Constraint> constraintsForIndex(const QModelIndex &) const;
47 
48 Q_SIGNALS:
51 
52 private:
53  Private *_d;
54 };
55 
56 inline const ConstraintModel::Private *ConstraintModel::d_func() const
57 {
58  return _d;
59 }
60 inline ConstraintModel::Private *ConstraintModel::d_func()
61 {
62  return _d;
63 }
64 inline bool ConstraintModel::hasConstraint(const QModelIndex &s, const QModelIndex &e) const
65 {
66  return hasConstraint(Constraint(s, e));
67 }
68 }
69 
70 #ifndef QT_NO_DEBUG_STREAM
71 #include <QDebug>
72 
73 QDebug KDGANTT_EXPORT operator<<(QDebug dbg, const KDGantt::ConstraintModel &model);
74 inline QDebug operator<<(QDebug dbg, KDGantt::ConstraintModel *model)
75 {
76  return operator<<(dbg, *model);
77 }
78 
79 #endif /* QT_NO_DEBUG_STREAM */
80 
81 #endif /* KDGANTTCONSTRAINTMODEL_H */
The ConstraintModel keeps track of the interdependencies between gantt items in a View.
bool hasConstraint(const Constraint &c) const
Returns true if a Constraint with start s and end e exists, otherwise false.
void constraintRemoved(const KDGantt::Constraint &)
void constraintAdded(const KDGantt::Constraint &)
A class used to represent a dependency.
QDebug KDGANTT_EXPORT operator<<(QDebug dbg, const KDGantt::ConstraintModel &model)
Contains KDGantt macros.
#define KDGANTT_DECLARE_PRIVATE_DERIVED_PARENT(X, ParentType)
Definition: kdganttglobal.h:87

© 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