Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
StatusNotifierHost.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorServiceSni/phosphorservicesni_export.h>
7
8// Qt's MOC needs fully-defined pointer types for Q_PROPERTY, signal
9// parameters, and Q_INVOKABLE returns (qmetatype.h's
10// `checkTypeIsSuitableForMetaType` static-asserts `is_complete<T>`).
11// Forward decls compile in older Qt but fail with Qt ≥ 6.10.
13
14#include <QList>
15#include <QObject>
16
17#include <memory>
18
19namespace PhosphorServiceSni {
20
30class PHOSPHORSERVICESNI_EXPORT StatusNotifierHost : public QObject
31{
32 Q_OBJECT
33 Q_DISABLE_COPY_MOVE(StatusNotifierHost)
34 Q_PROPERTY(int itemCount READ itemCount NOTIFY itemCountChanged)
35
36public:
37 explicit StatusNotifierHost(QObject* parent = nullptr);
39
40 [[nodiscard]] QList<StatusNotifierItem*> items() const;
41 [[nodiscard]] int itemCount() const;
42 [[nodiscard]] StatusNotifierItem* itemAt(int index) const;
43
44Q_SIGNALS:
48
49private Q_SLOTS:
50 // DBus-callback slots: invoked by name from QDBusConnection::connect()
51 // for the cross-process StatusNotifierItemRegistered / Unregistered
52 // signals. Kept private so they're not part of the public API; MOC
53 // still picks them up.
54 void _q_remoteItemRegistered(const QString& canonical);
55 void _q_remoteItemUnregistered(const QString& canonical);
56
57private:
58 class Private;
59 // Out-of-line destructor in the .cpp so unique_ptr<Private> can
60 // see the complete type at destruction. CLAUDE.md forbids manual
61 // `delete d;`.
62 std::unique_ptr<Private> d;
63};
64
65} // namespace PhosphorServiceSni
StatusNotifierItem * itemAt(int index) const
void itemRemoved(StatusNotifierItem *item)
QList< StatusNotifierItem * > items() const
StatusNotifierHost(QObject *parent=nullptr)
void itemAdded(StatusNotifierItem *item)
One system-tray item.
Definition StatusNotifierItem.h:21
Definition DBusMenuModel.h:13