TextAutoGenerateText::TextAutoGenerateTagsModel Class

class TextAutoGenerateText::TextAutoGenerateTagsModel

The TextAutoGenerateTagsModel class Author: Laurent Montel <montel@kde.org>. More...

Header: #include <TextAutoGenerateText/TextAutoGenerateTagsModel>
Inherits: QAbstractListModel

Public Types

enum TagRoles { Name, Identifier, Color }

Public Functions

TextAutoGenerateTagsModel(QObject *parent = nullptr)
virtual ~TextAutoGenerateTagsModel() override
void addTag(const TextAutoGenerateText::TextAutoGenerateTag &newTag)
void clear()
QColor colorFromIdentifier(const QByteArray &identifier) const
QList<QColor> colors(const QList<QByteArray> &identifiers) const
void removeTag(const QByteArray &identifier)
void setTags(const QList<TextAutoGenerateText::TextAutoGenerateTag> &newTags)
QList<TextAutoGenerateText::TextAutoGenerateTag> tags() const
void updateTag(const TextAutoGenerateText::TextAutoGenerateTag &tag)

Reimplemented Public Functions

virtual QVariant data(const QModelIndex &index, int role) const override
virtual int rowCount(const QModelIndex & = {}) const override

Detailed Description

Member Type Documentation

enum TextAutoGenerateTagsModel::TagRoles

The TagRoles enum

Member Function Documentation

[explicit] TextAutoGenerateTagsModel::TextAutoGenerateTagsModel(QObject *parent = nullptr)

Constructs a new TextAutoGenerateTagsModel object. parent The parent QObject

[override virtual noexcept] TextAutoGenerateTagsModel::~TextAutoGenerateTagsModel()

Destroys the TextAutoGenerateTagsModel object.

void TextAutoGenerateTagsModel::addTag(const TextAutoGenerateText::TextAutoGenerateTag &newTag)

addTag newTag

void TextAutoGenerateTagsModel::clear()

clear Removes all tags.

QColor TextAutoGenerateTagsModel::colorFromIdentifier(const QByteArray &identifier) const

colorFromIdentifier identifier Returns

QList<QColor> TextAutoGenerateTagsModel::colors(const QList<QByteArray> &identifiers) const

colors identifiers Returns

[override virtual] QVariant TextAutoGenerateTagsModel::data(const QModelIndex &index, int role) const

Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.

Returns the data at the given index for the specified role. index The model index role The data role Returns The data value

void TextAutoGenerateTagsModel::removeTag(const QByteArray &identifier)

removeTag identifier

[override virtual] int TextAutoGenerateTagsModel::rowCount(const QModelIndex & = {}) const

Reimplements: QAbstractItemModel::rowCount(const QModelIndex &parent) const.

Returns the number of rows in the model. Returns The row count

void TextAutoGenerateTagsModel::setTags(const QList<TextAutoGenerateText::TextAutoGenerateTag> &newTags)

setTags newTags

See also tags().

QList<TextAutoGenerateText::TextAutoGenerateTag> TextAutoGenerateTagsModel::tags() const

tags Returns

See also setTags().

void TextAutoGenerateTagsModel::updateTag(const TextAutoGenerateText::TextAutoGenerateTag &tag)

updateTag Replaces the tag which has the same identifier. tag