From fd9959ce4104fd4b5741c9f03cac0162e8a6ecb8 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Mar 2021 19:03:59 +0100 Subject: [PATCH] Gui: [skip ci] show or hide splash image depending on screen size --- src/Gui/Splashscreen.cpp | 12 +++++++++++- src/Gui/Splashscreen.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index 1d4cfc8eb2..80ba2fae7a 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -247,7 +247,7 @@ AboutDialog::AboutDialog(bool showLic, QWidget* parent) QPixmap image = getMainWindow()->splashImage(); // Make sure the image is not too big - int denom = 4; + int denom = 2; if (image.height() > rect.height()/denom || image.width() > rect.width()/denom) { float scale = static_cast(image.width()) / static_cast(image.height()); int width = std::min(image.width(), rect.width()/denom); @@ -276,11 +276,13 @@ AboutDialog::AboutDialog(bool showLic, QWidget* parent) ui->textBrowserLicense->setHtml(lictext); // } ui->tabWidget->setCurrentIndex(0); // always start on the About tab + setupLabels(); showCredits(); showLicenseInformation(); showLibraryInformation(); showCollectionInformation(); + showOrHideImage(rect); } /** @@ -460,6 +462,14 @@ static int getWordSizeOfOS() } }; +void AboutDialog::showOrHideImage(const QRect& rect) +{ + adjustSize(); + if (height() > rect.height()) { + ui->labelSplashPicture->hide(); + } +} + void AboutDialog::setupLabels() { //fonts are rendered smaller on Mac so point size can't be the same for all platforms diff --git a/src/Gui/Splashscreen.h b/src/Gui/Splashscreen.h index f5008be926..eae1f6ef54 100644 --- a/src/Gui/Splashscreen.h +++ b/src/Gui/Splashscreen.h @@ -105,6 +105,7 @@ protected: void showLicenseInformation(); void showLibraryInformation(); void showCollectionInformation(); + void showOrHideImage(const QRect& rect); protected Q_SLOTS: virtual void on_copyButton_clicked();