Do not divide by zero when the last group is collapsed.
This commit is contained in:
parent
1f6a484cb2
commit
ba401922e1
@ -116,19 +116,20 @@ void GroupView::updateGeometries()
|
|||||||
int totalHeight = 0;
|
int totalHeight = 0;
|
||||||
// top margin
|
// top margin
|
||||||
totalHeight += m_categoryMargin;
|
totalHeight += m_categoryMargin;
|
||||||
|
int itemScroll = 0;
|
||||||
for (auto category : m_groups)
|
for (auto category : m_groups)
|
||||||
{
|
{
|
||||||
category->m_verticalPosition = totalHeight;
|
category->m_verticalPosition = totalHeight;
|
||||||
totalHeight += category->totalHeight() + m_categoryMargin;
|
totalHeight += category->totalHeight() + m_categoryMargin;
|
||||||
|
if(!itemScroll && category->totalHeight() != 0)
|
||||||
|
{
|
||||||
|
itemScroll = category->contentHeight() / category->numRows();
|
||||||
}
|
}
|
||||||
auto category = m_groups.last();
|
}
|
||||||
int itemScroll = category->contentHeight() / category->numRows();
|
// do not divide by zero
|
||||||
/*
|
if(itemScroll == 0)
|
||||||
// remove the last margin (we don't want it)
|
itemScroll = 64;
|
||||||
totalHeight -= m_categoryMargin;
|
|
||||||
// add a margin on top...
|
|
||||||
totalHeight += m_categoryMargin;
|
|
||||||
*/
|
|
||||||
totalHeight += m_bottomMargin;
|
totalHeight += m_bottomMargin;
|
||||||
verticalScrollBar()->setSingleStep ( itemScroll );
|
verticalScrollBar()->setSingleStep ( itemScroll );
|
||||||
const int rowsPerPage = qMax ( viewport()->height() / itemScroll, 1 );
|
const int rowsPerPage = qMax ( viewport()->height() / itemScroll, 1 );
|
||||||
|
Loading…
Reference in New Issue
Block a user