]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kstandarditemlistwidget.h
Calculate all item size hints at once.
[dolphin.git] / src / kitemviews / kstandarditemlistwidget.h
index ecf3a3b606116228c8c2b36537fb80a4844b75d3..ca198c36b5c4693fdbf7a1a00d9d3e7f8c383380 100644 (file)
@@ -38,12 +38,21 @@ public:
     KStandardItemListWidgetInformant();
     virtual ~KStandardItemListWidgetInformant();
 
-    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,
                                            const KItemListView* view) const;
 protected:
+    /**
+     * @return The value of the "text" role. The default implementation returns
+     *         view->model()->data(index)["text"]. If a derived class can
+     *         prevent the (possibly expensive) construction of the
+     *         QHash<QByteArray, QVariant> returned by KItemModelBase::data(int),
+     *         it can reimplement this function.
+     */
+    virtual QString itemText(int index, const KItemListView* view) const;
+
     /**
      * @return String representation of the role \a role. The representation of
      *         a role might depend on other roles, so the values of all roles
@@ -52,6 +61,10 @@ protected:
     virtual QString roleText(const QByteArray& role,
                              const QHash<QByteArray, QVariant>& values) const;
 
+    void calculateIconsLayoutItemSizeHints(QVector<QSizeF>& sizeHints, const KItemListView* view) const;
+    void calculateCompactLayoutItemSizeHints(QVector<QSizeF>& sizeHints, const KItemListView* view) const;
+    void calculateDetailsLayoutItemSizeHints(QVector<QSizeF>& sizeHints, const KItemListView* view) const;
+
     friend class KStandardItemListWidget; // Accesses roleText()
 };
 
@@ -186,7 +199,7 @@ private:
      */
     void closeRoleEditor();
 
-    static QPixmap pixmapForIcon(const QString& name, int size);
+    static QPixmap pixmapForIcon(const QString& name, const QStringList& overlays, int size);
 
     /**
      * @return Preferred size of the rating-image based on the given