SourceTreeModel.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include <obs-frontend-api.h>
  3. #include <obs.hpp>
  4. #include <QAbstractListModel>
  5. class SourceTree;
  6. class SourceTreeModel : public QAbstractListModel {
  7. Q_OBJECT
  8. friend class SourceTree;
  9. friend class SourceTreeItem;
  10. SourceTree *st;
  11. QVector<OBSSceneItem> items;
  12. bool hasGroups = false;
  13. static void OBSFrontendEvent(enum obs_frontend_event event, void *ptr);
  14. void Clear();
  15. void SceneChanged();
  16. void ReorderItems();
  17. void Add(obs_sceneitem_t *item);
  18. void Remove(obs_sceneitem_t *item);
  19. OBSSceneItem Get(int idx);
  20. QString GetNewGroupName();
  21. void AddGroup();
  22. void GroupSelectedItems(QModelIndexList &indices);
  23. void UngroupSelectedGroups(QModelIndexList &indices);
  24. void ExpandGroup(obs_sceneitem_t *item);
  25. void CollapseGroup(obs_sceneitem_t *item);
  26. void UpdateGroupState(bool update);
  27. public:
  28. explicit SourceTreeModel(SourceTree *st);
  29. virtual int rowCount(const QModelIndex &parent) const override;
  30. virtual QVariant data(const QModelIndex &index, int role) const override;
  31. virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
  32. virtual Qt::DropActions supportedDropActions() const override;
  33. };