1
/* This file is part of the KDE project
2
Copyright (C) 2008 Dag Andersen <danders@get2net.dk>
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.
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.
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.
20
#ifndef KPTGANTTITEMDELEGATE_H
21
#define KPTGANTTITEMDELEGATE_H
23
#include "kplatoui_export.h"
25
#include <KGanttGlobal>
27
#include <KGanttItemDelegate>
33
class StyleOptionGanttItem;
44
class KPLATOUI_EXPORT GanttItemDelegate : public KGantt::ItemDelegate
48
explicit GanttItemDelegate(QObject *parent = 0);
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 );
54
virtual void paintConstraintItem( QPainter* p, const QStyleOptionGraphicsItem& opt, const QPointF& start, const QPointF& end, const KGantt::Constraint &constraint );
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;
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;
70
bool showPositiveFloat;
71
bool showNegativeFloat;
72
bool showCriticalPath;
73
bool showCriticalTasks;
74
bool showAppointments;
75
bool showNoInformation;
76
bool showTimeConstraint;
77
bool showSchedulingError;
80
void paintSpecialItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx, int typ );
83
QBrush m_criticalBrush;
84
QBrush m_schedulingErrorBrush;
87
Q_DISABLE_COPY(GanttItemDelegate)
91
class KPLATOUI_EXPORT ResourceGanttItemDelegate : public KGantt::ItemDelegate
95
explicit ResourceGanttItemDelegate(QObject *parent = 0);
97
QVariant data( const QModelIndex& idx, int column, int role = Qt::DisplayRole ) const;
99
virtual void paintGanttItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx );
102
void paintResourceItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx );
105
Q_DISABLE_COPY(ResourceGanttItemDelegate)
106
QBrush m_overloadBrush;
107
QBrush m_underloadBrush;
111
} // namespace KPlato