~ubuntu-branches/debian/sid/calligraplan/sid

« back to all changes in this revision

Viewing changes to src/libs/ui/kptganttitemdelegate.h

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2018-02-01 18:20:19 UTC
  • Revision ID: package-import@ubuntu.com-20180201182019-1qo7qaim5wejm5k9
Tags: upstream-3.1.0
ImportĀ upstreamĀ versionĀ 3.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
  Copyright (C) 2008 Dag Andersen <danders@get2net.dk>
 
3
 
 
4
  This library is free software; you can redistribute it and/or
 
5
  modify it under the terms of the GNU Library General Public
 
6
  License as published by the Free Software Foundation; either
 
7
  version 2 of the License, or (at your option) any later version.
 
8
 
 
9
  This library is distributed in the hope that it will be useful,
 
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
  Library General Public License for more details.
 
13
 
 
14
  You should have received a copy of the GNU Library General Public License
 
15
  along with this library; see the file COPYING.LIB.  If not, write to
 
16
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
  Boston, MA 02110-1301, USA.
 
18
*/
 
19
 
 
20
#ifndef KPTGANTTITEMDELEGATE_H
 
21
#define KPTGANTTITEMDELEGATE_H
 
22
 
 
23
#include "kplatoui_export.h"
 
24
 
 
25
#include <KGanttGlobal>
 
26
 
 
27
#include <KGanttItemDelegate>
 
28
 
 
29
#include <QBrush>
 
30
 
 
31
namespace KGantt
 
32
{
 
33
    class StyleOptionGanttItem;
 
34
    class Constraint;
 
35
}
 
36
 
 
37
class QPainter;
 
38
class QModelIndex;
 
39
 
 
40
 
 
41
namespace KPlato
 
42
{
 
43
 
 
44
class KPLATOUI_EXPORT GanttItemDelegate : public KGantt::ItemDelegate
 
45
{
 
46
    Q_OBJECT
 
47
public:
 
48
    explicit GanttItemDelegate(QObject *parent = 0);
 
49
 
 
50
    virtual QString toolTip( const QModelIndex& idx ) const;
 
51
    virtual KGantt::Span itemBoundingSpan( const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ) const;
 
52
    virtual void paintGanttItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx );
 
53
    
 
54
    virtual void paintConstraintItem( QPainter* p, const QStyleOptionGraphicsItem& opt, const QPointF& start, const QPointF& end, const KGantt::Constraint &constraint );
 
55
 
 
56
    QVariant data( const QModelIndex& idx, int column, int role = Qt::DisplayRole ) const;
 
57
    QString itemText( const QModelIndex& idx, int type ) const;
 
58
    QRectF itemPositiveFloatRect( const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ) const;
 
59
    QRectF itemNegativeFloatRect( const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ) const;
 
60
 
 
61
    bool hasStartConstraint( const QModelIndex& idx ) const;
 
62
    bool hasEndConstraint( const QModelIndex& idx ) const;
 
63
    QRectF itemStartConstraintRect( const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ) const;
 
64
    QRectF itemEndConstraintRect( const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ) const;
 
65
 
 
66
    bool showResources;
 
67
    bool showTaskName;
 
68
    bool showTaskLinks;
 
69
    bool showProgress;
 
70
    bool showPositiveFloat;
 
71
    bool showNegativeFloat;
 
72
    bool showCriticalPath;
 
73
    bool showCriticalTasks;
 
74
    bool showAppointments;
 
75
    bool showNoInformation;
 
76
    bool showTimeConstraint;
 
77
    bool showSchedulingError;
 
78
 
 
79
protected:
 
80
    void paintSpecialItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx, int typ );
 
81
 
 
82
protected:
 
83
    QBrush m_criticalBrush;
 
84
    QBrush m_schedulingErrorBrush;
 
85
 
 
86
private:
 
87
    Q_DISABLE_COPY(GanttItemDelegate)
 
88
 
 
89
};
 
90
 
 
91
class KPLATOUI_EXPORT ResourceGanttItemDelegate : public KGantt::ItemDelegate
 
92
{
 
93
    Q_OBJECT
 
94
public:
 
95
    explicit ResourceGanttItemDelegate(QObject *parent = 0);
 
96
 
 
97
    QVariant data( const QModelIndex& idx, int column, int role = Qt::DisplayRole ) const;
 
98
 
 
99
    virtual void paintGanttItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx );
 
100
 
 
101
protected:
 
102
    void paintResourceItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx );
 
103
 
 
104
private:
 
105
    Q_DISABLE_COPY(ResourceGanttItemDelegate)
 
106
    QBrush m_overloadBrush;
 
107
    QBrush m_underloadBrush;
 
108
 
 
109
};
 
110
 
 
111
} // namespace KPlato
 
112
 
 
113
#endif