From 06e89e5442c6d7346ca692361cbda091afba0cd8 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Thu, 30 Jun 2022 02:54:37 -0500 Subject: [PATCH] Fix some issues with scaling on smaller screens. --- src/installerprompt.cpp | 14 ++++++++++++-- src/installerprompt.ui | 14 +++++++++++++- src/main.cpp | 3 +-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/installerprompt.cpp b/src/installerprompt.cpp index 7e79890..811da22 100644 --- a/src/installerprompt.cpp +++ b/src/installerprompt.cpp @@ -1,4 +1,5 @@ #include +#include #include "installerprompt.h" #include "./ui_installerprompt.h" @@ -8,13 +9,22 @@ InstallerPrompt::InstallerPrompt(QWidget *parent) { ui->setupUi(this); - // Set the background image, and let it change with the release + // Set the background image and scale it QPixmap bg("../img/background.png"); - bg = bg.scaled(this->size(), Qt::IgnoreAspectRatio); + QScreen *screen = QGuiApplication::primaryScreen(); + QRect screenGeometry = screen->geometry(); + + int height = screenGeometry.height(); + int width = screenGeometry.width(); + bg = bg.scaled(width, height, Qt::KeepAspectRatio); + QPalette palette; palette.setBrush(QPalette::Window, bg); this->setPalette(palette); + // Resize the layout widget to the screen size. + ui->gridLayoutWidget->resize(width, height); + // Set the button colors QString css = "background-color: rgba(0, 104, 200, 100); color: white; border-radius: 15px;"; ui->tryLubuntu->setAttribute(Qt::WA_TranslucentBackground); diff --git a/src/installerprompt.ui b/src/installerprompt.ui index 87068a0..cac23f0 100644 --- a/src/installerprompt.ui +++ b/src/installerprompt.ui @@ -6,9 +6,21 @@ 0 0 + 680 + 420 + + + + + 680 + 420 + + + + 1920 1080 - + Try or Install Lubuntu diff --git a/src/main.cpp b/src/main.cpp index 3f8ac49..5caf446 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,7 +6,6 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); InstallerPrompt w; - w.setWindowState(Qt::WindowFullScreen); - w.show(); + w.showFullScreen(); return a.exec(); }