18 #ifndef LIBS_MVA_WORKFLOW_INCLUDE_WORKFLOW_ITEMHANDLER_H_
19 #define LIBS_MVA_WORKFLOW_INCLUDE_WORKFLOW_ITEMHANDLER_H_
21 #include <QItemSelectionModel>
24 #include <QStandardItemModel>
26 #include "basic_item.h"
27 #include "item_observer.h"
60 Qt::ItemFlags flags(
const QModelIndex& index)
const override;
67 enum ItemRoles { ITEM_OBSERVER = Qt::UserRole + 1 };
71 qsizetype numItems()
const {
return m_item_model.rowCount(); }
72 QStandardItemModel* model() {
return &m_item_model; }
73 QItemSelectionModel* selectionModel() {
return &m_item_selection_model; }
75 QStandardItemModel* animationModel() {
return &m_animation_model; }
76 QList<BasicItem*> basicItems();
77 QList<QSharedPointer<ItemObserver>> items();
79 void scaleItems(
const qreal width_ratio,
const qreal height_ratio);
84 void addItem(
BasicItem*
const basic_item);
85 void removeItem(
BasicItem*
const basic_item);
86 void setCurrentItem(
const QString& itemName);
87 void removeCurrentItem();
90 const QString& item_name,
const QString& animation_type,
const qreal start_time,
const qreal duration);
91 void addAnimations(
const QString& item_name,
const QList<QSharedPointer<AbstractAnimation>> animations);
92 void removeAnimation(
const qint32 animation_number);
94 void setTime(
const qreal time);
95 void changeProperty(
const QString& item_name,
const QByteArray& property,
const QVariant& value);
98 void propertyDataChanged(
99 const QModelIndex& topLeft,
const QModelIndex& bottomRight,
const QList<qint32>& roles = QList<qint32>());
100 void currentItemChanged(
const QModelIndex& current,
const QModelIndex& previous);
108 bool itemAlreadyExists(
BasicItem*
const basic_item);
109 bool itemNameAlreadyExists(
const QString& name);
111 QString prepareNewItemName(
const QString& old_item_name);
113 void repopulatePropertyModel(
const QModelIndex& currentIndex);
114 void repopulateAnimationModel(
const ItemModelItem*
const item);
116 void setDeleteEachQuickItem(QModelIndex parent = QModelIndex());
118 ItemModelItem* getItemModelItemByName(
const QString& item_name);
119 QSharedPointer<ItemObserver> getItemObserverByName(
const QString& item_name);
121 void prepareModelHeader();
122 void updateItemModelName(
const QVariant& name);
124 QStandardItemModel m_item_model;
125 QStandardItemModel m_animation_model;
126 QItemSelectionModel m_item_selection_model;
137 void setDeleteQuickitem(
const bool delete_quick_item) { m_delete_quick_item = delete_quick_item; }
139 QSharedPointer<ItemObserver> itemObserver()
const;
140 void setItemObserver(
const QSharedPointer<ItemObserver>& new_item_observer);
161 bool m_delete_quick_item =
false;
163 QSharedPointer<ItemObserver> m_item_observer;
An abstract class representing a visible item like a circle or a rectangle.
Definition: abstractitem.h:56
Definition: basic_item.h:28
Definition: itemhandler.h:63
Definition: itemhandler.h:131
Map which stores key (QString) value (QVariant) pairs.
Definition: abstractitem.h:37
Definition: itemhandler.h:36
void appendProperties(const PropertyMap &properties)
Appends all properties from the given property map to the model.
Definition: itemhandler.cpp:431
void appendProperty(const ItemProperty &property)
Appends a property to the model.
Definition: itemhandler.cpp:423
Definition: itemhandler.h:31