KD Chart 2
[rev.2.5.1]
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
src
KDGantt
kdganttconstraint.h
Go to the documentation of this file.
1
/****************************************************************************
2
** Copyright (C) 2001-2013 Klaralvdalens Datakonsult AB. All rights reserved.
3
**
4
** This file is part of the KD Chart library.
5
**
6
** Licensees holding valid commercial KD Chart licenses may use this file in
7
** accordance with the KD Chart Commercial License Agreement provided with
8
** the Software.
9
**
10
**
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 and version 3 as published by the
13
** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
14
**
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.
17
**
18
** Contact info@kdab.com if any conditions of this licensing are not
19
** clear to you.
20
**
21
**********************************************************************/
22
23
#ifndef KDGANTTCONSTRAINT_H
24
#define KDGANTTCONSTRAINT_H
25
26
#include <QMap>
27
#include <QModelIndex>
28
#include <QObject>
29
#include <QSharedDataPointer>
30
#include <QVariant>
31
32
#include "
kdganttglobal.h
"
33
#ifndef QT_NO_DEBUG_STREAM
34
#include <QDebug>
35
#endif
36
37
namespace
KDGantt {
38
class
KDGANTT_EXPORT
Constraint
{
39
class
Private;
40
public
:
41
enum
Type
42
{
43
TypeSoft = 0,
44
TypeHard = 1
45
};
46
enum
RelationType
47
{
48
FinishStart = 0,
49
FinishFinish = 1,
50
StartStart = 2,
51
StartFinish = 3
52
};
53
54
enum
ConstraintDataRole
55
{
56
ValidConstraintPen = Qt::UserRole,
57
InvalidConstraintPen
58
};
59
60
typedef
QMap<int, QVariant>
DataMap
;
61
62
Constraint
();
63
Constraint
(
const
QModelIndex& idx1,
64
const
QModelIndex& idx2,
65
Type
type=TypeSoft,
66
RelationType
relType=FinishStart,
67
const
DataMap
& datamap=
DataMap
() );
68
Constraint
(
const
Constraint
& other);
69
~
Constraint
();
70
71
Type
type()
const
;
72
RelationType
relationType()
const
;
73
QModelIndex startIndex()
const
;
74
QModelIndex endIndex()
const
;
75
76
void
setData(
int
role,
const
QVariant& value );
77
QVariant data(
int
role )
const
;
78
79
void
setDataMap(
const
QMap< int, QVariant >
& datamap );
80
QMap< int, QVariant >
dataMap()
const
;
81
82
bool
compareIndexes(
const
Constraint
& other)
const
;
83
84
Constraint
& operator=(
const
Constraint
& other );
85
bool
operator==
(
const
Constraint
& other )
const
;
86
87
inline
bool
operator!=
(
const
Constraint
& other )
const
{
88
return
!
operator==
( other );
89
}
90
91
uint hash()
const
;
92
#ifndef QT_NO_DEBUG_STREAM
93
QDebug debug( QDebug dbg)
const
;
94
#endif
95
96
private
:
97
QSharedDataPointer<Private>
d
;
98
};
99
100
inline
uint
qHash
(
const
Constraint
& c ) {
return
c.
hash
();}
101
}
102
103
#ifndef QT_NO_DEBUG_STREAM
104
QDebug KDCHART_EXPORT
operator<<
( QDebug dbg,
const
KDGantt::Constraint
& c );
105
#endif
/* QT_NO_DEBUG_STREAM */
106
107
#endif
/* KDGANTTCONSTRAINT_H */
108
Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-chart/