diff options
| author | Peter Penz <[email protected]> | 2012-02-09 09:57:47 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-02-09 16:05:03 +0100 |
| commit | e29e1cda15973969164d7b7fa805544189a5e172 (patch) | |
| tree | 32dd4650df9320e39884ae060f649259a1e1c5a8 /src | |
| parent | 03415d90783979f8e51880b7950721985fee29bf (diff) | |
Icon-rectangle and selection-toggle optimizations
- No padding should be applied to the icon-rectangle
- Base the selection-toggle size on the icon-size of the style not
the actual pixmap content, as this might lead to smaller selection-toggles
when having pixmap-previews with a small height.
Diffstat (limited to 'src')
| -rw-r--r-- | src/kitemviews/kfileitemlistwidget.cpp | 11 | ||||
| -rw-r--r-- | src/kitemviews/kitemlistviewlayouter.cpp | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index 9fdcbec65..64cc8b449 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -179,7 +179,7 @@ QRectF KFileItemListWidget::selectionToggleRect() const { const_cast<KFileItemListWidget*>(this)->triggerCacheRefreshing(); - const int iconHeight = m_pixmap.height(); + const int iconHeight = styleOption().iconSize; int toggleSize = KIconLoader::SizeSmall; if (iconHeight >= KIconLoader::SizeEnormous) { @@ -196,13 +196,15 @@ QRectF KFileItemListWidget::selectionToggleRect() const // when trying to hit the toggle. const int widgetHeight = size().height(); const int widgetWidth = size().width(); - const int minPadding = 2; + const int minMargin = 2; - if (toggleSize + minPadding * 2 >= widgetHeight) { + if (toggleSize + minMargin * 2 >= widgetHeight) { + pos.rx() -= (widgetHeight - toggleSize) / 2; toggleSize = widgetHeight; pos.setY(0); } - if (toggleSize + minPadding * 2 >= widgetWidth) { + if (toggleSize + minMargin * 2 >= widgetWidth) { + pos.ry() -= (widgetWidth - toggleSize) / 2; toggleSize = widgetWidth; pos.setX(0); } @@ -541,7 +543,6 @@ void KFileItemListWidget::updatePixmapCache() } m_iconRect = QRectF(m_pixmapPos, QSizeF(m_scaledPixmapSize)); - m_iconRect.adjust(-padding, -padding, padding, padding); // Prepare the pixmap that is used when the item gets hovered if (isHovered()) { diff --git a/src/kitemviews/kitemlistviewlayouter.cpp b/src/kitemviews/kitemlistviewlayouter.cpp index 30dd10346..2d02b6725 100644 --- a/src/kitemviews/kitemlistviewlayouter.cpp +++ b/src/kitemviews/kitemlistviewlayouter.cpp @@ -320,7 +320,7 @@ void KItemListViewLayouter::doLayout() m_xPosInc = itemMargin.width(); const int itemCount = m_model->count(); - if (itemCount > m_columnCount) { + if (itemCount > m_columnCount && m_columnWidth >= 32) { // Apply the unused width equally to each column const qreal unusedWidth = size.width() - m_columnCount * m_columnWidth; if (unusedWidth > 0) { |
