Commit 146c77ea authored by Frank Reininghaus's avatar Frank Reininghaus

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
parent 4d39dbc9
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment