From 72af3125a824722d9875d202dd156cd3f7d8fc46 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 4 Feb 2012 22:14:53 +0100 Subject: Icons view: Layout optimizations - Assure that landscape-previews use the whole available width of the icon-area instead of only using the square width. This waste of space occured if the text-width was larger than the icon-width. - Only use one margin instead of two between the icons and the text to improve the visual appearance (thanks to Martin Zilz for the hint) BUG: 293268 FIXED-IN: 4.8.1 CCMAIL: martin@kreativkonzentrat.de --- src/kitemviews/kitemlistview.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/kitemviews/kitemlistview.cpp') diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 67ba01a2f..c671a2e6e 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -1847,16 +1847,20 @@ bool KItemListView::changesItemGridLayout(const QSizeF& newGridSize, const QSize if (m_layouter->scrollOrientation() == Qt::Vertical) { const qreal itemWidth = m_layouter->itemSize().width(); if (itemWidth > 0) { - const int oldColumnCount = m_layouter->size().width() / itemWidth; const int newColumnCount = newGridSize.width() / newItemSize.width(); - return oldColumnCount != newColumnCount; + if (m_model->count() > newColumnCount) { + const int oldColumnCount = m_layouter->size().width() / itemWidth; + return oldColumnCount != newColumnCount; + } } } else { const qreal itemHeight = m_layouter->itemSize().height(); if (itemHeight > 0) { - const int oldRowCount = m_layouter->size().height() / itemHeight; const int newRowCount = newGridSize.height() / newItemSize.height(); - return oldRowCount != newRowCount; + if (m_model->count() > newRowCount) { + const int oldRowCount = m_layouter->size().height() / itemHeight; + return oldRowCount != newRowCount; + } } } -- cgit v1.3