Debian Codegraph @

avogadro/qtgui/scenepluginmodel.h

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5
6 #ifndef AVOGADRO_QTGUI_SCENEPLUGINMODEL_H
7 #define AVOGADRO_QTGUI_SCENEPLUGINMODEL_H
8
9 #include "avogadroqtguiexport.h"
10
11 #include <QtCore/QAbstractItemModel>
12
13 namespace Avogadro {
14 namespace QtGui {
15
16 class ScenePlugin;
17
18 /**
19 * @class ScenePluginModel scenepluginmodel.h
20 * <avogadro/qtgui/scenepluginmodel.h>
21 * @brief A model containing scene plugins that will build up the scene.
22 * @author Marcus D. Hanwell
23 */
24
25 class AVOGADROQTGUI_EXPORT ScenePluginModel : public QAbstractItemModel
26 {
27 Q_OBJECT
28
29 public:
30 explicit ScenePluginModel(QObject* parent = nullptr);
31
32 QModelIndex parent(const QModelIndex& child) const override;
33 int rowCount(const QModelIndex& parent) const override;
34 int columnCount(const QModelIndex& parent) const override;
35
36 Qt::ItemFlags flags(const QModelIndex& index) const override;
37
38 bool setData(const QModelIndex& index, const QVariant& value,
39 int role) override;
40 QVariant data(const QModelIndex& index, int role) const override;
41
42 QModelIndex index(int row, int column,
43 const QModelIndex& parent = QModelIndex()) const override;
44
45 void clear();
46
47 QList<ScenePlugin*> scenePlugins() const;
48 QList<ScenePlugin*> activeScenePlugins() const;
49
50 ScenePlugin* scenePlugin(const QModelIndex& index) const;
51 ScenePlugin* scenePlugin(int row) const;
52
53 signals:
54 void pluginStateChanged(Avogadro::QtGui::ScenePlugin*);
55 void pluginConfigChanged();
56
57 public slots:
58 void addItem(Avogadro::QtGui::ScenePlugin* item);
59 void removeItem(Avogadro::QtGui::ScenePlugin* item);
60 void itemChanged();
61
62 private:
63 QList<ScenePlugin*> m_scenePlugins;
64 };
65
66 } // namespace QtGui
67 } // namespace Avogadro
68
69 #endif // AVOGADRO_QTGUI_SCENEPLUGINMODEL_H