Fix QT issue on MacOS version 11.0 "Big Sur".
This commit is contained in:
parent
a40ce741ad
commit
31a0f3d82c
|
@ -15,6 +15,7 @@
|
|||
- New option. Default piece label template for new pieces.
|
||||
- Shortcut to quickly enable/disable Interactive tools mode.
|
||||
- Improve labels for V notch.
|
||||
- Fix QT issue on MacOS version 11.0 "Big Sur".
|
||||
|
||||
# Valentina 0.7.52 September 12, 2022
|
||||
- Fix crash when default locale is ru.
|
||||
|
|
|
@ -69,6 +69,12 @@ auto main(int argc, char *argv[]) -> int
|
|||
|
||||
#ifndef Q_OS_MAC // supports natively
|
||||
InitHighDpiScaling(argc, argv);
|
||||
#endif //ndef Q_OS_MAC
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#if MACOS_LAYER_BACKING_AFFECTED
|
||||
MacosEnableLayerBacking();
|
||||
#endif // MACOS_LAYER_BACKING_AFFECTED
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
|
|
|
@ -75,6 +75,12 @@ auto main(int argc, char *argv[]) -> int
|
|||
InitHighDpiScaling(argc, argv);
|
||||
#endif //Q_OS_MAC
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#if MACOS_LAYER_BACKING_AFFECTED
|
||||
MacosEnableLayerBacking();
|
||||
#endif // MACOS_LAYER_BACKING_AFFECTED
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
MApplication app(argc, argv);
|
||||
app.InitOptions();
|
||||
|
||||
|
|
|
@ -81,6 +81,12 @@ auto main(int argc, char *argv[]) -> int
|
|||
InitHighDpiScaling(argc, argv);
|
||||
#endif //Q_OS_MAC
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#if MACOS_LAYER_BACKING_AFFECTED
|
||||
MacosEnableLayerBacking();
|
||||
#endif // MACOS_LAYER_BACKING_AFFECTED
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
|
||||
|
||||
|
|
|
@ -304,6 +304,22 @@ void InitHighDpiScaling(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
#ifdef Q_OS_MAC
|
||||
#if MACOS_LAYER_BACKING_AFFECTED
|
||||
void MacosEnableLayerBacking()
|
||||
{
|
||||
QOperatingSystemVersion osVer = QOperatingSystemVersion::current();
|
||||
const int majorVer = osVer.majorVersion();
|
||||
const int minorVer = osVer.minorVersion();
|
||||
if (((majorVer == 10 && minorVer >= 16) || majorVer >= 11) && qEnvironmentVariableIsEmpty("QT_MAC_WANTS_LAYER"))
|
||||
{
|
||||
qputenv("QT_MAC_WANTS_LAYER", "1");
|
||||
}
|
||||
}
|
||||
#endif // MACOS_LAYER_BACKING_AFFECTED
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTMark, (QLatin1String("tMark"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark, (QLatin1String("vMark"))) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strVMark2, (QLatin1String("vMark2"))) // NOLINT
|
||||
|
|
|
@ -370,6 +370,35 @@ if (!(cond)) \
|
|||
bool IsOptionSet(int argc, char *argv[], const char *option);
|
||||
void InitHighDpiScaling(int argc, char *argv[]);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
// Fix QT issue on MacOS version 11.0 "Big Sur"
|
||||
// https://bugreports.qt.io/browse/QTBUG-87014
|
||||
// Enables layer backing for Big Sur
|
||||
// Prevents 100% CPU & RAM utilization
|
||||
//
|
||||
// The fix at
|
||||
//
|
||||
// https://codereview.qt-project.org/c/qt/qtbase/+/322228/3/src/plugins/platforms/cocoa/qnsview_drawing.mm
|
||||
//
|
||||
// enables layer backing if we're running on Big Sur OR we're running on
|
||||
// Catalina AND we were built with the Catalina SDK. Enable layer backing
|
||||
// here by setting QT_MAC_WANTS_LAYER=1, but only if we're running on Big
|
||||
// Sur and our version of Qt doesn't have a fix for QTBUG-87014.
|
||||
|
||||
// We'll assume that it will be fixed in 5.12.11, 5.15.3, and 6.0.1.
|
||||
// Feel free to add other versions if needed.
|
||||
#define MACOS_LAYER_BACKING_AFFECTED \
|
||||
(QT_VERSION >= QT_VERSION_CHECK(5, 12, 0) && QT_VERSION < QT_VERSION_CHECK(5, 12, 11) \
|
||||
|| (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) && QT_VERSION < QT_VERSION_CHECK(5, 15, 3)) \
|
||||
|| (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 1)) \
|
||||
)
|
||||
|
||||
#if MACOS_LAYER_BACKING_AFFECTED
|
||||
#include <QOperatingSystemVersion>
|
||||
void MacosEnableLayerBacking();
|
||||
#endif // MACOS_LAYER_BACKING_AFFECTED
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
// Don't forget to syncronize with XSD schema.
|
||||
const int userMaterialPlaceholdersQuantity = 20;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user