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

QAbstractListModel adapter over StatusNotifierHost::items(). More...

#include <phosphor-services/include/PhosphorServices/StatusNotifierItemModel.h>

Inheritance diagram for PhosphorServices::StatusNotifierItemModel:
[legend]

Public Types

enum  Roles {
  IdRole = Qt::UserRole + 1 , TitleRole , CategoryRole , StatusRole ,
  IconUrlRole , OverlayIconUrlRole , AttentionIconUrlRole , IconImageRole ,
  OverlayIconImageRole , AttentionIconImageRole , ToolTipTitleRole , ToolTipBodyRole ,
  MenuPathRole , ItemIsMenuRole , DBusServiceRole , DBusPathRole ,
  ItemObjectRole
}
 

Signals

void hostChanged ()
 
void countChanged ()
 

Public Member Functions

 StatusNotifierItemModel (QObject *parent=nullptr)
 
 ~StatusNotifierItemModel () override
 
StatusNotifierHosthost () const
 
void setHost (StatusNotifierHost *host)
 
int rowCount (const QModelIndex &parent={}) const override
 
QVariant data (const QModelIndex &index, int role) const override
 
QHash< int, QByteArray > roleNames () const override
 
void activate (int row, int x, int y)
 QML-friendly action invocations — looks up the item by row and dispatches.
 
void secondaryActivate (int row, int x, int y)
 
void contextMenu (int row, int x, int y)
 
void scroll (int row, int delta, const QString &orientation)
 
PhosphorServices::StatusNotifierItemitemAt (int row) const
 

Detailed Description

QAbstractListModel adapter over StatusNotifierHost::items().

Hand this to a QML Repeater / ListView. The roles cover everything a typical tray delegate needs without exposing the raw item QObject (kept available via ItemObjectRole for invoking action methods).

Member Enumeration Documentation

◆ Roles

Enumerator
IdRole 
TitleRole 
CategoryRole 
StatusRole 
IconUrlRole 
OverlayIconUrlRole 
AttentionIconUrlRole 
IconImageRole 
OverlayIconImageRole 
AttentionIconImageRole 
ToolTipTitleRole 
ToolTipBodyRole 
MenuPathRole 
ItemIsMenuRole 
DBusServiceRole 
DBusPathRole 
ItemObjectRole 

the raw StatusNotifierItem* for Q_INVOKABLE methods

Constructor & Destructor Documentation

◆ StatusNotifierItemModel()

PhosphorServices::StatusNotifierItemModel::StatusNotifierItemModel ( QObject *  parent = nullptr)
explicit

◆ ~StatusNotifierItemModel()

PhosphorServices::StatusNotifierItemModel::~StatusNotifierItemModel ( )
override

Member Function Documentation

◆ activate()

void PhosphorServices::StatusNotifierItemModel::activate ( int  row,
int  x,
int  y 
)

QML-friendly action invocations — looks up the item by row and dispatches.

coords are in screen-logical pixels; the item's process uses them to position any popup it wants to render (some menus position relative to these).

◆ contextMenu()

void PhosphorServices::StatusNotifierItemModel::contextMenu ( int  row,
int  x,
int  y 
)

◆ countChanged

void PhosphorServices::StatusNotifierItemModel::countChanged ( )
signal

◆ data()

QVariant PhosphorServices::StatusNotifierItemModel::data ( const QModelIndex &  index,
int  role 
) const
override

◆ host()

StatusNotifierHost * PhosphorServices::StatusNotifierItemModel::host ( ) const

◆ hostChanged

void PhosphorServices::StatusNotifierItemModel::hostChanged ( )
signal

◆ itemAt()

PhosphorServices::StatusNotifierItem * PhosphorServices::StatusNotifierItemModel::itemAt ( int  row) const

◆ roleNames()

QHash< int, QByteArray > PhosphorServices::StatusNotifierItemModel::roleNames ( ) const
override

◆ rowCount()

int PhosphorServices::StatusNotifierItemModel::rowCount ( const QModelIndex &  parent = {}) const
override

◆ scroll()

void PhosphorServices::StatusNotifierItemModel::scroll ( int  row,
int  delta,
const QString &  orientation 
)

◆ secondaryActivate()

void PhosphorServices::StatusNotifierItemModel::secondaryActivate ( int  row,
int  x,
int  y 
)

◆ setHost()

void PhosphorServices::StatusNotifierItemModel::setHost ( StatusNotifierHost host)

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