Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorShell::WorkspaceListModel Class Reference

Incrementally-updating model of the compositor's workspaces. More...

#include <PhosphorShell/Workspaces.h>

Inheritance diagram for PhosphorShell::WorkspaceListModel:
[legend]

Public Types

enum  Role { IdRole = Qt::UserRole + 1 , NameRole , IsActiveRole }

Public Member Functions

 WorkspaceListModel (WorkspaceBackend *backend, QObject *parent=nullptr)
 Null backend: an empty model.
 ~WorkspaceListModel () override
int rowCount (const QModelIndex &parent={}) const override
QVariant data (const QModelIndex &index, int role) const override
QHash< int, QByteArray > roleNames () const override

Detailed Description

Incrementally-updating model of the compositor's workspaces.

Roles:

  • workspaceId — the workspace's identifier, unique and stable while the workspace exists. Not id: QML's parser rejects id as a delegate property name, and qmlformat fails outright on it.
  • name — the user-visible label.
  • isActive — whether this is the current workspace.

A workspace switch emits dataChanged over isActive only, so a pager re-styles two pills instead of rebuilding every delegate. The list is reset only when workspaces are actually added, removed, reordered, or renamed.

Member Enumeration Documentation

◆ Role

Enumerator
IdRole 
NameRole 
IsActiveRole 

Constructor & Destructor Documentation

◆ WorkspaceListModel()

PhosphorShell::WorkspaceListModel::WorkspaceListModel ( WorkspaceBackend * backend,
QObject * parent = nullptr )
explicit

Null backend: an empty model.

◆ ~WorkspaceListModel()

PhosphorShell::WorkspaceListModel::~WorkspaceListModel ( )
override

Member Function Documentation

◆ data()

QVariant PhosphorShell::WorkspaceListModel::data ( const QModelIndex & index,
int role ) const
nodiscardoverride

◆ roleNames()

QHash< int, QByteArray > PhosphorShell::WorkspaceListModel::roleNames ( ) const
nodiscardoverride

◆ rowCount()

int PhosphorShell::WorkspaceListModel::rowCount ( const QModelIndex & parent = {}) const
nodiscardoverride

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