Use a scrollbar when there are too many drives

Closes #9
This commit is contained in:
spiros
2024-06-20 22:06:29 +03:00
parent 44209e3666
commit e558fda185
2 changed files with 34 additions and 2 deletions

View File

@@ -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<QLabel *>(ui->centralwidget->findChild<QLabel*>("diskName"));
temperatureValue = qobject_cast<QLabel *>(ui->centralwidget->findChild<QLabel*>("temperatureValueLabel"));

View File

@@ -33,7 +33,36 @@
<item row="0" column="0">
<layout class="QHBoxLayout" name="disks">
<item>
<layout class="QHBoxLayout" name="horizontalLayout"/>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>780</width>
<height>16</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
</layout>
</item>