┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2012-09-24 23:32:51 +0200
committerFrank Reininghaus <[email protected]>2012-09-24 23:32:51 +0200
commit631f97a6d98b426960ceee4cac7e6b3e56d741aa (patch)
tree654d4e90c0ce535e00f5b0e139dfcbee907535d7
parent2fafb33240260bfe679ed54116c9db8b442ab31f (diff)
Revert part of 20b0cb68bf5cc1099fd6e61982817d9e2ae0130c
That commit, which disregarded roles with empty text for the row number calculation in Icons View, caused the problem that icons might jump around while information was retrieved asynchronously because previously empty roles could get a non-empty value, and the corresponding items would need an additional row in the view. Thanks to Hrvoje Senjan for testing this feature in master and reporting this issue early, such that we could fix it quickly and prevent that other users suffer from this bug! CCBUG: 304752
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp28
1 files changed, 3 insertions, 25 deletions
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index 97c8a038b..72d10cf40 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
@@ -68,14 +68,6 @@ QSizeF KStandardItemListWidgetInformant::itemSizeHint(int index, const KItemList
const qreal maxWidth = itemWidth - 2 * option.padding;
QTextLine line;
- int emptyRolesCount = 0;
- foreach (const QByteArray& role, view->visibleRoles()) {
- const QString text = roleText(role, values);
- if (role != "text" && role != "rating" && text.isEmpty()) {
- emptyRolesCount++;
- }
- }
-
// Calculate the number of lines required for wrapping the name
QTextOption textOption(Qt::AlignHCenter);
textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
@@ -92,7 +84,7 @@ QSizeF KStandardItemListWidgetInformant::itemSizeHint(int index, const KItemList
layout.endLayout();
// Add one line for each additional information
- textHeight += (additionalRolesCount - emptyRolesCount) * option.fontMetrics.lineSpacing();
+ textHeight += additionalRolesCount * option.fontMetrics.lineSpacing();
const qreal maxTextHeight = option.maxTextSize.height();
if (maxTextHeight > 0 && textHeight > maxTextHeight) {
@@ -988,17 +980,8 @@ void KStandardItemListWidget::updateIconsLayoutTextCache()
qreal nameHeight = 0;
QTextLine line;
- int emptyRolesCount = 0;
- foreach (const QByteArray& role, visibleRoles()) {
- const QString text = roleText(role, values);
- if (role != "text" && role != "rating" && text.isEmpty()) {
- emptyRolesCount++;
- }
- }
-
const int additionalRolesCount = qMax(visibleRoles().count() - 1, 0);
- const int maxNameLines = (option.maxTextSize.height() / int(lineSpacing)) -
- (additionalRolesCount - emptyRolesCount);
+ const int maxNameLines = (option.maxTextSize.height() / int(lineSpacing)) - additionalRolesCount;
QTextLayout layout(nameTextInfo->staticText.text(), m_customizedFont);
layout.setTextOption(nameTextInfo->staticText.textOption());
@@ -1032,7 +1015,7 @@ void KStandardItemListWidget::updateIconsLayoutTextCache()
nameTextInfo->staticText.setTextWidth(maxWidth);
nameTextInfo->pos = QPointF(padding, widgetHeight -
nameHeight -
- (additionalRolesCount - emptyRolesCount)* lineSpacing -
+ additionalRolesCount * lineSpacing -
padding);
m_textRect = QRectF(padding + (maxWidth - nameWidth) / 2,
nameTextInfo->pos.y(),
@@ -1047,11 +1030,6 @@ void KStandardItemListWidget::updateIconsLayoutTextCache()
}
const QString text = roleText(role, values);
-
- if (role != "text" && role != "rating" && text.isEmpty()) {
- continue;
- }
-
TextInfo* textInfo = m_textInfo.value(role);
textInfo->staticText.setText(text);