VPTissue Reference Manual
PTreeView.h
Go to the documentation of this file.
1 #ifndef PTREE_VIEW_H_INCLUDED
2 #define PTREE_VIEW_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include <QUndoStack>
23 #include "MyTreeView.h"
24 
25 class QAction;
26 
27 namespace SimShell {
28 namespace Gui {
29 
30 class MyFindDialog;
31 
37 class PTreeView : public MyTreeView
38 {
39  Q_OBJECT
40 public:
45  PTreeView(QWidget* parent = 0);
46 
50  virtual ~PTreeView() {}
51 
56  bool IsClean() const;
57 
62  void SetClean();
63 
64  bool IsOnlyEditData() const;
65 
66  void SetOnlyEditData(bool);
67 
71  virtual void setModel(QAbstractItemModel* model);
72 
73  // any window can put these actions in its menu / toolbar / ...
74  QAction* GetUndoAction() const;
75  QAction* GetRedoAction() const;
76  QAction* GetCutAction() const;
77  QAction* GetCopyAction() const;
78  QAction* GetPasteAction() const;
79  QAction* GetMoveUpAction() const;
80  QAction* GetMoveDownAction() const;
81  QAction* GetInsertBeforeAction() const;
82  QAction* GetInsertChildAction() const;
83  QAction* GetRemoveAction() const;
84  QAction* GetFindDialogAction() const;
85  QAction* GetClearHighlightAction() const;
86  QAction* GetExpandAllAction() const;
87  QAction* GetExpandNoneAction() const;
88 
89 private slots:
94  void Cut();
95 
100  void Copy();
101 
106  void Paste();
107 
112  void MoveUp();
113 
118  void MoveDown();
119 
124  void Insert();
125 
130  void InsertChild();
131 
136  void Remove();
137 
141  void FindDialog();
142 
147  void ClearHighlight();
148 
153  void FindNext(QString const &, bool match_case);
154 
159  void SetClipboardChanged();
160 
165  void SetSelectionChanged(QItemSelection const &, QItemSelection const &);
166 
167 signals:
173  void CleanChanged(bool clean);
174 
180  void Edited();
181 
186  void StatusChanged(QString const & message);
187 
188 protected:
194  virtual void contextMenuEvent(QContextMenuEvent*);
195 
196 private:
197  Q_DISABLE_COPY(PTreeView)
198 
199  QUndoStack m_undo_stack;
200  MyFindDialog* m_find_dialog;
201  bool m_only_edit_data;
202 
203  Qt::MatchFlags m_flags;
204  QString m_query;
205  QModelIndexList m_results;
206  QModelIndexList::iterator m_result;
207 
208  QAction* m_action_undo;
209  QAction* m_action_redo;
210  QAction* m_action_cut;
211  QAction* m_action_copy;
212  QAction* m_action_paste;
213  QAction* m_action_move_up;
214  QAction* m_action_move_down;
215  QAction* m_action_insert;
216  QAction* m_action_insert_child;
217  QAction* m_action_remove;
218  QAction* m_action_find_dialog;
219  QAction* m_action_clear_highlight;
220  QAction* m_action_expand_all;
221  QAction* m_action_expand_none;
222 };
223 
224 } // namespace
225 } // namespace
226 
227 #endif // end_of_inclde_guard
see the online Qt documentation
Interface for MyTreeView.
PTreeView(QWidget *parent=0)
Constructor.
Definition: PTreeView.cpp:37
Dialog window for searching strings.
Definition: MyFindDialog.h:36
void StatusChanged(QString const &message)
Emitted when view has some message to share with, for example, a statusbar.
see the online C++11 documentation
bool IsClean() const
Test whether the view's internal undo stack is in a clean state.
Definition: PTreeView.cpp:309
virtual void setModel(QAbstractItemModel *model)
Reimplemented from QTreeView, also enables/disables certain actions.
Definition: PTreeView.cpp:405
virtual void contextMenuEvent(QContextMenuEvent *)
Reimplemented from QWidget.
Definition: PTreeView.cpp:151
void SetClean()
Set the view's internal undo stack's current state to be the clean state.
Definition: PTreeView.cpp:387
TreeView widget that presents an editable ptree to the user.
Definition: PTreeView.h:37
QTreeView with methods to import/export widget layout (x,y,width, ...) in ptree format.
Definition: MyTreeView.h:35
see the online Qt documentation
virtual ~PTreeView()
Virtual Destructor.
Definition: PTreeView.h:50
void CleanChanged(bool clean)
Emitted whenever the view's internal undo stack state changes from clean to non-clean, or from non-clean to clean.
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32
void Edited()
Emitted whenever the data contained in the model changes.