kdganttconstraintmodel.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 KDGANTTCONSTRAINTMODEL_H
00026 #define KDGANTTCONSTRAINTMODEL_H
00027 
00028 #include <QModelIndex>
00029 #include <QDebug>
00030 
00031 #include "kdganttglobal.h"
00032 #include "kdganttconstraint.h"
00033 
00034 namespace KDGantt {
00035     class KDCHART_EXPORT ConstraintModel : public QObject {
00036         Q_OBJECT
00037         KDGANTT_DECLARE_PRIVATE_DERIVED_PARENT( ConstraintModel, QObject* )
00038      public:
00039         explicit ConstraintModel( QObject* parent=0 );
00040         virtual ~ConstraintModel();
00041 
00042         void addConstraint( const Constraint& c );
00043         bool removeConstraint( const Constraint& c );
00044 
00045         void clear();
00046         void cleanup();
00047 
00048         QList<Constraint> constraints() const;
00049 
00050         bool hasConstraint( const Constraint& c ) const;
00051         inline bool hasConstraint( const QModelIndex& s, 
00052                                    const QModelIndex& e ) const;
00053 
00054         QList<Constraint> constraintsForIndex( const QModelIndex& ) const;
00055 
00056     Q_SIGNALS:
00057         void constraintAdded(const KDGantt::Constraint&);
00058         void constraintRemoved(const KDGantt::Constraint&);
00059 
00060     private:
00061         Private* _d;
00062     };
00063 
00064     inline const ConstraintModel::Private* ConstraintModel::d_func() const { return _d; }
00065     inline ConstraintModel::Private* ConstraintModel::d_func() { return _d; }
00066     inline bool ConstraintModel::hasConstraint( const QModelIndex& s, const QModelIndex& e ) const {
00067         return hasConstraint( Constraint( s, e ) );
00068     }
00069 }
00070 
00071 #ifndef QT_NO_DEBUG_STREAM
00072 #include <QDebug>
00073 
00074 QDebug operator<<( QDebug dbg, const KDGantt::ConstraintModel& model );
00075 inline QDebug operator<<( QDebug dbg, KDGantt::ConstraintModel* model ) 
00076 {
00077     return operator<<(dbg,*model);
00078 }
00079 
00080 #endif /* QT_NO_DEBUG_STREAM */
00081 
00082 #endif /* KDGANTTCONSTRAINTMODEL_H */
00083 

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