KD Chart 2  [rev.2.7]
kdganttconstraint.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2020 Klaralvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Chart library.
5 **
6 ** Licensees holding valid commercial KD Chart licenses may use this file in
7 ** accordance with the KD Chart Commercial License Agreement provided with
8 ** the Software.
9 **
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU General Public License version 2 and version 3 as published by the
13 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** Contact info@kdab.com if any conditions of this licensing are not
19 ** clear to you.
20 **
21 **********************************************************************/
22 
23 #ifndef KDGANTTCONSTRAINT_H
24 #define KDGANTTCONSTRAINT_H
25 
26 #include <QMap>
27 #include <QModelIndex>
28 #include <QObject>
29 #include <QSharedDataPointer>
30 #include <QVariant>
31 
32 #include "kdganttglobal.h"
33 #ifndef QT_NO_DEBUG_STREAM
34 #include <QDebug>
35 #endif
36 
37 namespace KDGantt {
38  class KDGANTT_EXPORT Constraint {
39  class Private;
40  public:
41  enum Type
42  {
43  TypeSoft = 0,
44  TypeHard = 1
45  };
47  {
48  FinishStart = 0,
49  FinishFinish = 1,
50  StartStart = 2,
51  StartFinish = 3
52  };
53 
55  {
56  ValidConstraintPen = Qt::UserRole,
57  InvalidConstraintPen
58  };
59 
61 
62  Constraint();
63  Constraint( const QModelIndex& idx1,
64  const QModelIndex& idx2,
65  Type type=TypeSoft,
66  RelationType relType=FinishStart,
67  const DataMap& datamap=DataMap() );
68  Constraint( const Constraint& other);
69  ~Constraint();
70 
71  Type type() const;
72  RelationType relationType() const;
73  QModelIndex startIndex() const;
74  QModelIndex endIndex() const;
75 
76  void setData( int role, const QVariant& value );
77  QVariant data( int role ) const;
78 
79  void setDataMap( const QMap< int, QVariant >& datamap );
80  QMap< int, QVariant > dataMap() const;
81 
82  bool compareIndexes(const Constraint& other) const;
83 
84  Constraint& operator=( const Constraint& other );
85  bool operator==( const Constraint& other ) const;
86 
87  inline bool operator!=( const Constraint& other ) const {
88  return !operator==( other );
89  }
90 
91  uint hash() const;
92 #ifndef QT_NO_DEBUG_STREAM
93  QDebug debug( QDebug dbg) const;
94 #endif
95 
96  private:
97  QSharedDataPointer<Private> d;
98  };
99 
100  inline uint qHash( const Constraint& c ) {return c.hash();}
101 }
102 
103 #ifndef QT_NO_DEBUG_STREAM
104 QDebug KDGANTT_EXPORT operator<<( QDebug dbg, const KDGantt::Constraint& c );
105 #endif /* QT_NO_DEBUG_STREAM */
106 
107 #endif /* KDGANTTCONSTRAINT_H */
108 
bool operator==(const Span &s1, const Span &s2)
QDebug KDGANTT_EXPORT operator<<(QDebug dbg, const KDGantt::Constraint &c)
A class used to represent a dependency.
bool operator!=(const Constraint &other) const
uint qHash(const Constraint &c)
QMap< int, QVariant > DataMap

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/