Schim
Public Member Functions | List of all members
ProjectManager Class Reference

A model that manages open projects. More...

#include <projectmanager.h>

Inheritance diagram for ProjectManager:
[legend]
Collaboration diagram for ProjectManager:
[legend]

Public Member Functions

QModelIndex getIndex (Entity *entity) const
 Get the model index of the project or sheet that entity points to.
 
bool isEmpty () const
 Return true if no projects are open, false otherwise.
 
void setActiveProject (Project *project)
 Set the active project. This will notify all views that the new active project and the previous active project have changed.
 
void addProject (Project *project)
 Add a project to the manager. More...
 
void addSheet (Sheet *sheet, int index=-1, Project *project=nullptr)
 Add a new sheet to project and register it in the manager. More...
 
void removeProject (Project *project)
 Remove project from the manager and destroy it. More...
 
void removeSheet (Sheet *sheet)
 Remove sheet from the manager and from its project. More...
 
QVariant data (const QModelIndex &index, int role) const override
 Get the model data.
 

Detailed Description

A model that manages open projects.

The model is a tree with a depth of 2. The top level contains a list of open projects and the lower level contains all the sheets that exist in a given project. One project can be set as the active project. Only sheets in the active project can be opened for editing.

Member Function Documentation

◆ addProject()

void ProjectManager::addProject ( Project project)

Add a project to the manager.

The project manager takes ownership of project. Any views will be notified that a model row was inserted.

Note
If the source file name of project matches the file name of another open project, nothing will be done.

◆ addSheet()

void ProjectManager::addSheet ( Sheet sheet,
int  index = -1,
Project project = nullptr 
)

Add a new sheet to project and register it in the manager.

The project takes ownership of the sheet. Any views will be notified that a model row was inserted.

Parameters
indexThe index of sheet in the project.
projectThe proj

◆ removeProject()

void ProjectManager::removeProject ( Project project)

Remove project from the manager and destroy it.

Any views will be notified that a model row was removed. If project was the active project, it will be deactivated.

◆ removeSheet()

void ProjectManager::removeSheet ( Sheet sheet)

Remove sheet from the manager and from its project.

Any views will be notified that a model row was removed.


The documentation for this class was generated from the following file: