diff options
| author | Tor Arne Vestbø <[email protected]> | 2022-08-24 17:18:44 +0200 |
|---|---|---|
| committer | Tor Arne Vestbø <[email protected]> | 2022-12-02 15:53:37 +0100 |
| commit | 7e4c7d50a7ec48c849f168d1f83581fbf9e84a32 (patch) | |
| tree | 2f34075d6fae1a49059659aef24930c8dd7d11d4 /src/gui/kernel/qplatformintegration.cpp | |
| parent | 846cda7eb060a3e812670ff512b634be4245d95e (diff) | |
Add QGuiApplication API to set a number-badge in the Dock/task bar
The API is supported on macOS, iOS, and Windows. On Android no official
API exists for badging the application icon, and we don't want to take
on dependencies like ShortcutBadger [1].
The macOS and iOS implementations are trivial. The same goes for
the WinRT based implementation on Windows, but this API is only
available for applications that have a so called "package identity",
and does not seem to be stable for Windows 10.
To cover the cases where this API is not available we fall back to
drawing the badge manually, and set it as an overlay icon on the task
bar using ITaskbarList3. The look of this badge has been tweaked to
match the Windows 11/10 styles, and will pick up the user's choice of
dark/light mode and accent color if available.
[1] https://github.com/leolin310148/ShortcutBadger/
[ChangeLog][QtGui] Added QGuiApplication::setBadgeNumber() to inform
the user about e.g. the number of unread e-mail or queued tasks.
The badge will be overlaid on the application's icon in the Dock
on macOS, the home screen icon on iOS, or the task bar on Windows.
Task-number: QTBUG-94009
Change-Id: I6447d55177f9987b0dfcd93caf63c6167f7224c7
Reviewed-by: Axel Spoerl <[email protected]>
Reviewed-by: Oliver Wolff <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src/gui/kernel/qplatformintegration.cpp')
| -rw-r--r-- | src/gui/kernel/qplatformintegration.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 12f85052559..c95742b34dd 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -569,6 +569,20 @@ void QPlatformIntegration::setApplicationIcon(const QIcon &icon) const Q_UNUSED(icon); } +/*! + \since 6.5 + + Should set the application's badge to \a number. + + If the number is 0 the badge should be cleared. + + \sa QGuiApplication::setBadge() +*/ +void QPlatformIntegration::setApplicationBadge(qint64 number) +{ + Q_UNUSED(number); +} + #if QT_CONFIG(vulkan) || defined(Q_QDOC) /*! |
