fix - MacOS - Black screen when saving files with tool button key

This commit is contained in:
Yuriy Puchkov
2020-12-03 16:49:48 +02:00
parent b4be86068d
commit dbb08d01b5

View File

@@ -18,6 +18,12 @@
#include "savetool.h"
#include "src/utils/screenshotsaver.h"
#include <QPainter>
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
#include "src/widgets/capture/capturewidget.h"
#include <QApplication>
#include <QWidget>
#endif
SaveTool::SaveTool(QObject* parent)
: AbstractActionTool(parent)
@@ -55,6 +61,18 @@ CaptureTool* SaveTool::copy(QObject* parent)
void SaveTool::pressed(const CaptureContext& context)
{
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
defined(Q_OS_MACX))
for (QWidget* widget : qApp->topLevelWidgets()) {
QString className(widget->metaObject()->className());
// if (className.compare("CaptureWidget") == 0) {
if (className.compare(CaptureWidget::staticMetaObject.className()) ==
0) {
widget->showNormal();
break;
}
}
#endif
if (context.savePath.isEmpty()) {
emit requestAction(REQ_HIDE_GUI);
bool ok = ScreenshotSaver().saveToFilesystemGUI(