File indexing completed on 2024-05-12 15:54:29

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 KGANTTVIEW_P_H
0021 #define KGANTTVIEW_P_H
0022 
0023 #include "kganttview.h"
0024 #include "kganttgraphicsscene.h"
0025 #include "kgantttreeviewrowcontroller.h"
0026 #include "kganttconstraintmodel.h"
0027 #include "kganttconstraintproxy.h"
0028 
0029 #include "kganttgraphicsview.h"
0030 #include "kganttdatetimegrid.h"
0031 
0032 #include "kganttproxymodel.h"
0033 
0034 #include <QSplitter>
0035 #include <QTreeView>
0036 #include <QGraphicsView>
0037 #include <QModelIndex>
0038 #include <QPointer>
0039 
0040 QT_BEGIN_NAMESPACE
0041 class QAbstractProxyModel;
0042 class QGraphicsView;
0043 class QGraphicsScene;
0044 class QGraphicsRectItem;
0045 QT_END_NAMESPACE
0046 
0047 namespace KGantt {
0048     class GraphicsItem;
0049     class KGanttTreeView;
0050 
0051     /*! \internal */
0052     class KGanttTreeView : public QTreeView {
0053         Q_OBJECT
0054     public:
0055         explicit KGanttTreeView( QAbstractProxyModel* proxy, QWidget* parent = nullptr );
0056         virtual ~KGanttTreeView();
0057 
0058         AbstractRowController* rowController() { return &m_controller; }
0059 
0060     public Q_SLOTS:
0061         void expandAll(QModelIndex index = QModelIndex());
0062         void collapseAll(QModelIndex index = QModelIndex());
0063 
0064     private:
0065         TreeViewRowController m_controller;
0066     };
0067 
0068     /*! \internal */
0069     class Q_DECL_HIDDEN View::Private {
0070     public:
0071         explicit Private(View*);
0072         virtual ~Private();
0073 
0074         void init();
0075 
0076         GraphicsItem* createItem( ItemType type ) const;
0077 
0078         void updateScene();
0079 
0080         void setupGraphicsView();
0081 
0082         // slots
0083         void slotCollapsed(const QModelIndex&);
0084         void slotExpanded(const QModelIndex&);
0085         void slotVerticalScrollValueChanged( int );
0086         void slotLeftWidgetVerticalRangeChanged( int, int );
0087         void slotGfxViewVerticalRangeChanged( int, int );
0088 
0089         View* q;
0090 
0091         QSplitter splitter;
0092 
0093         /* TODO: Refine/subclass */
0094         //KGanttTreeView treeview;
0095         QPointer<QAbstractItemView> leftWidget;
0096         AbstractRowController* rowController;
0097         QPointer<GraphicsView> gfxview;
0098         //KGanttHeaderWidget headerwidget;
0099 
0100         QPointer<QAbstractItemModel> model;
0101         ProxyModel ganttProxyModel;
0102         //KGanttTreeViewRowController rowController;
0103         ConstraintModel mappedConstraintModel;
0104         ConstraintProxy constraintProxy;
0105     };
0106 
0107 }
0108 #endif /* KGANTTVIEW_P_H */
0109