From b930dd608bf95ecc3f89007313ba8ab8b1935ee5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 1 Aug 2019 11:22:41 +0200 Subject: video: reuse working dpi check --- compat/qt-dpi.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 compat/qt-dpi.hpp (limited to 'compat') diff --git a/compat/qt-dpi.hpp b/compat/qt-dpi.hpp new file mode 100644 index 00000000..01659c8a --- /dev/null +++ b/compat/qt-dpi.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include +#include + +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 + } +}; -- cgit v1.2.3