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 KDGANTTITEMDELEGATE_H
26 #define KDGANTTITEMDELEGATE_H
28 #include <QItemDelegate>
33 #include "kdgantt_export.h"
34 #include "kdganttglobal.h"
37 class StyleOptionGanttItem
;
39 class KDGANTT_EXPORT ItemDelegate
: public QItemDelegate
{
41 KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC( ItemDelegate
)
43 enum InteractionState
{ State_None
= 0,
50 explicit ItemDelegate( QObject
* parent
= 0 );
51 virtual ~ItemDelegate();
53 void setDefaultBrush( ItemType type
, const QBrush
& brush
);
54 QBrush
defaultBrush( ItemType type
) const;
56 void setDefaultPen( ItemType type
, const QPen
& pen
);
57 QPen
defaultPen( ItemType type
) const;
59 virtual Span
itemBoundingSpan(const StyleOptionGanttItem
& opt
, const QModelIndex
& idx
) const;
60 virtual QRectF
constraintBoundingRect( const QPointF
& start
, const QPointF
& end
) const;
61 virtual InteractionState
interactionStateFor( const QPointF
& pos
,
62 const StyleOptionGanttItem
& opt
,
63 const QModelIndex
& idx
) const;
65 virtual void paintGanttItem( QPainter
* p
, const StyleOptionGanttItem
& opt
, const QModelIndex
& idx
);
66 virtual void paintConstraintItem( QPainter
* p
, const QStyleOptionGraphicsItem
& opt
,
67 const QPointF
& start
, const QPointF
& end
, const QPen
& pen
);
71 #ifndef QT_NO_DEBUG_STREAM
72 QDebug
operator<<( QDebug dbg
, KDGantt::ItemDelegate::InteractionState
);
75 #endif /* KDGANTTITEMDELEGATE_H */