@@ -67,8 +67,9 @@ QPointF OrganicGrid::positionForIndex(int modelIndex) const
6767{
6868 const qreal moduleHeight = m_smallDelegateSize.height() + rowSpacing() + m_bigDelegateSize.height();
6969 const qreal moduleWidth = m_smallDelegateSize.width() * 2 + columnSpacing() * 2 + m_bigDelegateSize.width();
70− const int rowIndex = floor(modelIndex / (m_numberOfModulesPerRow * 6));
71− const int columnIndex = floor((modelIndex - rowIndex * m_numberOfModulesPerRow * 6) / 6);
70+ const int itemsPerRow = m_numberOfModulesPerRow * 6;
71+ const int rowIndex = floor(modelIndex / itemsPerRow);
72+ const int columnIndex = floor((modelIndex - rowIndex * itemsPerRow) / 6);
7273
7374 qreal yPos = (moduleHeight + rowSpacing()) * rowIndex;
7475 const int moduleIndex = modelIndex % 6;
@@ -223,10 +224,11 @@ void OrganicGrid::calculateImplicitHeight()
223224{
224225 const qreal moduleHeight = m_smallDelegateSize.height() + rowSpacing() + m_bigDelegateSize.height();
225226 const int itemCount = !model() ? 0 : model()->rowCount();
226− const int fullRows = floor(itemCount / (m_numberOfModulesPerRow * 6));
227+ const int itemsPerRow = m_numberOfModulesPerRow * 6;
228+ const int fullRows = floor(itemCount / itemsPerRow);
227229 const qreal fullRowsHeight = fullRows == 0 ? 0 : fullRows * moduleHeight + rowSpacing() * (fullRows - 1);
228230
229− const int remainingItems = itemCount - fullRows * m_numberOfModulesPerRow * 6;
231+ const int remainingItems = itemCount - fullRows * itemsPerRow;
230232 if (remainingItems == 0) {
231233 setImplicitHeight(fullRowsHeight);
232234 } else if (remainingItems <= 2) {