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

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

#include <PhosphorServiceSni/StatusNotifierItemModel.h>

Inheritance diagram for PhosphorServiceSni::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
StatusNotifierHost * host () 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)
PhosphorServiceSni::StatusNotifierItem * itemAt (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()

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

◆ ~StatusNotifierItemModel()

PhosphorServiceSni::StatusNotifierItemModel::~StatusNotifierItemModel ( )
override

Member Function Documentation

◆ activate()

void PhosphorServiceSni::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 PhosphorServiceSni::StatusNotifierItemModel::contextMenu ( int row,
int x,
int y )

◆ countChanged

void PhosphorServiceSni::StatusNotifierItemModel::countChanged ( )
signal

◆ data()

QVariant PhosphorServiceSni::StatusNotifierItemModel::data ( const QModelIndex & index,
int role ) const
nodiscardoverride

◆ host()

StatusNotifierHost * PhosphorServiceSni::StatusNotifierItemModel::host ( ) const
nodiscard

◆ hostChanged

void PhosphorServiceSni::StatusNotifierItemModel::hostChanged ( )
signal

◆ itemAt()

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

◆ roleNames()

QHash< int, QByteArray > PhosphorServiceSni::StatusNotifierItemModel::roleNames ( ) const
nodiscardoverride

◆ rowCount()

int PhosphorServiceSni::StatusNotifierItemModel::rowCount ( const QModelIndex & parent = {}) const
nodiscardoverride

◆ scroll()

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

◆ secondaryActivate()

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

◆ setHost()

void PhosphorServiceSni::StatusNotifierItemModel::setHost ( StatusNotifierHost * host)

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