KD Chart 2
[rev.2.5]
|
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 QT_BEGIN_NAMESPACE 00031 class QAbstractItemModel; 00032 class QAbstractProxyModel; 00033 class QAbstractItemView; 00034 class QItemSelectionModel; 00035 class QPrinter; 00036 class QSplitter; 00037 QT_END_NAMESPACE 00038 00039 namespace KDGantt { 00040 class ItemDelegate; 00041 class Constraint; 00042 class ConstraintModel; 00043 class AbstractGrid; 00044 class GraphicsView; 00045 class AbstractRowController; 00046 00047 class KDGANTT_EXPORT View : public QWidget { 00048 Q_OBJECT 00049 KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC_QWIDGET(View) 00050 Q_PRIVATE_SLOT( d, void slotCollapsed(const QModelIndex&) ) 00051 Q_PRIVATE_SLOT( d, void slotExpanded(const QModelIndex&) ) 00052 Q_PRIVATE_SLOT( d, void slotVerticalScrollValueChanged( int ) ) 00053 Q_PRIVATE_SLOT( d, void slotLeftWidgetVerticalRangeChanged( int, int ) ) 00054 Q_PRIVATE_SLOT( d, void slotGfxViewVerticalRangeChanged( int, int ) ) 00055 00056 public: 00057 00058 explicit View(QWidget* parent=0); 00059 virtual ~View(); 00060 00061 QAbstractItemModel* model() const; 00062 QItemSelectionModel* selectionModel() const; 00063 ItemDelegate* itemDelegate() const; 00064 ConstraintModel* constraintModel() const; 00065 AbstractGrid* grid() const; 00066 QModelIndex rootIndex() const; 00067 00068 QModelIndex indexAt( const QPoint& pos ) const; 00069 00070 void setLeftView( QAbstractItemView* ); 00071 const QAbstractItemView* leftView() const; 00072 QAbstractItemView* leftView(); 00073 00074 const QSplitter* splitter() const; 00075 QSplitter* splitter(); 00076 00077 void setRowController( AbstractRowController* ); 00078 AbstractRowController* rowController(); 00079 const AbstractRowController* rowController() const; 00080 00081 void setGraphicsView( GraphicsView* ); 00082 const GraphicsView* graphicsView() const; 00083 GraphicsView* graphicsView(); 00084 const QAbstractProxyModel* ganttProxyModel() const; 00085 QAbstractProxyModel* ganttProxyModel(); 00086 00087 void ensureVisible(const QModelIndex& index); 00088 00089 void print( QPrinter* printer, bool drawRowLabels=true, bool drawColumnLabels=true ); 00090 void print( QPrinter* printer, qreal start, qreal end, bool drawRowLabels=true, bool drawColumnLabels=true ); 00091 void print( QPainter* painter, const QRectF& target = QRectF(), bool drawRowLabels=true, bool drawColumnLabels=true); 00092 void print( QPainter* painter, qreal start, qreal end, 00093 const QRectF& target = QRectF(), bool drawRowLabels=true, bool drawColumnLabels=true); 00094 00095 public Q_SLOTS: 00096 void setModel(QAbstractItemModel* model); 00097 void setRootIndex( const QModelIndex& idx ); 00098 void setSelectionModel( QItemSelectionModel* smodel ); 00099 void setItemDelegate( ItemDelegate* ); 00100 void setConstraintModel( ConstraintModel* ); 00101 void setGrid( AbstractGrid* ); 00102 void expandAll( QModelIndex index = QModelIndex() ); 00103 void collapseAll( QModelIndex index = QModelIndex() ); 00104 00105 protected: 00106 /*reimp*/ void resizeEvent(QResizeEvent*); 00107 }; 00108 } 00109 00110 #endif /* KDGANTTVIEW_H */