Merge pull request #8012 from CozmoP/gridfix

Qt: fix bug when grid item width > grid width
This commit is contained in:
Twinaphex 2019-01-16 01:49:13 +01:00 committed by GitHub
commit 4e73be94b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 59 additions and 45 deletions

View File

@ -94,6 +94,18 @@ void GridView::calculateRectsIfNecessary() const
const int maxWidth = viewport()->width();
if (m_size + m_spacing * 2 > maxWidth)
{
m_rectForRow[0] = QRectF(x, y, m_size, m_size);
for (row = 1; row < model()->rowCount(); ++row)
{
y += m_size + m_spacing;
m_rectForRow[row] = QRectF(x, y, m_size, m_size);
}
}
else
{
switch (m_viewMode)
{
case Anchored:
@ -154,6 +166,8 @@ void GridView::calculateRectsIfNecessary() const
}
break;
}
}
m_idealHeight = y + m_size + m_spacing;
m_hashIsDirty = false;
viewport()->update();