KActivities 5.109.0
Public Types | Properties | Signals | Public Slots | Public Member Functions | List of all members
KActivities::ActivitiesModel

Data model that shows existing activities. More...

#include <activitiesmodel.h>

Public Types

enum  Roles {
  ActivityId = Qt::UserRole , ActivityName = Qt::UserRole + 1 , ActivityDescription = Qt::UserRole + 2 , ActivityIconSource = Qt::UserRole + 3 ,
  ActivityState = Qt::UserRole + 4 , ActivityBackground = Qt::UserRole + 5 , ActivityIsCurrent = Qt::UserRole + 6 , UserRole = Qt::UserRole + 32
}
 

Properties

QVector< Info::StateshownStates
 

Signals

void shownStatesChanged (const QVector< Info::State > &state)
 

Public Slots

void setShownStates (const QVector< Info::State > &shownStates)
 The model can filter the list of activities based on their state.
 
QVector< Info::StateshownStates () const
 The model can filter the list of activities based on their state.
 

Public Member Functions

 ActivitiesModel (QObject *parent=nullptr)
 
 ActivitiesModel (QVector< Info::State > shownStates, QObject *parent=nullptr)
 Constructs the model and sets the shownStates.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QHash< int, QByteArray > roleNames () const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 

Detailed Description

Data model that shows existing activities.

Member Enumeration Documentation

◆ Roles

Enumerator
ActivityId 

UUID of the activity.

ActivityName 

Activity name.

ActivityDescription 

Activity description.

ActivityIconSource 

Activity icon source name.

ActivityState 

The current state of the activity.

See also
Info::State
ActivityBackground 

Activity wallpaper (currently unsupported)

ActivityIsCurrent 

Is this activity the current one current.

UserRole 

To be used by models that inherit this one.

Constructor & Destructor Documentation

◆ ActivitiesModel()

KActivities::ActivitiesModel::ActivitiesModel ( QVector< Info::State shownStates,
QObject *  parent = nullptr 
)

Constructs the model and sets the shownStates.

Member Function Documentation

◆ setShownStates

void KActivities::ActivitiesModel::setShownStates ( const QVector< Info::State > &  shownStates)
slot

The model can filter the list of activities based on their state.

This method sets which states should be shown.

◆ shownStates

QVector< Info::State > KActivities::ActivitiesModel::shownStates ( ) const
slot

The model can filter the list of activities based on their state.

This method returns which states are currently shown.