From 6cd0bcdfc88b649e030c0a934e4869b175bfb5f3 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 16 Jan 2024 20:01:05 +0800 Subject: [PATCH] Add currentAvailableScreenRect convenience method Signed-off-by: Claudio Cambra --- src/gui/systray.cpp | 7 +++++++ src/gui/systray.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index d1e0e76781b79..5529964341b52 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -703,6 +703,13 @@ QRect Systray::currentScreenRect() const return screen->geometry(); } +QRect Systray::currentAvailableScreenRect() const +{ + const auto screen = currentScreen(); + Q_ASSERT(screen); + return screen->availableGeometry(); +} + QPoint Systray::computeWindowReferencePoint() const { constexpr auto spacing = 4; diff --git a/src/gui/systray.h b/src/gui/systray.h index ab8fde6e2f48d..2056b7175eee7 100644 --- a/src/gui/systray.h +++ b/src/gui/systray.h @@ -167,6 +167,7 @@ private slots: [[nodiscard]] QScreen *currentScreen() const; [[nodiscard]] QRect currentScreenRect() const; + [[nodiscard]] QRect currentAvailableScreenRect() const; [[nodiscard]] QPoint computeWindowReferencePoint() const; [[nodiscard]] QPoint computeNotificationReferencePoint(int spacing = 20, NotificationPosition position = NotificationPosition::Default) const; [[nodiscard]] QPoint calcTrayIconCenter() const;