diff options
| author | Peter Penz <[email protected]> | 2012-03-27 00:44:39 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-03-27 00:48:34 +0200 |
| commit | 793311dac163592a8b63fc4859fdc054d7a22022 (patch) | |
| tree | 9645cd870530072b23d422d51fd0515f74de6c1f /src/kitemviews/kitemlistview.cpp | |
| parent | 8c986e22fd8fa34ea6c29ad2e88e08c2f9b34bf2 (diff) | |
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.
Diffstat (limited to 'src/kitemviews/kitemlistview.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistview.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
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<QByteArray, qreal> 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); } |
