openscenariomodel.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarXCore::core
19  * @author Cedric Seehausen (usdnr at kit dot edu)
20  * @date 2016
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 
26 #pragma once
27 
28 #include "../gui/treemodel.h"
29 #include "openscenarioitem.h"
30 #include <memory>
31 
32 /**
33 * @class OpenScenarioModel
34 * @brief Model used by the OpenScenarioView
35 */
37 {
38 public:
39  /**
40  * Constructor that sets up the root of this model.
41  */
43 
44  /**
45  * Returns the data of the item at the given index of the given role.
46  * @param index index of the item
47  * @param role role of the item
48  */
49  QVariant data(const QModelIndex& index, int role) const override;
50 
51  /**
52  * Deletes the current root and replaces it with a new one, as if this model was newly constructed.
53  */
54  void clear() override;
55 
56  /**
57  * Updates this model.
58  */
59  void update();
60 
62 };
63 
64 using OpenScenarioModelPtr = std::shared_ptr<OpenScenarioModel>;
65 
66 
TreeModel::index
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Definition: treemodel.cpp:96
OpenScenarioModel
Model used by the OpenScenarioView.
Definition: openscenariomodel.h:36
OpenScenarioModel::update
void update()
Updates this model.
Definition: openscenariomodel.cpp:81
TreeModel
Definition: treemodel.h:34
OpenScenarioModel::getRootItem
OpenScenarioItem * getRootItem()
Definition: openscenariomodel.cpp:90
openscenarioitem.h
OpenScenarioModel::OpenScenarioModel
OpenScenarioModel()
Constructor that sets up the root of this model.
Definition: openscenariomodel.cpp:28
OpenScenarioModelPtr
std::shared_ptr< OpenScenarioModel > OpenScenarioModelPtr
Definition: openscenariomodel.h:64
OpenScenarioModel::clear
void clear() override
Deletes the current root and replaces it with a new one, as if this model was newly constructed.
Definition: openscenariomodel.cpp:74
OpenScenarioModel::data
QVariant data(const QModelIndex &index, int role) const override
Returns the data of the item at the given index of the given role.
Definition: openscenariomodel.cpp:33
OpenScenarioItem
Item in the TreeItemView. Every item represents a Scenario.
Definition: openscenarioitem.h:36