KD Chart 2 [rev.2.4]
|
00001 /**************************************************************************** 00002 ** Copyright (C) 2001-2012 Klaralvdalens Datakonsult AB. All rights reserved. 00003 ** 00004 ** This file is part of the KD Chart library. 00005 ** 00006 ** Licensees holding valid commercial KD Chart licenses may use this file in 00007 ** accordance with the KD Chart Commercial License Agreement provided with 00008 ** the Software. 00009 ** 00010 ** 00011 ** This file may be distributed and/or modified under the terms of the 00012 ** GNU General Public License version 2 and version 3 as published by the 00013 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included. 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 ** Contact info@kdab.com if any conditions of this licensing are not 00019 ** clear to you. 00020 ** 00021 **********************************************************************/ 00022 00023 #ifndef KDGANTTCONSTRAINTMODEL_H 00024 #define KDGANTTCONSTRAINTMODEL_H 00025 00026 #include <QModelIndex> 00027 #include <QDebug> 00028 00029 #include "kdganttglobal.h" 00030 #include "kdganttconstraint.h" 00031 00032 namespace KDGantt { 00033 class KDGANTT_EXPORT ConstraintModel : public QObject { 00034 Q_OBJECT 00035 KDGANTT_DECLARE_PRIVATE_DERIVED_PARENT( ConstraintModel, QObject* ) 00036 public: 00037 explicit ConstraintModel( QObject* parent=0 ); 00038 virtual ~ConstraintModel(); 00039 00040 virtual void addConstraint( const Constraint& c ); 00041 virtual bool removeConstraint( const Constraint& c ); 00042 00043 void clear(); 00044 void cleanup(); 00045 00046 QList<Constraint> constraints() const; 00047 00048 bool hasConstraint( const Constraint& c ) const; 00049 inline bool hasConstraint( const QModelIndex& s, 00050 const QModelIndex& e ) const; 00051 00052 QList<Constraint> constraintsForIndex( const QModelIndex& ) const; 00053 00054 Q_SIGNALS: 00055 void constraintAdded(const KDGantt::Constraint&); 00056 void constraintRemoved(const KDGantt::Constraint&); 00057 00058 private: 00059 Private* _d; 00060 }; 00061 00062 inline const ConstraintModel::Private* ConstraintModel::d_func() const { return _d; } 00063 inline ConstraintModel::Private* ConstraintModel::d_func() { return _d; } 00064 inline bool ConstraintModel::hasConstraint( const QModelIndex& s, const QModelIndex& e ) const { 00065 return hasConstraint( Constraint( s, e ) ); 00066 } 00067 } 00068 00069 #ifndef QT_NO_DEBUG_STREAM 00070 #include <QDebug> 00071 00072 QDebug KDGANTT_EXPORT operator<<( QDebug dbg, const KDGantt::ConstraintModel& model ); 00073 inline QDebug KDGANTT_EXPORT operator<<( QDebug dbg, KDGantt::ConstraintModel* model ) 00074 { 00075 return operator<<(dbg,*model); 00076 } 00077 00078 #endif /* QT_NO_DEBUG_STREAM */ 00079 00080 #endif /* KDGANTTCONSTRAINTMODEL_H */ 00081