From e558fda185ca8c44c917dddb2fa27313c42e6d5d Mon Sep 17 00:00:00 2001 From: spiros Date: Thu, 20 Jun 2024 22:06:29 +0300 Subject: [PATCH] Use a scrollbar when there are too many drives Closes #9 --- src/mainwindow.cpp | 5 ++++- src/mainwindow.ui | 31 ++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2f2ef45..bb0f574 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -13,7 +13,10 @@ MainWindow::MainWindow(QWidget *parent) buttonGroup = new QButtonGroup(this); buttonGroup->setExclusive(true); - horizontalLayout = ui->horizontalLayout; + QWidget *containerWidget = ui->scrollAreaWidgetContents; + horizontalLayout = new QHBoxLayout(containerWidget); + horizontalLayout->setContentsMargins(0, 0, 0, 0); + ui->scrollArea->setWidget(containerWidget); diskName = qobject_cast(ui->centralwidget->findChild("diskName")); temperatureValue = qobject_cast(ui->centralwidget->findChild("temperatureValueLabel")); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 8ae5160..46219de 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -33,7 +33,36 @@ - + + + + 0 + 0 + + + + Qt::ScrollBarPolicy::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 780 + 16 + + + + + 0 + 0 + + + +