KD Chart API Documentation  3.1
kdganttconstraint.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 KDGANTTCONSTRAINT_H
12 #define KDGANTTCONSTRAINT_H
13 
14 #include <QMap>
15 #include <QModelIndex>
16 #include <QObject>
17 #include <QSharedDataPointer>
18 #include <QVariant>
19 
20 #include "kdganttglobal.h"
21 #ifndef QT_NO_DEBUG_STREAM
22 #include <QDebug>
23 #endif
24 
25 namespace KDGantt {
27 
28 class KDGANTT_EXPORT Constraint
29 {
30  class Private;
31 
32 public:
33  enum Type
34  {
35  TypeSoft = 0,
36  TypeHard = 1
37  };
39  {
40  FinishStart = 0,
41  FinishFinish = 1,
42  StartStart = 2,
43  StartFinish = 3
44  };
45 
47  {
48  ValidConstraintPen = Qt::UserRole,
49  InvalidConstraintPen
50  };
51 
52  Constraint();
53  Constraint(const QModelIndex &idx1,
54  const QModelIndex &idx2,
55  Type type = TypeSoft,
56  RelationType relType = FinishStart,
57  const DataMap &datamap = DataMap());
58  Constraint(const Constraint &other);
59  ~Constraint();
60 
61  Type type() const;
62  RelationType relationType() const;
63  QModelIndex startIndex() const;
64  QModelIndex endIndex() const;
65 
66  void setData(int role, const QVariant &value);
67  QVariant data(int role) const;
68 
69  void setDataMap(const QMap<int, QVariant> &datamap);
70  QMap<int, QVariant> dataMap() const;
71 
72  bool compareIndexes(const Constraint &other) const;
73 
74  Constraint &operator=(const Constraint &other);
75  bool operator==(const Constraint &other) const;
76 
77  inline bool operator!=(const Constraint &other) const
78  {
79  return !operator==(other);
80  }
81 
82  uint hash() const;
83 #ifndef QT_NO_DEBUG_STREAM
84  QDebug debug(QDebug dbg) const;
85 #endif
86 
87 private:
88  QSharedDataPointer<Private> d;
89 };
90 
91 inline uint qHash(const Constraint &c)
92 {
93  return c.hash();
94 }
95 }
96 
97 #ifndef QT_NO_DEBUG_STREAM
98 QDebug KDGANTT_EXPORT operator<<(QDebug dbg, const KDGantt::Constraint &c);
99 #endif /* QT_NO_DEBUG_STREAM */
100 
101 #endif /* KDGANTTCONSTRAINT_H */
A class used to represent a dependency.
Type
This enum is unused for now.
bool operator!=(const Constraint &other) const
ConstraintDataRole
Data roles used when specifying the pen to draw constraints with.
QDebug KDGANTT_EXPORT operator<<(QDebug dbg, const KDGantt::Constraint &c)
Contains KDGantt macros.
uint qHash(const Constraint &c)
bool operator==(const Span &s1, const Span &s2)
QMap< int, QVariant > DataMap

© 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