KD Chart 2
[rev.2.5]
|
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 00045 virtual void addConstraint( const Constraint& c ); 00046 virtual bool removeConstraint( const Constraint& c ); 00047 00048 void clear(); 00049 void cleanup(); 00050 00051 QList<Constraint> constraints() const; 00052 00053 bool hasConstraint( const Constraint& c ) const; 00054 inline bool hasConstraint( const QModelIndex& s, 00055 const QModelIndex& e ) const; 00056 00057 QList<Constraint> constraintsForIndex( const QModelIndex& ) const; 00058 00059 Q_SIGNALS: 00060 void constraintAdded(const KDGantt::Constraint&); 00061 void constraintRemoved(const KDGantt::Constraint&); 00062 00063 private: 00064 Private* _d; 00065 }; 00066 00067 inline const ConstraintModel::Private* ConstraintModel::d_func() const { return _d; } 00068 inline ConstraintModel::Private* ConstraintModel::d_func() { return _d; } 00069 inline bool ConstraintModel::hasConstraint( const QModelIndex& s, const QModelIndex& e ) const { 00070 return hasConstraint( Constraint( s, e ) ); 00071 } 00072 } 00073 00074 #ifndef QT_NO_DEBUG_STREAM 00075 #include <QDebug> 00076 00077 QDebug KDCHART_EXPORT operator<<( QDebug dbg, const KDGantt::ConstraintModel& model ); 00078 inline QDebug KDCHART_EXPORT operator<<( QDebug dbg, KDGantt::ConstraintModel* model ) 00079 { 00080 return operator<<(dbg,*model); 00081 } 00082 00083 #endif /* QT_NO_DEBUG_STREAM */ 00084 00085 #endif /* KDGANTTCONSTRAINTMODEL_H */ 00086