┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemlistview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-09-24 00:18:09 +0200
committerPeter Penz <[email protected]>2011-09-24 00:20:24 +0200
commit740e9569327c0026257dfcea38ab2efac4a29d67 (patch)
tree96d09d0f89d8ebd3974522200c5337195bbbfcc8 /src/kitemviews/kfileitemlistview.cpp
parent9ea4d3c70c3765c1ef417642a392465caa31997c (diff)
Fix size-hint calculation in KFileItemListView
The current approach works fine but should be replaced in the longterm by a helper class shared by KFileItemListWidget and KFileItemListView to share information that is required to calculate the size hints in KFileItemListView and to represent the actual data in KFileItemListWidget.
Diffstat (limited to 'src/kitemviews/kfileitemlistview.cpp')
-rw-r--r--src/kitemviews/kfileitemlistview.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp
index 48e7306fc..68bd7bde9 100644
--- a/src/kitemviews/kfileitemlistview.cpp
+++ b/src/kitemviews/kfileitemlistview.cpp
@@ -143,7 +143,7 @@ QSizeF KFileItemListView::itemSizeHint(int index) const
qreal maximumRequiredWidth = 0.0;
foreach (const QByteArray& role, visibleRoles()) {
- const QString text = values[role].toString();
+ const QString text = KFileItemListWidget::roleText(role, values);
const qreal requiredWidth = option.fontMetrics.width(text);
maximumRequiredWidth = qMax(maximumRequiredWidth, requiredWidth);
}
@@ -427,15 +427,14 @@ QSizeF KFileItemListView::visibleRoleSizeHint(int index, const QByteArray& role)
qreal width = m_minimumRolesWidths.value(role, 0);
const qreal height = option.margin * 2 + option.fontMetrics.height();
- const QVariant value = model()->data(index).value(role);
- const QString text = value.toString();
+ const QHash<QByteArray, QVariant> values = model()->data(index);
+ const QString text = KFileItemListWidget::roleText(role, values);
if (!text.isEmpty()) {
const qreal columnMargin = option.margin * 3;
width = qMax(width, qreal(2 * columnMargin + option.fontMetrics.width(text)));
}
if (role == "name") {
- const QHash<QByteArray, QVariant> values = model()->data(index);
Q_ASSERT(values.contains("expansionLevel"));
// Increase the width by the expansion-toggle and the current expansion level