From 7e112547219ad97cadf65c214d0b4ebdf12830c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 3 Apr 2019 23:52:43 +0200 Subject: [PATCH] can't close() when we have just have called show() before. Fixing lp1807450 --- src/library/dlgcoverartfullsize.cpp | 48 +++++++++++++---------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/src/library/dlgcoverartfullsize.cpp b/src/library/dlgcoverartfullsize.cpp index 6f689a37952..83e09774dea 100644 --- a/src/library/dlgcoverartfullsize.cpp +++ b/src/library/dlgcoverartfullsize.cpp @@ -117,33 +117,29 @@ void DlgCoverArtFullSize::slotCoverFound(const QObject* pRequestor, // qDebug() << "DlgCoverArtFullSize::slotCoverFound" << pRequestor << info // << pixmap.size(); m_pixmap = pixmap; - if (m_pixmap.isNull()) { - close(); - } else { - // Scale down dialog if the pixmap is larger than the screen. - // Use 90% of screen size instead of 100% to prevent an issue with - // whitespace appearing on the side when resizing a window whose - // borders touch the edges of the screen. - QSize dialogSize = m_pixmap.size(); - const QSize availableScreenSpace = - QApplication::desktop()->availableGeometry().size() * 0.9; - if (dialogSize.height() > availableScreenSpace.height()) { - dialogSize.scale(dialogSize.width(), availableScreenSpace.height(), - Qt::KeepAspectRatio); - } else if (dialogSize.width() > availableScreenSpace.width()) { - dialogSize.scale(availableScreenSpace.width(), dialogSize.height(), - Qt::KeepAspectRatio); - } - QPixmap resizedPixmap = m_pixmap.scaled(size(), - Qt::KeepAspectRatio, Qt::SmoothTransformation); - coverArt->setPixmap(resizedPixmap); - // center the window - setGeometry(QStyle::alignedRect( - Qt::LeftToRight, - Qt::AlignCenter, - dialogSize, - QApplication::desktop()->availableGeometry())); + // Scale down dialog if the pixmap is larger than the screen. + // Use 90% of screen size instead of 100% to prevent an issue with + // whitespace appearing on the side when resizing a window whose + // borders touch the edges of the screen. + QSize dialogSize = m_pixmap.size(); + const QSize availableScreenSpace = + QApplication::desktop()->availableGeometry().size() * 0.9; + if (dialogSize.height() > availableScreenSpace.height()) { + dialogSize.scale(dialogSize.width(), availableScreenSpace.height(), + Qt::KeepAspectRatio); + } else if (dialogSize.width() > availableScreenSpace.width()) { + dialogSize.scale(availableScreenSpace.width(), dialogSize.height(), + Qt::KeepAspectRatio); } + QPixmap resizedPixmap = m_pixmap.scaled(size(), + Qt::KeepAspectRatio, Qt::SmoothTransformation); + coverArt->setPixmap(resizedPixmap); + // center the window + setGeometry(QStyle::alignedRect( + Qt::LeftToRight, + Qt::AlignCenter, + dialogSize, + QApplication::desktop()->availableGeometry())); } }