┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-02-04 22:14:53 +0100
committerPeter Penz <[email protected]>2012-02-04 22:22:19 +0100
commit72af3125a824722d9875d202dd156cd3f7d8fc46 (patch)
treecac6d24b77d463f264d6b82478fde44b89a38081 /src/kitemviews/kitemlistview.cpp
parenta2a78c98fc9737fcd7a126790f88b40fdcc38ae6 (diff)
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: [email protected]
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
-rw-r--r--src/kitemviews/kitemlistview.cpp12
1 files changed, 8 insertions, 4 deletions
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;
+ }
}
}