Skip to content

Commit

Permalink
Clean up screen size detection code
Browse files Browse the repository at this point in the history
Also set a minimum, since it isn't working right in the Qt6 AppImage
  • Loading branch information
jdpurcell committed Jan 5, 2025
1 parent b803016 commit d30b210
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
16 changes: 2 additions & 14 deletions src/qvimagecore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/qvimagecore.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class QVImageCore : public QObject
QSet<QString> preloadsInProgress;
QString waitingOnPreloadPath;

int largestDimension {0};
int largestDimension {1920};

bool waitingOnLoad {false};
};
Expand Down

0 comments on commit d30b210

Please sign in to comment.