+ * @param role The role the text is being requested for.
+ * @param values The data of the item. All the data is passed because the text might depend on multiple data points.
+ * @param forUsageAs Whether the roleText should be optimized for displaying (i.e. kept somewhat short) or optimized for speaking e.g. by screen readers
+ * or text-to-speech in general (i.e. by prefering announcing a month as July instead of as the number 7).
* @return String representation of the role \a role. The representation of
* a role might depend on other roles, so the values of all roles
* are passed as parameter.
*/
* @return String representation of the role \a role. The representation of
* a role might depend on other roles, so the values of all roles
* are passed as parameter.
*/
- virtual QString roleText(const QByteArray &role, const QHash<QByteArray, QVariant> &values) const;
+ virtual QString roleText(const QByteArray &role, const QHash<QByteArray, QVariant> &values, ForUsageAs forUsageAs = ForUsageAs::DisplayedText) const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
QRectF expansionToggleRect() const override;
QRectF selectionToggleRect() const override;
QPixmap createDragPixmap(const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
QRectF expansionToggleRect() const override;
QRectF selectionToggleRect() const override;
QPixmap createDragPixmap(const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
- void setOverlay(const QPixmap &overlay);
- QPixmap overlay() const;
+ void setOverlays(QHash<Qt::Corner, QString> &overlay);
+ QHash<Qt::Corner, QString> overlays() const;
/**
* @see KStandardItemListWidgetInformant::roleText().
*/
QString roleText(const QByteArray &role, const QHash<QByteArray, QVariant> &values) const;
/**
* @see KStandardItemListWidgetInformant::roleText().
*/
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)
+ * @return Selection length (with or without MIME-type extension) in number of unicode characters, which might be different from number of QChars.
*/
virtual int selectionLength(const QString &text) const;
void dataChanged(const QHash<QByteArray, QVariant> ¤t, const QSet<QByteArray> &roles = QSet<QByteArray>()) override;
void visibleRolesChanged(const QList<QByteArray> ¤t, const QList<QByteArray> &previous) override;
void columnWidthChanged(const QByteArray &role, qreal current, qreal previous) override;
*/
virtual int selectionLength(const QString &text) const;
void dataChanged(const QHash<QByteArray, QVariant> ¤t, const QSet<QByteArray> &roles = QSet<QByteArray>()) override;
void visibleRolesChanged(const QList<QByteArray> ¤t, const QList<QByteArray> &previous) override;
void columnWidthChanged(const QByteArray &role, qreal current, qreal previous) override;
void styleOptionChanged(const KItemListStyleOption ¤t, const KItemListStyleOption &previous) override;
void hoveredChanged(bool hovered) override;
void selectedChanged(bool selected) override;
void styleOptionChanged(const KItemListStyleOption ¤t, const KItemListStyleOption &previous) override;
void hoveredChanged(bool hovered) override;
void selectedChanged(bool selected) override;
+ QPixmap addOverlays(const QPixmap &pixmap,
+ const QHash<Qt::Corner, QString> &overlays,
+ const QSize &size,
+ qreal devicePixelRatioF,
+ QIcon::Mode mode = QIcon::Normal) const;
+
void drawSiblingsInformation(QPainter *painter);
QRectF roleEditingRect(const QByteArray &role) const;
void drawSiblingsInformation(QPainter *painter);
QRectF roleEditingRect(const QByteArray &role) const;
- QPixmap pixmapForIcon(const QString &name, const QStringList &overlays, int size, QIcon::Mode mode) const;
+ QPixmap pixmapForIcon(const QString &name, const QSize &size, QIcon::Mode mode) const;