Fix SetHeightToContentHeight() not respecting diffrently sized rows

This commit is contained in:
WarmUpTill 2024-08-18 20:11:37 +02:00 committed by WarmUpTill
parent 510f83246e
commit b3b2114c45

View File

@ -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);
}