┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemlistview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-09-20 15:19:11 +0200
committerPeter Penz <[email protected]>2011-09-20 15:20:16 +0200
commit63e1e3bc14b5538027471ee76b6e92d6425ecf0b (patch)
tree35bef15f917b5d53c6a399b06e7f40ee097597be /src/kitemviews/kfileitemlistview.cpp
parent6a75a6167160cacbdbc9210d3ea2a0564f071960 (diff)
Change signature of setVisibleRoles()
Simply use a QList<QByteArray> instead of QHash<QByteArray, int>.
Diffstat (limited to 'src/kitemviews/kfileitemlistview.cpp')
-rw-r--r--src/kitemviews/kfileitemlistview.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp
index d9742945a..c1d98c810 100644
--- a/src/kitemviews/kfileitemlistview.cpp
+++ b/src/kitemviews/kfileitemlistview.cpp
@@ -141,10 +141,8 @@ QSizeF KFileItemListView::itemSizeHint(int index) const
// For each row exactly one role is shown. Calculate the maximum required width that is necessary
// to show all roles without horizontal clipping.
qreal maximumRequiredWidth = 0.0;
- QHashIterator<QByteArray, int> it(visibleRoles());
- while (it.hasNext()) {
- it.next();
- const QByteArray& role = it.key();
+
+ foreach (const QByteArray& role, visibleRoles()) {
const QString text = values[role].toString();
const qreal requiredWidth = option.fontMetrics.width(text);
maximumRequiredWidth = qMax(maximumRequiredWidth, requiredWidth);
@@ -178,13 +176,8 @@ QHash<QByteArray, QSizeF> KFileItemListView::visibleRoleSizes() const
const int itemCount = model()->count();
for (int i = 0; i < itemCount; ++i) {
- QHashIterator<QByteArray, int> it(visibleRoles());
- while (it.hasNext()) {
- it.next();
- const QByteArray& visibleRole = it.key();
-
+ foreach (const QByteArray& visibleRole, visibleRoles()) {
QSizeF maxSize = sizes.value(visibleRole, QSizeF(0, 0));
-
const QSizeF itemSize = visibleRoleSizeHint(i, visibleRole);
maxSize = maxSize.expandedTo(itemSize);
sizes.insert(visibleRole, maxSize);
@@ -274,7 +267,7 @@ void KFileItemListView::onOffsetChanged(qreal current, qreal previous)
triggerVisibleIndexRangeUpdate();
}
-void KFileItemListView::onVisibleRolesChanged(const QHash<QByteArray, int>& current, const QHash<QByteArray, int>& previous)
+void KFileItemListView::onVisibleRolesChanged(const QList<QByteArray>& current, const QList<QByteArray>& previous)
{
Q_UNUSED(previous);
@@ -283,7 +276,7 @@ void KFileItemListView::onVisibleRolesChanged(const QHash<QByteArray, int>& curr
// KFileItemModel does not distinct between "visible" and "invisible" roles.
// Add all roles that are mandatory for having a working KFileItemListView:
- QSet<QByteArray> keys = current.keys().toSet();
+ QSet<QByteArray> keys = current.toSet();
QSet<QByteArray> roles = keys;
roles.insert("iconPixmap");
roles.insert("iconName");