mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-02-03 19:07:39 +01:00
Change use of QLabel::pixmap
This commit is contained in:
parent
c2f90a20df
commit
07282e3de6
@ -280,7 +280,7 @@ void AlbumCoverChoiceController::ShowCover(const Song &song, const QPixmap &pixm
|
||||
label->setPixmap(pixmap);
|
||||
|
||||
// Add (WxHpx) to the title before possibly resizing
|
||||
title_text += " (" + QString::number(label->pixmap()->width()) + "x" + QString::number(label->pixmap()->height()) + "px)";
|
||||
title_text += " (" + QString::number(pixmap.width()) + "x" + QString::number(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.
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
@ -295,19 +295,23 @@ void AlbumCoverChoiceController::ShowCover(const Song &song, const QPixmap &pixm
|
||||
// Resize differently if monitor is in portrait mode
|
||||
if (desktop_width < desktop_height) {
|
||||
const int new_width = (double)desktop_width * 0.95;
|
||||
if (new_width < label->pixmap()->width()) {
|
||||
label->setPixmap(label->pixmap()->scaledToWidth(new_width, Qt::SmoothTransformation));
|
||||
if (new_width < pixmap.width()) {
|
||||
label->setPixmap(pixmap.scaledToWidth(new_width, Qt::SmoothTransformation));
|
||||
}
|
||||
}
|
||||
else {
|
||||
const int new_height = (double)desktop_height * 0.85;
|
||||
if (new_height < label->pixmap()->height()) {
|
||||
label->setPixmap(label->pixmap()->scaledToHeight(new_height, Qt::SmoothTransformation));
|
||||
if (new_height < pixmap.height()) {
|
||||
label->setPixmap(pixmap.scaledToHeight(new_height, Qt::SmoothTransformation));
|
||||
}
|
||||
}
|
||||
|
||||
dialog->setWindowTitle(title_text);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||
dialog->setFixedSize(label->pixmap(Qt::ReturnByValue).size());
|
||||
#else
|
||||
dialog->setFixedSize(label->pixmap()->size());
|
||||
#endif
|
||||
dialog->show();
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user