From 9d8cbe5efd955dcaa533cfc0d577be3561761c0f Mon Sep 17 00:00:00 2001 From: Olivier Le Doeuff Date: Wed, 21 Aug 2024 10:29:21 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Get=20rid=20of=20HighDpi=20fix?= =?UTF-8?q?=20that=20is=20now=20native=20in=20Qt6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 8 ----- src/Qaterial/Details/HighDpiFix.cpp | 50 ----------------------------- 2 files changed, 58 deletions(-) delete mode 100644 src/Qaterial/Details/HighDpiFix.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b3c9307..bbb2c678 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,6 @@ set(QATERIAL_ENABLE_PCH ON CACHE BOOL Only work if CMake support 'target_precompile_headers'. \" This can speed up compilation time.") set(QATERIAL_ENABLE_UNITY_BUILD ON CACHE BOOL "Qaterial source files will be combined into batches for faster compilation.") -set(QATERIAL_ENABLE_HIGHDPIFIX ON CACHE BOOL "Fix high dpi at application startup without any additional code") set(QATERIAL_ENABLE_ICONS ON CACHE BOOL "Embed Mdi Icons in Qaterial.Icons (MATERIALDESIGNICONS_REPOSITORY)") set(QATERIAL_ICONS "*.svg" CACHE STRING "Filter embedded icons") @@ -79,7 +78,6 @@ if(QATERIAL_VERBOSE) message(STATUS "QATERIAL_FOLDER_PREFIX : ${QATERIAL_FOLDER_PREFIX}") message(STATUS "QATERIAL_ENABLE_PCH : ${QATERIAL_ENABLE_PCH}") message(STATUS "QATERIAL_ENABLE_UNITY_BUILD : ${QATERIAL_ENABLE_UNITY_BUILD}") - message(STATUS "QATERIAL_ENABLE_HIGHDPIFIX : ${QATERIAL_ENABLE_HIGHDPIFIX}") message(STATUS "QATERIAL_ENABLE_ICONS : ${QATERIAL_ENABLE_ICONS}") message(STATUS "QATERIAL_ICONS : ${QATERIAL_ICONS}") @@ -179,12 +177,6 @@ set(QATERIAL_SRCS ${QATERIAL_SOURCE_DIR}/Details/Utils.cpp ) -if(QATERIAL_ENABLE_HIGHDPIFIX) - set(QATERIAL_SRCS ${QATERIAL_SRCS} - ${QATERIAL_SOURCE_DIR}/Details/HighDpiFix.cpp - ) -endif() - source_group(TREE "${QATERIAL_SOURCE_DIR}" FILES ${QATERIAL_SRCS}) source_group(TREE "${QATERIAL_ICONS_OUTPUT_FOLDER}/Qaterial" FILES ${QATERIAL_GEN_SRCS}) diff --git a/src/Qaterial/Details/HighDpiFix.cpp b/src/Qaterial/Details/HighDpiFix.cpp deleted file mode 100644 index b2b4fa32..00000000 --- a/src/Qaterial/Details/HighDpiFix.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// MIT License -// -// Copyright (c) 2020 Olivier Le Doeuff -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -#include -#ifdef Q_OS_WIN -# include -#endif - -namespace qaterial { - -// Fix dpi at application startup -class HighDpiFix -{ - HighDpiFix() - { -#ifdef Q_OS_WIN -# if _WIN32_WINNT >= 0x0600 - ::SetProcessDPIAware(); -# endif -#endif // Q_OS_WIN - -#if QT_VERSION_MAJOR < 6 // AA_EnableHighDpiScaling is enabled by default on qt6 - QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); -#endif - } - static HighDpiFix singleton; -}; - -HighDpiFix HighDpiFix::singleton; - -}