Gui: [skip ci] show or hide splash image depending on screen size

This commit is contained in:
wmayer
2021-03-08 19:03:59 +01:00
parent b185dacdde
commit fd9959ce41
2 changed files with 12 additions and 1 deletions

View File

@@ -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<float>(image.width()) / static_cast<float>(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

View File

@@ -105,6 +105,7 @@ protected:
void showLicenseInformation();
void showLibraryInformation();
void showCollectionInformation();
void showOrHideImage(const QRect& rect);
protected Q_SLOTS:
virtual void on_copyButton_clicked();