kdganttconstraint.h

Go to the documentation of this file.
00001 /****************************************************************************
00002  ** Copyright (C) 2001-2006 Klarälvdalens Datakonsult AB.  All rights reserved.
00003  **
00004  ** This file is part of the KD Gantt library.
00005  **
00006  ** This file may be distributed and/or modified under the terms of the
00007  ** GNU General Public License version 2 as published by the Free Software
00008  ** Foundation and appearing in the file LICENSE.GPL included in the
00009  ** packaging of this file.
00010  **
00011  ** Licensees holding valid commercial KD Gantt licenses may use this file in
00012  ** accordance with the KD Gantt Commercial License Agreement provided with
00013  ** the Software.
00014  **
00015  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017  **
00018  ** See http://www.kdab.net/kdgantt for
00019  **   information about KD Gantt Commercial License Agreements.
00020  **
00021  ** Contact info@kdab.net if any conditions of this
00022  ** licensing are not clear to you.
00023  **
00024  **********************************************************************/
00025 #ifndef KDGANTTCONSTRAINT_H
00026 #define KDGANTTCONSTRAINT_H
00027 
00028 #include <QModelIndex>
00029 #include <QObject>
00030 #include <QSharedDataPointer>
00031 
00032 #include "../kdchart_export.h"
00033 #ifndef QT_NO_DEBUG_STREAM
00034 #include <QDebug>
00035 #endif
00036 
00037 namespace KDGantt {
00038     class KDCHART_EXPORT Constraint {
00039         class Private;
00040     public:
00041         enum Type
00042         { 
00043             TypeSoft = 0, 
00044             TypeHard = 1
00045         };      
00046         enum RelationType
00047         { 
00048             FinishStart = 0,
00049             FinishFinish = 1,
00050             StartStart = 2,
00051             StartFinish = 3
00052         };
00053 
00054         enum ConstraintDataRole
00055         {
00056             ValidConstraintPen = Qt::UserRole,
00057             InvalidConstraintPen
00058         };
00059 
00060         Constraint( const QModelIndex& idx1,  const QModelIndex& idx2, Type type=TypeSoft, RelationType=FinishStart );
00061         Constraint( const Constraint& other);
00062         ~Constraint();
00063 
00064         Type type() const;
00065         RelationType relationType() const;
00066         QModelIndex startIndex() const;
00067         QModelIndex endIndex() const;
00068 
00069         void setData( int role, const QVariant& value );
00070         QVariant data( int role ) const;
00071 
00072         Constraint& operator=( const Constraint& other );
00073 
00074         bool operator==( const Constraint& other ) const;
00075 
00076         inline bool operator!=( const Constraint& other ) const {
00077             return !operator==( other );
00078         }
00079 
00080         uint hash() const;
00081 #ifndef QT_NO_DEBUG_STREAM
00082         QDebug debug( QDebug dbg) const;
00083 #endif
00084 
00085     private:
00086         QSharedDataPointer<Private> d;
00087     };
00088 
00089     inline uint qHash( const Constraint& c ) {return c.hash();}
00090 }
00091 
00092 #ifndef QT_NO_DEBUG_STREAM
00093 QDebug operator<<( QDebug dbg, const KDGantt::Constraint& c );
00094 #endif /* QT_NO_DEBUG_STREAM */
00095 
00096 #endif /* KDGANTTCONSTRAINT_H */
00097 

Generated on Thu Mar 4 23:19:13 2010 for KD Chart 2 by  doxygen 1.5.4