From 56766097bd5c90b564d833edc5c3c0e67be43dde Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 25 Sep 2021 05:59:01 +0200 Subject: compat/qt-dpi: get rid of mixin crap --- compat/qt-dpi.hpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'compat') diff --git a/compat/qt-dpi.hpp b/compat/qt-dpi.hpp index 01659c8a..fc17a062 100644 --- a/compat/qt-dpi.hpp +++ b/compat/qt-dpi.hpp @@ -3,17 +3,22 @@ #include #include +static inline double screen_dpi(const QPaintDevice* widget) +{ + const auto& x = *widget; +#ifdef _WIN32 + return std::max(x.devicePixelRatioF(), 1.); +#else + return std::max(std::max(x.logicalDpiX()/(double)x.physicalDpiX(), x.devicePixelRatioF()), 1.); +#endif +} + template struct screen_dpi_mixin { protected: double screen_dpi() const { - const auto& x = *static_cast(this); -#ifdef _WIN32 - return std::max(x.devicePixelRatioF(), 1.); -#else - return std::max(std::max(x.logicalDpiX()/(double)x.physicalDpiX(), x.devicePixelRatioF()), 1.); -#endif + return ::screen_dpi(static_cast(this)); } }; -- cgit v1.2.3