Fix infinite refreshing, due to initial setCheckState triggering slotItemChanged
[kdepim.git] / kdgantt2 / kdganttlegend.h
blob07cc931a37e629ce31d6a5eef04ae8e03ca03276
1 /****************************************************************************
2 ** Copyright (C) 2001-2006 Klarälvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Gantt library.
5 **
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
13 ** the Software.
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 KDGANTTLEGEND_H
26 #define KDGANTTLEGEND_H
28 #include <QAbstractItemView>
30 #include "kdganttglobal.h"
31 #include "kdganttstyleoptionganttitem.h"
33 namespace KDGantt
35 class KDGANTT_EXPORT Legend : public QAbstractItemView
37 Q_OBJECT
38 KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC( Legend )
39 public:
40 explicit Legend( QWidget* parent = 0 );
41 virtual ~Legend();
43 /*reimp*/ QModelIndex indexAt( const QPoint& point ) const;
44 /*reimp*/ QRect visualRect( const QModelIndex& index ) const;
46 /*reimp*/ void scrollTo( const QModelIndex&, ScrollHint = EnsureVisible ){}
48 /*reimp*/ QSize sizeHint() const;
49 /*reimp*/ QSize minimumSizeHint() const;
51 /*reimp*/ void setModel( QAbstractItemModel* model );
53 protected:
54 virtual QRect drawItem( QPainter* painter, const QModelIndex& index, const QPoint& pos = QPoint() ) const;
55 virtual QSize measureItem( const QModelIndex& index, bool recursive = true ) const;
56 virtual StyleOptionGanttItem getStyleOption( const QModelIndex& index ) const;
58 /*reimp*/ void paintEvent( QPaintEvent* event );
60 /*reimp*/ int horizontalOffset() const { return 0; }
61 /*reimp*/ bool isIndexHidden( const QModelIndex& ) const { return false; }
62 /*reimp*/ QModelIndex moveCursor( CursorAction, Qt::KeyboardModifiers ) { return QModelIndex(); }
63 /*reimp*/ void setSelection( const QRect&, QItemSelectionModel::SelectionFlags ){}
64 /*reimp*/ int verticalOffset() const { return 0; }
65 /*reimp*/ QRegion visualRegionForSelection( const QItemSelection& ) const { return QRegion(); }
67 protected Q_SLOTS:
68 virtual void modelDataChanged();
72 #endif