1 /****************************************************************************
2 ** Copyright (C) 2001-2006 Klarälvdalens Datakonsult AB. All rights reserved.
4 ** This file is part of the KD Gantt library.
6 ** This file may be distributed and/or modified under the terms of the
7 ** GNU General Public License version 2 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.GPL included in the
9 ** packaging of this file.
11 ** Licensees holding valid commercial KD Gantt licenses may use this file in
12 ** accordance with the KD Gantt Commercial License Agreement provided with
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 ** See http://www.kdab.net/kdgantt for
19 ** information about KD Gantt Commercial License Agreements.
21 ** Contact info@kdab.net if any conditions of this
22 ** licensing are not clear to you.
24 **********************************************************************/
25 #ifndef KDGANTTCONSTRAINTMODEL_H
26 #define KDGANTTCONSTRAINTMODEL_H
28 #include <QModelIndex>
31 #include "kdganttglobal.h"
32 #include "kdganttconstraint.h"
35 class KDGANTT_EXPORT ConstraintModel
: public QObject
{
37 KDGANTT_DECLARE_PRIVATE_DERIVED_PARENT( ConstraintModel
, QObject
* )
39 explicit ConstraintModel( QObject
* parent
=0 );
40 virtual ~ConstraintModel();
42 void addConstraint( const Constraint
& c
);
43 bool removeConstraint( const Constraint
& c
);
48 QList
<Constraint
> constraints() const;
50 bool hasConstraint( const Constraint
& c
) const;
51 inline bool hasConstraint( const QModelIndex
& s
,
52 const QModelIndex
& e
) const;
54 QList
<Constraint
> constraintsForIndex( const QModelIndex
& ) const;
57 void constraintAdded(const Constraint
&);
58 void constraintRemoved(const Constraint
&);
64 inline const ConstraintModel::Private
* ConstraintModel::d_func() const { return _d
; }
65 inline ConstraintModel::Private
* ConstraintModel::d_func() { return _d
; }
66 inline bool ConstraintModel::hasConstraint( const QModelIndex
& s
, const QModelIndex
& e
) const {
67 return hasConstraint( Constraint( s
, e
) );
71 #ifndef QT_NO_DEBUG_STREAM
74 QDebug
operator<<( QDebug dbg
, const KDGantt::ConstraintModel
& model
);
75 inline QDebug
operator<<( QDebug dbg
, KDGantt::ConstraintModel
* model
)
77 return operator<<(dbg
,*model
);
80 #endif /* QT_NO_DEBUG_STREAM */
82 #endif /* KDGANTTCONSTRAINTMODEL_H */