Use current screen, not primary screen

This commit is contained in:
Jonas Kvinge 2020-01-05 19:14:25 +01:00
parent 66e5ccb9cc
commit aa255aa7e6
1 changed files with 7 additions and 2 deletions

View File

@ -24,6 +24,7 @@
#include <QtGlobal>
#include <QGuiApplication>
#include <QScreen>
#include <QWindow>
#include <QWidget>
#include <QDialog>
#include <QDir>
@ -283,8 +284,12 @@ void AlbumCoverChoiceController::ShowCover(const Song &song, const QPixmap &pixm
title_text += " (" + QString::number(label->pixmap()->width()) + "x" + QString::number(label->pixmap()->height()) + "px)";
// If the cover is larger than the screen, resize the window 85% seems to be enough to account for title bar and taskbar etc.
QScreen *screen = QGuiApplication::primaryScreen();
QRect screenGeometry = screen->geometry();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QScreen *screen = QWidget::screen();
#else
QScreen *screen = (window() && window()->windowHandle() ? window()->windowHandle()->screen() : QGuiApplication::primaryScreen());
#endif
QRect screenGeometry = screen->availableGeometry();
int desktop_height = screenGeometry.height();
int desktop_width = screenGeometry.width();