Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowssystemtrayicon.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWINDOWSSYSTEMTRAYICON_H
5#define QWINDOWSSYSTEMTRAYICON_H
6
7#include <QtGui/qicon.h>
8#include <QtGui/qpa/qplatformsystemtrayicon.h>
9
10#include <QtCore/qpointer.h>
11#include <QtCore/qstring.h>
12#include <QtCore/qt_windows.h>
13
15
16class QDebug;
17
19
21{
22public:
24 ~QWindowsSystemTrayIcon() override;
25
26 void init() override;
27 void cleanup() override;
28 void updateIcon(const QIcon &icon) override;
29 void updateToolTip(const QString &tooltip) override;
30 void updateMenu(QPlatformMenu *) override {}
31 QRect geometry() const override;
32 void showMessage(const QString &title, const QString &msg,
33 const QIcon &icon, MessageIcon iconType, int msecs) override;
34
35 bool isSystemTrayAvailable() const override { return true; }
36 bool supportsMessages() const override;
37
38 QPlatformMenu *createMenu() const override;
39
40 bool winEvent(const MSG &message, long *result);
41
42#ifndef QT_NO_DEBUG_STREAM
43 void formatDebug(QDebug &d) const;
44#endif
45
46private:
47 bool isInstalled() const { return m_hwnd != nullptr; }
48 bool ensureInstalled();
49 void ensureCleanup();
50 bool sendTrayMessage(DWORD msg);
51 bool setIconVisible(bool visible);
52 bool isIconVisible() const;
53 HICON createIcon(const QIcon &icon);
54
55 QIcon m_icon;
56 QString m_toolTip;
57 HWND m_hwnd = nullptr;
58 HICON m_hIcon = nullptr;
59 HICON m_hMessageIcon = nullptr;
60 mutable QPointer<QWindowsPopupMenu> m_menu;
61 bool m_ignoreNextMouseRelease = false;
62 bool m_visible = false;
63};
64
65#ifndef QT_NO_DEBUG_STREAM
67#endif // !QT_NO_DEBUG_STREAM
68
70
71#endif // QWINDOWSSYSTEMTRAYICON_H
\inmodule QtCore
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
MessageIcon
This enum describes the icon that is shown when a balloon message is displayed.
\inmodule QtCore\reentrant
Definition qrect.h:30
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Windows native system tray icon.
void cleanup() override
This method is called to cleanup the platform dependent implementation.
bool supportsMessages() const override
Returns true if the system tray supports messages on the platform.
bool isSystemTrayAvailable() const override
Returns true if the system tray is available on the platform.
bool winEvent(const MSG &message, long *result)
void formatDebug(QDebug &d) const
void updateMenu(QPlatformMenu *) override
This method is called when the system tray menu did change.
QPlatformMenu * createMenu() const override
This method allows platforms to use a different QPlatformMenu for system tray menus than what would n...
void updateToolTip(const QString &tooltip) override
This method is called when the tooltip text did change.
void init() override
This method is called to initialize the platform dependent implementation.
void updateIcon(const QIcon &icon) override
This method is called when the icon did change.
void showMessage(const QString &title, const QString &msg, const QIcon &icon, MessageIcon iconType, int msecs) override
Shows a balloon message for the entry with the given title, message msg and icon for the time specifi...
QRect geometry() const override
This method returns the geometry of the platform dependent system tray icon on the screen.
Combined button and popup list for selecting options.
GLuint GLsizei const GLchar * message
GLuint64EXT * result
[6]
struct tagMSG MSG
QDebug operator<<(QDebug d, const QWindowsSystemTrayIcon *)
QString title
[35]