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/kfileitemlistwidget.h | |
| 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/kfileitemlistwidget.h')
| -rw-r--r-- | src/kitemviews/kfileitemlistwidget.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/kitemviews/kfileitemlistwidget.h b/src/kitemviews/kfileitemlistwidget.h index 3e6cf8d2a..76d090040 100644 --- a/src/kitemviews/kfileitemlistwidget.h +++ b/src/kitemviews/kfileitemlistwidget.h @@ -28,6 +28,9 @@ #include <QPointF> #include <QStaticText> +class KItemListView; +class KItemListStyleOption; + class LIBDOLPHINPRIVATE_EXPORT KFileItemListWidget : public KItemListWidget { Q_OBJECT @@ -57,12 +60,20 @@ public: virtual QRectF selectionToggleRect() const; /** - * @return Shown string for the role \p role of the item with the values \p values. + * Implementation of KItemListWidgetCreatorBase::itemSizeHint() when + * using the KItemListWidgetCreator-template. + * + * @see KItemListView */ - // TODO: Move this method to a helper class shared by KFileItemListWidget and - // KFileItemListView to share information that is required to calculate the size hints - // in KFileItemListView and to represent the actual data in KFileItemListWidget. - static QString roleText(const QByteArray& role, const QHash<QByteArray, QVariant>& values); + static QSizeF itemSizeHint(int index, const KItemListView* view); + + /** + * Implementation of KItemListWidgetCreatorBase::preferredRoleColumnWidth() when + * using the KItemListWidgetCreator-template. + * + * @see KItemListView + */ + static qreal preferredRoleColumnWidth(const QByteArray& role, int index, const KItemListView* view); protected: /** @@ -126,9 +137,14 @@ private: void drawSiblingsInformation(QPainter* painter); static QPixmap pixmapForIcon(const QString& name, int size); - static TextId roleTextId(const QByteArray& role); static void applyCutEffect(QPixmap& pixmap); static void applyHiddenEffect(QPixmap& pixmap); + static TextId roleTextId(const QByteArray& role); + + /** + * @return Shown string for the role \p role of the item with the values \p values. + */ + static QString roleText(const QByteArray& role, const QHash<QByteArray, QVariant>& values); private: bool m_isCut; |
