Change use of QLabel::pixmap
This commit is contained in:
@@ -280,7 +280,7 @@ void AlbumCoverChoiceController::ShowCover(const Song &song, const QPixmap &pixm
|
|||||||
label->setPixmap(pixmap);
|
label->setPixmap(pixmap);
|
||||||
|
|
||||||
// Add (WxHpx) to the title before possibly resizing
|
// 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 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))
|
#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
|
// Resize differently if monitor is in portrait mode
|
||||||
if (desktop_width < desktop_height) {
|
if (desktop_width < desktop_height) {
|
||||||
const int new_width = (double)desktop_width * 0.95;
|
const int new_width = (double)desktop_width * 0.95;
|
||||||
if (new_width < label->pixmap()->width()) {
|
if (new_width < pixmap.width()) {
|
||||||
label->setPixmap(label->pixmap()->scaledToWidth(new_width, Qt::SmoothTransformation));
|
label->setPixmap(pixmap.scaledToWidth(new_width, Qt::SmoothTransformation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const int new_height = (double)desktop_height * 0.85;
|
const int new_height = (double)desktop_height * 0.85;
|
||||||
if (new_height < label->pixmap()->height()) {
|
if (new_height < pixmap.height()) {
|
||||||
label->setPixmap(label->pixmap()->scaledToHeight(new_height, Qt::SmoothTransformation));
|
label->setPixmap(pixmap.scaledToHeight(new_height, Qt::SmoothTransformation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->setWindowTitle(title_text);
|
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());
|
dialog->setFixedSize(label->pixmap()->size());
|
||||||
|
#endif
|
||||||
dialog->show();
|
dialog->show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user