6#include <PhosphorShell/phosphorshell_export.h>
8#include <QAbstractListModel>
21class WorkspaceBackend;
55 [[nodiscard]]
int rowCount(const QModelIndex& parent = {})
const override;
56 [[nodiscard]] QVariant
data(
const QModelIndex& index,
int role)
const override;
57 [[nodiscard]] QHash<int, QByteArray>
roleNames()
const override;
62 QPointer<WorkspaceBackend> m_backend;
115 Q_PROPERTY(QAbstractListModel*
model READ
model CONSTANT)
132 explicit Workspaces(WorkspaceBackend* backend, QObject* parent =
nullptr);
138 [[nodiscard]] QAbstractListModel*
model()
const;
158 QPointer<WorkspaceBackend> m_backend;
163 QString m_activeName;
164 int m_activeIndex = 0;
Incrementally-updating model of the compositor's workspaces.
Definition Workspaces.h:40
WorkspaceListModel(WorkspaceBackend *backend, QObject *parent=nullptr)
Null backend: an empty model.
QVariant data(const QModelIndex &index, int role) const override
QHash< int, QByteArray > roleNames() const override
Role
Definition Workspaces.h:44
@ IsActiveRole
Definition Workspaces.h:47
@ IdRole
Definition Workspaces.h:45
@ NameRole
Definition Workspaces.h:46
int rowCount(const QModelIndex &parent={}) const override
QString activeName() const
QAbstractListModel * model() const
static Workspaces * create(QQmlEngine *engine, QJSEngine *scriptEngine)
QML-singleton factory hook.
Workspaces(WorkspaceBackend *backend, QObject *parent=nullptr)
Over backend, which must outlive this object or be destroyed with it.
void switchTo(const QString &id)
Switch to the workspace with this identifier.
Workspaces(QObject *parent=nullptr)
Bind Repeater { model: Workspaces.model }.
Definition Environment.h:11