VPTissue Reference Manual
MyTreeView.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "MyTreeView.h"
21 #include "common/PTreeQtState.h"
22 
23 using namespace std;
24 using namespace boost::property_tree;
25 
26 namespace SimShell {
27 namespace Gui {
28 
29 MyTreeView::MyTreeView(QWidget* parent)
30  : QTreeView(parent)
31 {
32 }
33 
35 {
36  ptree result;
37  if (model()) {
38  result.put_child("treeview", PTreeQtState::GetTreeViewState(this));
39  }
40  //result.put_child("widget", PTreeQtState::GetWidgetState(this));
41  return result;
42 }
43 
44 void MyTreeView::SetPTreeState(const ptree& state)
45 {
46  if (model()) {
47  auto treeview_state = state.get_child_optional("treeview");
48  if (treeview_state) {
49  PTreeQtState::SetTreeViewState(this, treeview_state.get());
50  }
51  }
52 
53  /*auto widget_state = state.get_child_optional("widget");
54  if (widget_state) {
55  PTreeQtState::SetWidgetState(this, widget_state.get());
56  }*/
57 }
58 
59 } // namespace Gui
60 } // namespace SimShell
STL namespace.
Interface for MyTreeView.
Interface for PTreeQtState.
virtual boost::property_tree::ptree GetPTreeState() const
Definition: MyTreeView.cpp:34
static boost::property_tree::ptree GetTreeViewState(const QTreeView *)
Get ptree representation of expand/collapsed state of items in given QTreeView.
virtual void SetPTreeState(const boost::property_tree::ptree &)
Definition: MyTreeView.cpp:44
see the online Qt documentation
see the online Qt documentation
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32
static void SetTreeViewState(QTreeView *, const boost::property_tree::ptree &)
Set expand/collapsed state of items in given QTreeView as represented by given ptree.