From ecb88380a6274f5f20edd1f1bdf2aadad5671865 Mon Sep 17 00:00:00 2001 From: Yuriy Puchkov Date: Fri, 5 Feb 2021 18:01:05 +0200 Subject: [PATCH] MacOS - Catalina - Tray icon and menu bar stays on screen when taking screenshot (cherry picked from commit 517d34d2231da99d238149688ebddc254f35be98) --- src/core/controller.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/controller.cpp b/src/core/controller.cpp index d35a2c13..61397a97 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #ifdef Q_OS_WIN @@ -375,8 +376,14 @@ void Controller::enableTrayIcon() connect(captureAction, &QAction::triggered, this, [this]() { #if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \ defined(Q_OS_MACX)) - // It seems it is not relevant for MacOS (Wait 400 ms to hide the QMenu) - startVisualCapture(); + auto currentMacOsVersion = QOperatingSystemVersion::current(); + if (currentMacOsVersion >= currentMacOsVersion.MacOSBigSur) { + startVisualCapture(); + } else { + // It seems it is not relevant for MacOS BigSur (Wait 400 ms to hide + // the QMenu) + doLater(400, this, [this]() { this->startVisualCapture(); }); + } #else // Wait 400 ms to hide the QMenu doLater(400, this, [this]() { this->startVisualCapture(); });