KD Chart 2 [rev.2.4]
|
00001 /**************************************************************************** 00002 ** Copyright (C) 2001-2012 Klaralvdalens Datakonsult AB. All rights reserved. 00003 ** 00004 ** This file is part of the KD Chart library. 00005 ** 00006 ** Licensees holding valid commercial KD Chart licenses may use this file in 00007 ** accordance with the KD Chart Commercial License Agreement provided with 00008 ** the Software. 00009 ** 00010 ** 00011 ** This file may be distributed and/or modified under the terms of the 00012 ** GNU General Public License version 2 and version 3 as published by the 00013 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included. 00014 ** 00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 ** 00018 ** Contact info@kdab.com if any conditions of this licensing are not 00019 ** clear to you. 00020 ** 00021 **********************************************************************/ 00022 00023 #ifndef KDGANTTVIEW_H 00024 #define KDGANTTVIEW_H 00025 00026 #include <QWidget> 00027 #include <QModelIndex> 00028 #include "kdganttglobal.h" 00029 00030 class QAbstractItemModel; 00031 class QAbstractProxyModel; 00032 class QAbstractItemView; 00033 class QItemSelectionModel; 00034 class QPrinter; 00035 class QSplitter; 00036 00037 namespace KDGantt { 00038 class ItemDelegate; 00039 class Constraint; 00040 class ConstraintModel; 00041 class AbstractGrid; 00042 class GraphicsView; 00043 class AbstractRowController; 00044 00045 class KDGANTT_EXPORT View : public QWidget { 00046 Q_OBJECT 00047 KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET(View) 00048 Q_PRIVATE_SLOT( d, void slotCollapsed(const QModelIndex&) ) 00049 Q_PRIVATE_SLOT( d, void slotExpanded(const QModelIndex&) ) 00050 Q_PRIVATE_SLOT( d, void slotVerticalScrollValueChanged( int ) ) 00051 Q_PRIVATE_SLOT( d, void slotLeftWidgetVerticalRangeChanged( int, int ) ) 00052 Q_PRIVATE_SLOT( d, void slotGfxViewVerticalRangeChanged( int, int ) ) 00053 00054 public: 00055 00056 explicit View(QWidget* parent=0); 00057 virtual ~View(); 00058 00059 QAbstractItemModel* model() const; 00060 QItemSelectionModel* selectionModel() const; 00061 ItemDelegate* itemDelegate() const; 00062 ConstraintModel* constraintModel() const; 00063 AbstractGrid* grid() const; 00064 QModelIndex rootIndex() const; 00065 00066 QModelIndex indexAt( const QPoint& pos ) const; 00067 00068 void setLeftView( QAbstractItemView* ); 00069 const QAbstractItemView* leftView() const; 00070 QAbstractItemView* leftView(); 00071 00072 const QSplitter* splitter() const; 00073 QSplitter* splitter(); 00074 00075 void setRowController( AbstractRowController* ); 00076 AbstractRowController* rowController(); 00077 const AbstractRowController* rowController() const; 00078 00079 void setGraphicsView( GraphicsView* ); 00080 const GraphicsView* graphicsView() const; 00081 GraphicsView* graphicsView(); 00082 const QAbstractProxyModel* ganttProxyModel() const; 00083 QAbstractProxyModel* ganttProxyModel(); 00084 00085 void ensureVisible(const QModelIndex& index); 00086 00087 void print( QPrinter* printer, bool drawRowLabels=true ); 00088 void print( QPrinter* printer, qreal start, qreal end, bool drawRowLabels=true ); 00089 void print( QPainter* painter, const QRectF& target = QRectF(), bool drawRowLabels=true); 00090 void print( QPainter* painter, qreal start, qreal end, 00091 const QRectF& target = QRectF(), bool drawRowLabels=true); 00092 00093 public Q_SLOTS: 00094 void setModel(QAbstractItemModel* model); 00095 void setRootIndex( const QModelIndex& idx ); 00096 void setSelectionModel( QItemSelectionModel* smodel ); 00097 void setItemDelegate( ItemDelegate* ); 00098 void setConstraintModel( ConstraintModel* ); 00099 void setGrid( AbstractGrid* ); 00100 void expandAll( QModelIndex index = QModelIndex() ); 00101 void collapseAll( QModelIndex index = QModelIndex() ); 00102 00103 protected: 00104 /*reimp*/ void resizeEvent(QResizeEvent*); 00105 }; 00106 } 00107 00108 #endif /* KDGANTTVIEW_H */