┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2012-08-07 22:52:31 +0200
committerFrank Reininghaus <[email protected]>2012-08-07 22:54:35 +0200
commite534bc08f05a7218cf46fc5137a25304916530ee (patch)
tree2535cd5c5f67bbf62a8dc68d634e4e6cae32de13 /src
parentd7f18f528452c954cc2e2490d1e24d20f9b5ccdc (diff)
Fix the size of the rating stars in Icons View
Moreover, make sure that the selection rectangle is large enough to include the stars. Patch by Emmanuel Pescosta. Thanks for the patch! BUG: 302624 FIXED-IN: 4.9.1 REVIEW: 105830
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index 9cdb60e24..555449a32 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
@@ -291,7 +291,7 @@ void KStandardItemListWidget::paint(QPainter* painter, const QStyleOptionGraphic
QPointF pos = ratingTextInfo->pos;
const Qt::Alignment align = ratingTextInfo->staticText.textOption().alignment();
if (align & Qt::AlignHCenter) {
- pos.rx() += (size().width() - m_rating.width()) / 2;
+ pos.rx() += (size().width() - m_rating.width()) / 2 - 2;
}
painter->drawPixmap(pos, m_rating);
}
@@ -913,7 +913,7 @@ void KStandardItemListWidget::updateTextsCache()
const qreal availableWidth = (m_layout == DetailsLayout)
? columnWidth("rating") - columnPadding(option)
- : m_textRect.width();
+ : size().width();
if (ratingSize.width() > availableWidth) {
ratingSize.rwidth() = availableWidth;
}
@@ -1029,6 +1029,9 @@ void KStandardItemListWidget::updateIconsLayoutTextCache()
const QString elidedText = m_customizedFontMetrics.elidedText(text, Qt::ElideRight, maxWidth);
textInfo->staticText.setText(elidedText);
requiredWidth = m_customizedFontMetrics.width(elidedText);
+ } else if (role == "rating") {
+ // Use the width of the rating pixmap, because the rating text is empty.
+ requiredWidth = m_rating.width();
}
}
layout.endLayout();