1 #ifndef PROJECTMANAGER_H 3 #define PROJECTMANAGER_H 5 #include "model/project.h" 22 static constexpr
int EntityTypeRole = Qt::UserRole + 1;
24 ProjectEntity, SheetEntity
32 QList<Project*> &getProjects();
33 Project* getActiveProject()
const;
88 QVariant
data(
const QModelIndex &index,
int role)
const override;
89 int rowCount(
const QModelIndex &parent)
const override;
91 int columnCount(
const QModelIndex &parent)
const override;
92 QModelIndex index(
int row,
int column,
const QModelIndex &parent)
94 QModelIndex parent(
const QModelIndex &child)
const override;
95 Qt::ItemFlags flags()
const;
99 QList<Project*> projects;
104 #endif // PROJECTMANAGER_H A model that manages open projects.
Definition: projectmanager.h:18
void addSheet(Sheet *sheet, int index=-1, Project *project=nullptr)
Add a new sheet to project and register it in the manager.
QModelIndex getIndex(Entity *entity) const
Get the model index of the project or sheet that entity points to.
A project is essentially a list of sheets, along with some project properties.
Definition: project.h:16
void addProject(Project *project)
Add a project to the manager.
void removeProject(Project *project)
Remove project from the manager and destroy it.
QVariant data(const QModelIndex &index, int role) const override
Get the model data.
Base class for entities.
Definition: entity.h:32
bool isEmpty() const
Return true if no projects are open, false otherwise.
void removeSheet(Sheet *sheet)
Remove sheet from the manager and from its project.
This class models a sheet of paper.
Definition: sheet.h:16
void setActiveProject(Project *project)
Set the active project. This will notify all views that the new active project and the previous activ...