labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ProjectExplorer.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ProjectExplorer.cpp
3  Project : LabPlot
4  Description : A tree view for displaying and editing an AspectTreeModel.
5  --------------------------------------------------------------------
6  Copyright : (C) 2007-2008 by Tilman Benkert (thzs@gmx.net)
7  Copyright : (C) 2011-2016 Alexander Semke (alexander.semke@web.de)
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  * This program is distributed in the hope that it will be useful, *
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20  * GNU General Public License for more details. *
21  * *
22  * You should have received a copy of the GNU General Public License *
23  * along with this program; if not, write to the Free Software *
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
25  * Boston, MA 02110-1301 USA *
26  * *
27  ***************************************************************************/
28 #ifndef PROJECT_EXPLORER_H
29 #define PROJECT_EXPLORER_H
30 
31 #include <QWidget>
32 
33 class AbstractAspect;
34 class AspectTreeModel;
35 class Project;
36 class XmlStreamReader;
37 
38 class QFrame;
39 class QLabel;
40 class QLineEdit;
41 class QModelIndex;
42 class QToolButton;
43 class QSignalMapper;
44 class QTreeView;
45 class QXmlStreamWriter;
46 class QItemSelection;
47 class QMenu;
48 
49 class ProjectExplorer : public QWidget {
50  Q_OBJECT
51 
52 public:
53  explicit ProjectExplorer(QWidget* parent = nullptr);
54  ~ProjectExplorer() override;
55 
56  void setCurrentAspect(const AbstractAspect*);
58  void setProject(Project*);
59  QModelIndex currentIndex() const;
60  void updateSelectedAspects();
61  void search();
62 
63 private:
64  void createActions();
65  void contextMenuEvent(QContextMenuEvent*) override;
66  bool eventFilter(QObject*, QEvent*) override;
67  void keyPressEvent(QKeyEvent*) override;
68  void collapseParents(const QModelIndex&, const QList<QModelIndex>& expanded);
69  bool filter(const QModelIndex&, const QString&);
71  QTreeView* m_treeView;
72  Project* m_project{nullptr};
74  bool m_dragStarted{false};
76 
79  QAction* expandTreeAction;
87  QSignalMapper* showColumnsSignalMapper;
88 
89  QFrame* m_frameFilter;
90  QLineEdit* m_leFilter;
91  QToolButton* bFilterOptions;
92 
93 private slots:
94  void projectLoaded();
95  void aspectAdded(const AbstractAspect*);
96  void toggleColumn(int);
97  void showAllColumns();
98  void filterTextChanged(const QString&);
101  void toggleFilterWidgets();
102  void toggleFilterOptionsMenu(bool);
103  void resizeHeader();
104  void expandSelected();
105  void collapseSelected();
106  void deleteSelected();
107 
108  void navigateTo(const QString& path);
109  void currentChanged(const QModelIndex& current, const QModelIndex& previous);
110  void selectIndex(const QModelIndex&);
111  void deselectIndex(const QModelIndex&);
112  void selectionChanged(const QItemSelection&, const QItemSelection&);
113 
114  void save(QXmlStreamWriter*) const;
115  bool load(XmlStreamReader*);
116 
117 signals:
122 };
123 
124 #endif // ifndef PROJECT_EXPLORER_H
Base class of all persistent objects in a Project.
Represents a tree of AbstractAspect objects as a Qt item model.
A tree view for displaying and editing an AspectTreeModel.
void activateView(AbstractAspect *)
void aspectAdded(const AbstractAspect *)
QAction * caseSensitiveAction
QAction * deleteSelectedTreeAction
void selectionChanged(const QItemSelection &, const QItemSelection &)
void filterTextChanged(const QString &)
ProjectExplorer(QWidget *parent=nullptr)
QAction * toggleFilterAction
bool load(XmlStreamReader *)
Load from XML.
QAction * showAllColumnsAction
void deselectIndex(const QModelIndex &)
QAction * matchCompleteWordAction
void currentAspectChanged(AbstractAspect *)
bool eventFilter(QObject *, QEvent *) override
void currentChanged(const QModelIndex &current, const QModelIndex &previous)
QAction * collapseTreeAction
void hiddenAspectSelected(const AbstractAspect *)
void setProject(Project *)
void keyPressEvent(QKeyEvent *) override
void selectedAspectsChanged(QList< AbstractAspect * > &)
void setCurrentAspect(const AbstractAspect *)
QSignalMapper * showColumnsSignalMapper
void toggleFilterMatchCompleteWord()
QList< QAction * > list_showColumnActions
void selectIndex(const QModelIndex &)
void toggleFilterOptionsMenu(bool)
QToolButton * bFilterOptions
void save(QXmlStreamWriter *) const
Save the current state of the tree view (expanded items and the currently selected item) as XML.
void navigateTo(const QString &path)
Project * m_project
bool m_changeSelectionFromView
QAction * expandTreeAction
~ProjectExplorer() override
void toggleFilterCaseSensitivity()
bool filter(const QModelIndex &, const QString &)
void collapseParents(const QModelIndex &, const QList< QModelIndex > &expanded)
QLineEdit * m_leFilter
void contextMenuEvent(QContextMenuEvent *) override
QModelIndex currentIndex() const
QAction * collapseSelectedTreeAction
void setModel(AspectTreeModel *)
QFrame * m_frameFilter
QTreeView * m_treeView
QAction * expandSelectedTreeAction
Represents a project.
Definition: Project.h:42
XML stream parser that supports errors as well as warnings. This class also adds line and column numb...