QListView: make sure to respect grid size during dataChanged() handling
When the dataChanged() signal is handled by QIconModeViewBase, the size of the items are recalculated. During this operation the optional grid size is not taken into account which leads to a screwed up layout. This patch adds the missing check similar it is done in doStaticLayout()/doDynamicLayout(). Task-number: QTBUG-45427 Change-Id: Iba7adb44b1510c511a69c289ccb4f168992a6871 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>bb10
parent
a4f9cf2344
commit
937ded010b
|
|
@ -2874,10 +2874,19 @@ void QIconModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand)
|
|||
void QIconModeViewBase::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||
{
|
||||
if (column() >= topLeft.column() && column() <= bottomRight.column()) {
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
int bottom = qMin(items.count(), bottomRight.row() + 1);
|
||||
const QStyleOptionViewItem option = viewOptions();
|
||||
const int bottom = qMin(items.count(), bottomRight.row() + 1);
|
||||
const bool useItemSize = !dd->grid.isValid();
|
||||
for (int row = topLeft.row(); row < bottom; ++row)
|
||||
items[row].resize(itemSize(option, modelIndex(row)));
|
||||
{
|
||||
QSize s = itemSize(option, modelIndex(row));
|
||||
if (!useItemSize)
|
||||
{
|
||||
s.setWidth(qMin(dd->grid.width(), s.width()));
|
||||
s.setHeight(qMin(dd->grid.height(), s.height()));
|
||||
}
|
||||
items[row].resize(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue