From 793311dac163592a8b63fc4859fdc054d7a22022 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 27 Mar 2012 00:44:39 +0200 Subject: KItemListView interface and implementation simplification - Remove KItemListView::preferredRoleColumnWidth() and allow implementing this as part of derived classes from KItemListWidget. Those derived classes are aware about the layout and hence also can provide the preferred role width. - Make KItemListView::itemSizeHint() non-virtual and also allow implementing the size hint as part of derived classes from KItemListWidget. --- src/kitemviews/kitemlistview.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/kitemviews/kitemlistview.cpp') diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 7d1cd6e71..8a18991a0 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -510,15 +510,7 @@ int KItemListView::lastVisibleIndex() const QSizeF KItemListView::itemSizeHint(int index) const { - Q_UNUSED(index); - return itemSize(); -} - -qreal KItemListView::preferredRoleColumnWidth(const QByteArray& role, int index) const -{ - Q_UNUSED(role); - Q_UNUSED(index); - return 100; + return m_widgetCreator->itemSizeHint(index, this); } void KItemListView::setSupportsItemExpanding(bool supportsExpanding) @@ -1915,7 +1907,7 @@ QHash KItemListView::preferredColumnWidths(const KItemRangeLi for (int i = startIndex; i <= endIndex; ++i) { foreach (const QByteArray& visibleRole, visibleRoles()) { qreal maxWidth = widths.value(visibleRole, 0); - const qreal width = preferredRoleColumnWidth(visibleRole, i); + const qreal width = m_widgetCreator->preferredRoleColumnWidth(visibleRole, i, this); maxWidth = qMax(width, maxWidth); widths.insert(visibleRole, maxWidth); } -- cgit v1.3