From d30b21026c5b522a261b9aab1ea0eb07dd7dcf88 Mon Sep 17 00:00:00 2001 From: "J.D. Purcell" Date: Sat, 4 Jan 2025 22:38:42 -0500 Subject: [PATCH] Clean up screen size detection code Also set a minimum, since it isn't working right in the Qt6 AppImage --- src/qvimagecore.cpp | 16 ++-------------- src/qvimagecore.h | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/qvimagecore.cpp b/src/qvimagecore.cpp index 93492f05..f2ee17b3 100644 --- a/src/qvimagecore.cpp +++ b/src/qvimagecore.cpp @@ -29,23 +29,11 @@ QVImageCore::QVImageCore(QObject *parent) : QObject(parent) loadPixmap(loadFutureWatcher.result()); }); - const auto screenList = QGuiApplication::screens(); - for (auto const &screen : screenList) + for (auto const &screen : QGuiApplication::screens()) { - int largerDimension; - if (screen->size().height() > screen->size().width()) - { - largerDimension = screen->size().height(); - } - else - { - largerDimension = screen->size().width(); - } - + const int largerDimension = qMax(screen->size().width(), screen->size().height()); if (largerDimension > largestDimension) - { largestDimension = largerDimension; - } } // Connect to settings signal diff --git a/src/qvimagecore.h b/src/qvimagecore.h index a510c0ea..c1ab605e 100644 --- a/src/qvimagecore.h +++ b/src/qvimagecore.h @@ -118,7 +118,7 @@ class QVImageCore : public QObject QSet preloadsInProgress; QString waitingOnPreloadPath; - int largestDimension {0}; + int largestDimension {1920}; bool waitingOnLoad {false}; };