From b797eb6a7049a318253bf82be4ecd1237260fdf7 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 12 Mar 2019 15:12:18 +0100 Subject: [PATCH] fix problem that too large splash image make dialog too large --- src/Gui/Splashscreen.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index e097a1c11b..1509b5cbb5 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -26,6 +26,7 @@ # include # include # include +# include # include # include # include @@ -245,7 +246,20 @@ AboutDialog::AboutDialog(bool showLic, QWidget* parent) setModal(true); ui->setupUi(this); - ui->labelSplashPicture->setPixmap(getMainWindow()->splashImage()); + QRect rect = QApplication::desktop()->availableGeometry(); + QPixmap image = getMainWindow()->splashImage(); + + // Make sure the image is not too big + if (image.height() > rect.height()/2 || image.width() > rect.width()/2) { + float scale = static_cast(image.width()) / static_cast(image.height()); + int width = std::min(image.width(), rect.width()/2); + int height = std::min(image.height(), rect.height()/2); + height = std::min(height, static_cast(width / scale)); + width = static_cast(scale * height); + + image = image.scaled(width, height); + } + ui->labelSplashPicture->setPixmap(image); // if (showLic) { // currently disabled. Additional license blocks are always shown. QString info(QLatin1String("SUCH DAMAGES.
")); // any additional piece of text to be added after the main license text goes below.