ControlItemModel.hpp
1 #pragma once
2 #include <QAbstractItemModel>
3 
4 #include <score_plugin_scenario_export.h>
5 namespace Process
6 {
7 struct ControlMessage;
8 }
9 
10 namespace Scenario
11 {
12 class StateModel;
13 class SCORE_PLUGIN_SCENARIO_EXPORT ControlItemModel final : public QAbstractItemModel
14 {
15 public:
16  ControlItemModel(Scenario::StateModel& ctx, QObject* parent);
18 
19  static void addMessages(
20  std::vector<Process::ControlMessage>& existing,
21  std::vector<Process::ControlMessage>&& added);
22  void replaceWith(const std::vector<Process::ControlMessage>&);
23 
24  const std::vector<Process::ControlMessage>& messages() const noexcept
25  {
26  return m_msgs;
27  }
28 
29 private:
30  QModelIndex index(int row, int column, const QModelIndex& parent) const override;
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  QVariant data(const QModelIndex& index, int role) const override;
36 
37  Qt::DropActions supportedDragActions() const override;
38  Qt::DropActions supportedDropActions() const override;
39  Qt::ItemFlags flags(const QModelIndex& index) const override;
40 
41  Scenario::StateModel& m_state;
42  std::vector<Process::ControlMessage> m_msgs;
43 };
44 
45 }
Definition: ControlItemModel.hpp:14
Definition: StateModel.hpp:63
Base classes and tools to implement processes and layers.
Definition: JSONVisitor.hpp:1324
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14