7#include <QAbstractListModel>
12#include <QtQml/qqmlregistration.h>
14class test_FormattedTextModel;
20 :
public QAbstractListModel
23 QML_UNCREATABLE(
"Used by ReleaseInformationModel only")
24 Q_CLASSINFO(
"RegisterEnumClassesUnscoped",
"false")
26 friend class ::test_FormattedTextModel;
46 explicit FormattedTextModel(QObject* pParent,
const QStringList& pLines = QStringList());
48 [[nodiscard]]
int rowCount(
const QModelIndex& pIndex = QModelIndex())
const override;
49 [[nodiscard]] QVariant
data(
const QModelIndex& pIndex,
int pRole = Qt::DisplayRole)
const override;
50 [[nodiscard]] QHash<int, QByteArray>
roleNames()
const override;
52 [[nodiscard]] Q_INVOKABLE
bool loadSeveral(
const QStringList& pFilepaths);
55 struct ReadLinesResult
61 static bool isFormattingLine(
LineType pType);
62 static LineType lineType(
const QString& pLine);
63 static QString stripFormattingCharacters(
const QString& pLine,
LineType pType);
64 static QString replaceControlCharactersWithHtml(
const QString& pLine);
65 static ReadLinesResult readLines(
const QString& pFilepath);
68 QList<QPair<QString, LineType>> mLines;
70 void processLines(
const QStringList& pLines);
71 void processLine(
const QString& pLine);
72 [[nodiscard]]
bool lastLineIsEmpty()
const;
Q_INVOKABLE bool loadSeveral(const QStringList &pFilepaths)
Definition FormattedTextModel.cpp:68
int rowCount(const QModelIndex &pIndex=QModelIndex()) const override
Definition FormattedTextModel.cpp:29
FormattedTextRoles
Definition FormattedTextModel.h:41
@ ContentRole
Definition FormattedTextModel.h:42
@ TypeRole
Definition FormattedTextModel.h:43
QVariant data(const QModelIndex &pIndex, int pRole=Qt::DisplayRole) const override
Definition FormattedTextModel.cpp:36
QHash< int, QByteArray > roleNames() const override
Definition FormattedTextModel.cpp:59
LineType
Definition FormattedTextModel.h:30
@ SUBSECTION
Definition FormattedTextModel.h:34
@ SECTION
Definition FormattedTextModel.h:33
@ REGULARTEXT
Definition FormattedTextModel.h:35
@ HEADER
Definition FormattedTextModel.h:32
@ LISTITEM
Definition FormattedTextModel.h:36
@ EMPTY
Definition FormattedTextModel.h:31
FormattedTextModel(QObject *pParent, const QStringList &pLines=QStringList())
Definition FormattedTextModel.cpp:20
Defines the AccessRight and AccessRole enum.
Definition CommandApdu.h:17