kdgantt
kdganttconstraint.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KDGANTTCONSTRAINT_H
00024 #define KDGANTTCONSTRAINT_H
00025
00026 #include <QModelIndex>
00027 #include <QObject>
00028 #include <QSharedDataPointer>
00029
00030 #include "kdgantt_export.h"
00031 #ifndef QT_NO_DEBUG_STREAM
00032 #include <QDebug>
00033 #endif
00034
00035 namespace KDGantt {
00036 class KDGANTT_EXPORT Constraint {
00037 class Private;
00038 public:
00039 enum Type
00040 {
00041 TypeSoft = 0,
00042 TypeHard = 1
00043 };
00044 enum RelationType
00045 {
00046 FinishStart = 0,
00047 FinishFinish = 1,
00048 StartStart = 2,
00049 StartFinish = 3
00050 };
00051
00052 enum ConstraintDataRole
00053 {
00054 ValidConstraintPen = Qt::UserRole,
00055 InvalidConstraintPen
00056 };
00057
00058 Constraint( const QModelIndex& idx1, const QModelIndex& idx2, Type type=TypeSoft, RelationType=FinishStart );
00059 Constraint( const Constraint& other);
00060 ~Constraint();
00061
00062 Type type() const;
00063 RelationType relationType() const;
00064 QModelIndex startIndex() const;
00065 QModelIndex endIndex() const;
00066
00067 void setData( int role, const QVariant& value );
00068 QVariant data( int role ) const;
00069
00070 Constraint& operator=( const Constraint& other );
00071
00072 bool operator==( const Constraint& other ) const;
00073
00074 inline bool operator!=( const Constraint& other ) const {
00075 return !operator==( other );
00076 }
00077
00078 uint hash() const;
00079 #ifndef QT_NO_DEBUG_STREAM
00080 QDebug debug( QDebug dbg) const;
00081 #endif
00082
00083 private:
00084 QSharedDataPointer<Private> d;
00085 };
00086
00087 inline uint qHash( const Constraint& c ) {return c.hash();}
00088 }
00089
00090 #ifndef QT_NO_DEBUG_STREAM
00091 QDebug operator<<( QDebug dbg, const KDGantt::Constraint& c );
00092 #endif
00093
00094 #endif
00095