mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 09:05:57 -05:00
Resize list to minimum necessary height
This commit is contained in:
@@ -962,3 +962,14 @@ bool listMoveDown(QListWidget *list)
|
||||
list->setCurrentRow(index + 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
void setHeightToContentHeight(QListWidget *list)
|
||||
{
|
||||
auto nrItems = list->count();
|
||||
if (nrItems == 0) {
|
||||
list->setMaximumHeight(0);
|
||||
} else {
|
||||
list->setMaximumHeight(list->sizeHintForRow(0) * nrItems +
|
||||
2 * list->frameWidth());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user