MacOS - Catalina - Tray icon and menu bar stays on screen when taking screenshot

(cherry picked from commit 517d34d2231da99d238149688ebddc254f35be98)
This commit is contained in:
Yuriy Puchkov
2021-02-05 18:01:05 +02:00
parent 94f0aecf81
commit ecb88380a6

View File

@@ -39,6 +39,7 @@
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QOperatingSystemVersion>
#include <QSystemTrayIcon>
#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(); });