KStandardItemListWidgetInformant();
virtual ~KStandardItemListWidgetInformant();
- virtual QSizeF itemSizeHint(int index, const KItemListView* view) const;
+ virtual void calculateItemSizeHints(QVector<qreal>& logicalHeightHints, qreal& logicalWidthHint, 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 The value of the "isLink" role. The default implementation returns false.
+ * The derived class should reimplement this function, when information about
+ * links is available and in usage.
+ */
+ virtual bool itemIsLink(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
virtual QString roleText(const QByteArray& role,
const QHash<QByteArray, QVariant>& values) const;
+ /**
+ * @return A font based on baseFont which is customized for symlinks.
+ */
+ virtual QFont customizedFontForLinks(const QFont& baseFont) const;
+
+ void calculateIconsLayoutItemSizeHints(QVector<qreal>& logicalHeightHints, qreal& logicalWidthHint, const KItemListView* view) const;
+ void calculateCompactLayoutItemSizeHints(QVector<qreal>& logicalHeightHints, qreal& logicalWidthHint, const KItemListView* view) const;
+ void calculateDetailsLayoutItemSizeHints(QVector<qreal>& logicalHeightHints, qreal& logicalWidthHint, const KItemListView* view) const;
+
friend class KStandardItemListWidget; // Accesses roleText()
};
virtual QRectF iconRect() const;
virtual QRectF textRect() const;
virtual QRectF textFocusRect() const;
+ virtual QRectF selectionRect() const;
virtual QRectF expansionToggleRect() const;
virtual QRectF selectionToggleRect() const;
virtual QPixmap createDragPixmap(const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
*/
virtual QFont customizedFont(const QFont& baseFont) const;
- virtual QPalette::ColorRole normalTextColorPalette() const;
+ virtual QPalette::ColorRole normalTextColorRole() const;
void setTextColor(const QColor& color);
QColor textColor() const;
*/
QString roleText(const QByteArray& role, const QHash<QByteArray, QVariant>& values) const;
+ /**
+ * Fixes:
+ * Select the text without MIME-type extension
+ * This is file-item-specific and should be moved
+ * into KFileItemListWidget.
+ *
+ * Inherited classes can define, if the MIME-type extension
+ * should be selected or not.
+ *
+ * @return Selection length (with or without MIME-type extension)
+ */
+ virtual int selectionLength(const QString& text) const;
+
virtual void dataChanged(const QHash<QByteArray, QVariant>& current, const QSet<QByteArray>& roles = QSet<QByteArray>());
virtual void visibleRolesChanged(const QList<QByteArray>& current, const QList<QByteArray>& previous);
virtual void columnWidthChanged(const QByteArray& role, qreal current, qreal previous);
private slots:
void slotCutItemsChanged();
- void slotRoleEditingCanceled(int index, const QByteArray& role, const QVariant& value);
- void slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value);
+ void slotRoleEditingCanceled(const QByteArray& role, const QVariant& value);
+ void slotRoleEditingFinished(const QByteArray& role, const QVariant& value);
private:
void triggerCacheRefreshing();
*/
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
QPixmap m_rating;
KItemListRoleEditor* m_roleEditor;
+ KItemListRoleEditor* m_oldRoleEditor;
friend class KStandardItemListWidgetInformant; // Accesses private static methods to be able to
// share a common layout calculation