File indexing completed on 2024-05-12 15:54:27
0001 /* 0002 * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved. 0003 * 0004 * This file is part of the KGantt library. 0005 * 0006 * This program is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU General Public License as 0008 * published by the Free Software Foundation; either version 2 of 0009 * the License, or (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 * GNU General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program. If not, see <https://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef KGANTTGRAPHICSVIEW_P_H 0021 #define KGANTTGRAPHICSVIEW_P_H 0022 0023 #include "kganttgraphicsview.h" 0024 #include "kganttgraphicsscene.h" 0025 #include "kganttdatetimegrid.h" 0026 0027 #include <QPointer> 0028 0029 namespace KGantt { 0030 class HeaderWidget : public QWidget { 0031 Q_OBJECT 0032 public: 0033 explicit HeaderWidget( GraphicsView* parent ); 0034 virtual ~HeaderWidget(); 0035 0036 GraphicsView* view() const { return qobject_cast<GraphicsView*>( parent() );} 0037 0038 public Q_SLOTS: 0039 void scrollTo( int ); 0040 protected: 0041 /*reimp*/ bool event( QEvent* ev ) override; 0042 /*reimp*/ void paintEvent( QPaintEvent* ev ) override; 0043 /*reimp*/ void mousePressEvent(QMouseEvent *event) override; 0044 /*reimp*/ void mouseReleaseEvent(QMouseEvent *event) override; 0045 /*reimp*/ void mouseMoveEvent(QMouseEvent *event) override; 0046 /*reimp*/ void wheelEvent(QWheelEvent *event) override; 0047 /*reimp*/ void contextMenuEvent( QContextMenuEvent* ev ) override; 0048 private: 0049 qreal m_offset; 0050 DateTimeGrid::HeaderType m_headerType; 0051 int m_mousePosX; 0052 }; 0053 0054 class Q_DECL_HIDDEN GraphicsView::Private { 0055 Q_DISABLE_COPY( Private ) 0056 public: 0057 explicit Private(GraphicsView* _q); 0058 ~Private(); 0059 0060 void updateHeaderGeometry(); 0061 0062 void slotGridChanged(); 0063 void slotHorizontalScrollValueChanged( int val ); 0064 0065 /* slots for QAbstractItemModel signals */ 0066 void slotColumnsInserted( const QModelIndex& parent, int start, int end ); 0067 void slotColumnsRemoved( const QModelIndex& parent, int start, int end ); 0068 void slotDataChanged( const QModelIndex& topLeft, const QModelIndex& bottomRight ); 0069 void slotLayoutChanged(); 0070 void slotModelReset(); 0071 void slotRowsInserted( const QModelIndex& parent, int start, int end ); 0072 void slotRowsAboutToBeRemoved( const QModelIndex& parent, int start, int end ); 0073 void slotRowsRemoved( const QModelIndex& parent, int start, int end ); 0074 0075 void slotItemClicked( const QModelIndex& idx ); 0076 void slotItemDoubleClicked( const QModelIndex& idx ); 0077 0078 void slotHeaderContextMenuRequested( const QPoint& pt ); 0079 0080 void removeConstraintsRecursive( QAbstractProxyModel *summaryModel, const QModelIndex& index ); 0081 0082 GraphicsView* q; 0083 AbstractRowController* rowcontroller; 0084 HeaderWidget headerwidget; 0085 GraphicsScene scene; 0086 }; 0087 } 0088 0089 #endif /* KGANTTGRAPHICSVIEW_P_H */ 0090