From b3b2114c45afdfafa2d7e00a5496504c3b5d48f7 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Sun, 18 Aug 2024 20:11:37 +0200 Subject: [PATCH] Fix SetHeightToContentHeight() not respecting diffrently sized rows --- lib/utils/ui-helpers.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/utils/ui-helpers.cpp b/lib/utils/ui-helpers.cpp index f7f5bb02..c1575ca7 100644 --- a/lib/utils/ui-helpers.cpp +++ b/lib/utils/ui-helpers.cpp @@ -64,8 +64,12 @@ void SetHeightToContentHeight(QListWidget *list) } int scrollBarHeight = getHorizontalScrollBarHeight(list); - int height = (list->sizeHintForRow(0) + list->spacing()) * nrItems + - 2 * list->frameWidth() + scrollBarHeight; + int height = 2 * list->frameWidth() + scrollBarHeight; + + for (int i = 0; i < nrItems; i++) { + height += (list->sizeHintForRow(i) + list->spacing()); + } + list->setMinimumHeight(height); list->setMaximumHeight(height); }