kdgantt
kdganttgraphicsview.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KDGANTTGRAPHICSVIEW_H
00024 #define KDGANTTGRAPHICSVIEW_H
00025
00026 #include <QGraphicsView>
00027
00028 #include "kdganttglobal.h"
00029
00030 class QModelIndex;
00031 class QAbstractItemModel;
00032 class QAbstractProxyModel;
00033 class QItemSelectionModel;
00034
00035 namespace KDGantt {
00036 class AbstractRowController;
00037 class AbstractGrid;
00038 class GraphicsItem;
00039 class ConstraintModel;
00040 class ItemDelegate;
00041
00042 class KDGANTT_EXPORT GraphicsView : public QGraphicsView {
00043 Q_OBJECT
00044 KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC(GraphicsView)
00045
00046 Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
00047
00048 Q_PRIVATE_SLOT( d, void slotGridChanged() )
00049 Q_PRIVATE_SLOT( d, void slotHorizontalScrollValueChanged( int ) )
00050
00051 Q_PRIVATE_SLOT( d, void slotColumnsInserted( const QModelIndex& parent, int start, int end ) )
00052 Q_PRIVATE_SLOT( d, void slotColumnsRemoved( const QModelIndex& parent, int start, int end ) )
00053 Q_PRIVATE_SLOT( d, void slotDataChanged( const QModelIndex& topLeft, const QModelIndex& bottomRight ) )
00054 Q_PRIVATE_SLOT( d, void slotLayoutChanged() )
00055 Q_PRIVATE_SLOT( d, void slotModelReset() )
00056 Q_PRIVATE_SLOT( d, void slotRowsInserted( const QModelIndex& parent, int start, int end ) )
00057 Q_PRIVATE_SLOT( d, void slotRowsAboutToBeRemoved( const QModelIndex& parent, int start, int end ) )
00058 Q_PRIVATE_SLOT( d, void slotRowsRemoved( const QModelIndex& parent, int start, int end ) )
00059
00060 Q_PRIVATE_SLOT( d, void slotItemClicked( const QModelIndex& idx ) )
00061 Q_PRIVATE_SLOT( d, void slotItemDoubleClicked( const QModelIndex& idx ) )
00062 public:
00063
00064 explicit GraphicsView( QWidget* parent=0 );
00065 virtual ~GraphicsView();
00066
00067 QAbstractItemModel* model() const;
00068 QAbstractProxyModel* summaryHandlingModel() const;
00069 ConstraintModel* constraintModel() const;
00070 QModelIndex rootIndex() const;
00071 QItemSelectionModel* selectionModel() const;
00072 AbstractRowController* rowController() const;
00073 AbstractGrid* grid() const;
00074 ItemDelegate* itemDelegate() const;
00075
00076 bool isReadOnly() const;
00077
00078 QModelIndex indexAt( const QPoint& pos ) const;
00079
00080 virtual void addConstraint( const QModelIndex& from,
00081 const QModelIndex& to,
00082 Qt::KeyboardModifiers modifiers );
00083
00084 void clearItems();
00085 void updateRow( const QModelIndex& );
00086 void updateScene();
00087 void updateSceneRect();
00088 void deleteSubtree( const QModelIndex& );
00089
00090 void print( QPainter* painter, const QRectF& target = QRectF(), const QRectF& source = QRectF(), bool drawRowLabels=true, bool drawHeader=true );
00091 QRectF printRect(bool drawRowLabels=true );
00092 void renderHeader( QPainter* painter, const QRectF& target, const QRectF& source, Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio );
00093 qreal headerHeight() const;
00094
00095 public Q_SLOTS:
00096 void setModel( QAbstractItemModel* );
00097 void setSummaryHandlingModel( QAbstractProxyModel* model );
00098 void setConstraintModel( ConstraintModel* );
00099 void setRootIndex( const QModelIndex& );
00100 void setSelectionModel( QItemSelectionModel* );
00101 void setRowController( AbstractRowController* );
00102 void setGrid( AbstractGrid* );
00103 void setItemDelegate( ItemDelegate* delegate );
00104 void setReadOnly( bool );
00105
00106 Q_SIGNALS:
00107 void activated( const QModelIndex & index );
00108 void clicked( const QModelIndex & index );
00109 void doubleClicked( const QModelIndex & index );
00110 void entered( const QModelIndex & index );
00111 void pressed( const QModelIndex & index );
00112
00113 protected:
00114 void resizeEvent( QResizeEvent* );
00115 private:
00116 friend class View;
00117
00118 GraphicsItem* createItem( ItemType type ) const;
00119 };
00120 }
00121
00122 #endif
00123