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 <PhosphorServices/phosphorservices_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#include <QPointer>
17
18#include <memory>
19
20namespace PhosphorServices {
21
31class PHOSPHORSERVICES_EXPORT StatusNotifierHost : public QObject
32{
33 Q_OBJECT
34 Q_DISABLE_COPY_MOVE(StatusNotifierHost)
35 Q_PROPERTY(int itemCount READ itemCount NOTIFY itemCountChanged)
36
37public:
38 explicit StatusNotifierHost(QObject* parent = nullptr);
40
41 [[nodiscard]] QList<StatusNotifierItem*> items() const;
42 [[nodiscard]] int itemCount() const;
43 [[nodiscard]] StatusNotifierItem* itemAt(int index) const;
44
45Q_SIGNALS:
49
50private Q_SLOTS:
51 // DBus-callback slots — invoked by name from QDBusConnection::connect()
52 // for the cross-process StatusNotifierItemRegistered / Unregistered
53 // signals. Kept private so they're not part of the public API; MOC
54 // still picks them up.
55 void _q_remoteItemRegistered(const QString& canonical);
56 void _q_remoteItemUnregistered(const QString& canonical);
57
58private:
59 class Private;
60 // Out-of-line destructor in the .cpp so unique_ptr<Private> can
61 // see the complete type at destruction. CLAUDE.md forbids manual
62 // `delete d;`.
63 std::unique_ptr<Private> d;
64};
65
66} // namespace PhosphorServices
The shell-side counterpart to StatusNotifierWatcher.
Definition StatusNotifierHost.h:32
StatusNotifierItem * itemAt(int index) const
void itemAdded(StatusNotifierItem *item)
QList< StatusNotifierItem * > items() const
StatusNotifierHost(QObject *parent=nullptr)
void itemRemoved(StatusNotifierItem *item)
One system-tray item.
Definition StatusNotifierItem.h:21
Definition DBusMenuModel.h:15