From: Frank Reininghaus Date: Tue, 7 Aug 2012 20:52:31 +0000 (+0200) Subject: Fix the size of the rating stars in Icons View X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/5ae3d9c0aefeeaecc2c8f81e71907af5188b0957 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! CCBUG: 302624 REVIEW: 105830 (cherry picked from commit 146c77eaa226915cd3cd01e112fcde42fd8c06c4) --- diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index e584c0678..5b0a0b741 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); } @@ -921,7 +921,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; } @@ -1037,6 +1037,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();