┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistview.h
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2014-01-12 23:24:00 +0100
committerEmmanuel Pescosta <[email protected]>2014-01-12 23:24:00 +0100
commit3ff6e83491e2da9678af0bc149e450ff87db5e8d (patch)
tree8a172fb62079c2eef38d8c79b786e0998f9b2d84 /src/kitemviews/kitemlistview.h
parentace34ac134af5bb4b4fcf8cbb11b979ea40ec30f (diff)
Calculate all item size hints at once.
The speed up is really small, but theses changes are mostly straightforward and make the code a bit nicer - break the KStandardItemListWidgetInformant::itemSizeHint beast into three smaller functions. FIXED-IN: 4.13 REVIEW: 112979
Diffstat (limited to 'src/kitemviews/kitemlistview.h')
-rw-r--r--src/kitemviews/kitemlistview.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h
index dbe923086..f39e73a97 100644
--- a/src/kitemviews/kitemlistview.h
+++ b/src/kitemviews/kitemlistview.h
@@ -194,12 +194,12 @@ public:
int lastVisibleIndex() const;
/**
- * @return Required size for the item with the index \p index.
+ * @return Required size for all items in the model.
* The returned value might be larger than KItemListView::itemSize().
* In this case the layout grid will be stretched to assure an
* unclipped item.
*/
- QSizeF itemSizeHint(int index) const;
+ void calculateItemSizeHints(QVector<QSizeF>& sizeHints) const;
/**
* If set to true, items having child-items can be expanded to show the child-items as
@@ -802,7 +802,7 @@ public:
virtual void recycle(KItemListWidget* widget);
- virtual QSizeF itemSizeHint(int index, const KItemListView* view) const = 0;
+ virtual void calculateItemSizeHints(QVector<QSizeF>& sizeHints, const KItemListView* view) const = 0;
virtual qreal preferredRoleColumnWidth(const QByteArray& role,
int index,
@@ -821,7 +821,7 @@ public:
virtual KItemListWidget* create(KItemListView* view);
- virtual QSizeF itemSizeHint(int index, const KItemListView* view) const;
+ virtual void calculateItemSizeHints(QVector<QSizeF>& sizeHints, const KItemListView* view) const;
virtual qreal preferredRoleColumnWidth(const QByteArray& role,
int index,
@@ -854,9 +854,9 @@ KItemListWidget* KItemListWidgetCreator<T>::create(KItemListView* view)
}
template<class T>
-QSizeF KItemListWidgetCreator<T>::itemSizeHint(int index, const KItemListView* view) const
+void KItemListWidgetCreator<T>::calculateItemSizeHints(QVector<QSizeF>& sizeHints, const KItemListView* view) const
{
- return m_informant->itemSizeHint(index, view);
+ return m_informant->calculateItemSizeHints(sizeHints, view);
}
template<class T>