Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qcocoasystemtrayicon.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2012 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QCOCOASYSTEMTRAYICON_P_H
6#define QCOCOASYSTEMTRAYICON_P_H
7
8#include <QtCore/qglobal.h>
9#include <QtGui/qtguiglobal.h>
10
11#if QT_CONFIG(systemtrayicon)
12
13#include <QtCore/qstring.h>
14#include <QtCore/private/qcore_mac_p.h>
15
16#include <QtGui/qpa/qplatformsystemtrayicon.h>
17
18#include "qcocoamenu.h"
19
20QT_FORWARD_DECLARE_CLASS(QCocoaSystemTrayIcon);
21
22QT_DECLARE_NAMESPACED_OBJC_INTERFACE(QStatusItemDelegate, NSObject <NSUserNotificationCenterDelegate>
23- (instancetype)initWithSysTray:(QCocoaSystemTrayIcon *)platformSystemTray;
24@property (nonatomic, assign) QCocoaSystemTrayIcon *platformSystemTray;
25)
26
28
30
31class Q_GUI_EXPORT QCocoaSystemTrayIcon : public QPlatformSystemTrayIcon
32{
33public:
34 QCocoaSystemTrayIcon() {}
35
36 void init() override;
37 void cleanup() override;
38 void updateIcon(const QIcon &icon) override;
39 void updateToolTip(const QString &toolTip) override;
40 void updateMenu(QPlatformMenu *menu) override;
41 QRect geometry() const override;
42 void showMessage(const QString &title, const QString &msg,
43 const QIcon& icon, MessageIcon iconType, int msecs) override;
44
45 bool isSystemTrayAvailable() const override;
46 bool supportsMessages() const override;
47
48 void emitActivated();
49
50private:
51 NSStatusItem *m_statusItem = nullptr;
53};
54
56
57#endif // QT_NO_SYSTEMTRAYICON
58
59#endif // QCOCOASYSTEMTRAYICON_P_H
DarwinBluetooth::DeviceInquiryDelegate * m_delegate
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
virtual void cleanup()=0
This method is called to cleanup the platform dependent implementation.
virtual void updateIcon(const QIcon &icon)=0
This method is called when the icon did change.
virtual bool isSystemTrayAvailable() const =0
Returns true if the system tray is available on the platform.
virtual void updateToolTip(const QString &tooltip)=0
This method is called when the tooltip text did change.
virtual void showMessage(const QString &title, const QString &msg, const QIcon &icon, MessageIcon iconType, int msecs)=0
Shows a balloon message for the entry with the given title, message msg and icon for the time specifi...
virtual QRect geometry() const =0
This method returns the geometry of the platform dependent system tray icon on the screen.
virtual bool supportsMessages() const =0
Returns true if the system tray supports messages on the platform.
virtual void updateMenu(QPlatformMenu *menu)=0
This method is called when the system tray menu did change.
virtual void init()=0
This method is called to initialize the platform dependent implementation.
\inmodule QtCore\reentrant
Definition qrect.h:30
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
Combined button and popup list for selecting options.
QT_FORWARD_DECLARE_CLASS(QCocoaMenuItem)
#define QT_DECLARE_NAMESPACED_OBJC_INTERFACE(classname, definition)
Definition qcore_mac_p.h:69
#define Q_FORWARD_DECLARE_OBJC_CLASS(classname)
QString title
[35]
QMenu menu
[5]