applicationdatabasemodel.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 "treemodel.h"
30 #include <memory>
31 #include <QStringList>
32 
33 /**
34 * @class ApplicationDatabaseModel
35 * @brief Model underlying the ApplicationDatabaseView.
36 */
38 {
39 public:
40  /**
41  * Constructor that sets up the first item contained by this model.
42  */
44 
45  /**
46  * Returns the data at the specified index, depending on the specified role.
47  * @param index of the data
48  * @param role role of the data
49  * @return contained data
50  */
51  QVariant data(const QModelIndex& index, int role) const override;
52 
53  /**
54  * Returns the behavioural flags of the object at the specified index.
55  * @param index index of the object
56  * @return behavioural flags
57  */
58  Qt::ItemFlags flags(const QModelIndex& index) const override;
59 
60  /**
61  * Returns the supported drag action. In this case always Qt::CopyAction.
62  */
63  Qt::DropActions supportedDragActions() const override;
64 
65  /**
66  * Returns supported MIME-types.
67  * @return list of the supported MIME-types
68  */
69  QStringList mimeTypes() const override;
70 
71  /**
72  * Returns the mimedata of the objects at the specified indexes.
73  * @param indexes object indexes
74  * @return data about the mime type of the objects
75  */
76  QMimeData* mimeData(const QModelIndexList& indexes) const override;
77 
78  /**
79  * Updates the model.
80  */
81  void update();
82 
83  /**
84  * Clears and resets this model as if it was newly constructed.
85  */
86  void clear() override;
87 
89 };
90 
91 using ApplicationDatabaseModelPtr = std::shared_ptr<ApplicationDatabaseModel>;
92 
ApplicationDatabaseModel::ApplicationDatabaseModel
ApplicationDatabaseModel()
Constructor that sets up the first item contained by this model.
Definition: applicationdatabasemodel.cpp:38
TreeModel::index
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Definition: treemodel.cpp:96
ApplicationDatabaseModel::mimeTypes
QStringList mimeTypes() const override
Returns supported MIME-types.
Definition: applicationdatabasemodel.cpp:98
ApplicationDatabaseItem
This class represents an item in the ApplicationDatabaseView.
Definition: applicationdatabaseitem.h:34
ApplicationDatabaseModel::getRootItem
ApplicationDatabaseItem * getRootItem()
Definition: applicationdatabasemodel.cpp:137
ApplicationDatabaseModel::update
void update()
Updates the model.
Definition: applicationdatabasemodel.cpp:129
TreeModel
Definition: treemodel.h:34
ApplicationDatabaseModel::clear
void clear() override
Clears and resets this model as if it was newly constructed.
Definition: applicationdatabasemodel.cpp:66
ApplicationDatabaseModel::flags
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns the behavioural flags of the object at the specified index.
Definition: applicationdatabasemodel.cpp:73
ApplicationDatabaseModel
Model underlying the ApplicationDatabaseView.
Definition: applicationdatabasemodel.h:37
ApplicationDatabaseModel::mimeData
QMimeData * mimeData(const QModelIndexList &indexes) const override
Returns the mimedata of the objects at the specified indexes.
Definition: applicationdatabasemodel.cpp:105
ApplicationDatabaseModel::data
QVariant data(const QModelIndex &index, int role) const override
Returns the data at the specified index, depending on the specified role.
Definition: applicationdatabasemodel.cpp:43
ApplicationDatabaseModel::supportedDragActions
Qt::DropActions supportedDragActions() const override
Returns the supported drag action.
Definition: applicationdatabasemodel.cpp:92
ApplicationDatabaseModelPtr
std::shared_ptr< ApplicationDatabaseModel > ApplicationDatabaseModelPtr
Definition: applicationdatabasemodel.h:91
treemodel.h
applicationdatabaseitem.h