swift
actionmodel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_MODELS_ACTIONMODEL_H
7 #define SWIFT_GUI_MODELS_ACTIONMODEL_H
8 
9 #include <QAbstractItemModel>
10 #include <QObject>
11 #include <QScopedPointer>
12 #include <QVariant>
13 #include <Qt>
14 
15 #include "gui/swiftguiexport.h"
16 
17 class QModelIndex;
18 
19 namespace swift::gui::models
20 {
21  class CActionItem;
22 
27  class SWIFT_GUI_EXPORT CActionModel : public QAbstractItemModel
28  {
29  Q_OBJECT
30 
31  public:
33  enum ItemRole
34  {
35  ActionRole = Qt::UserRole
36  };
37 
39  CActionModel(QObject *parent = nullptr);
40 
42  virtual ~CActionModel() override;
43 
45  QVariant data(const QModelIndex &index, int role) const override;
46 
48  Qt::ItemFlags flags(const QModelIndex &index) const override;
49 
51  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
52 
54  QModelIndex parent(const QModelIndex &index) const override;
55 
57  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
58 
60  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
61 
62  private:
64  void setupModelData();
65 
66  QScopedPointer<CActionItem> m_rootItem;
67  };
68 } // namespace swift::gui::models
69 
70 #endif // SWIFT_GUI_MODELS_ACTIONMODEL_H
Action tree model, used with hotkey actions.
Definition: actionmodel.h:28
Models to be used with views, mainly QTableView.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.