9 #include <QAbstractListModel>
13 #include <QStringList>
19 :
public QAbstractListModel
41 explicit FormattedTextModel(QObject* pParent,
const QStringList& pLines = QStringList());
43 int rowCount(
const QModelIndex& pIndex = QModelIndex())
const override;
44 QVariant
data(
const QModelIndex& pIndex,
int pRole = Qt::DisplayRole)
const override;
45 QHash<int, QByteArray>
roleNames()
const override;
47 Q_INVOKABLE
bool loadSeveral(
const QStringList& pFilepaths);
49 #if defined(QT_NO_DEBUG)
66 QList<QPair<QString, LineType>> mLines;
68 void processLines(
const QStringList& pLines);
69 void processLine(
const QString& pLine);
70 bool lastLineIsEmpty()
const;
Definition: FormattedTextModel.h:20
Q_INVOKABLE bool loadSeveral(const QStringList &pFilepaths)
Definition: FormattedTextModel.cpp:68
static ReadLinesResult readLines(const QString &pFilepath)
Definition: FormattedTextModel.cpp:155
int rowCount(const QModelIndex &pIndex=QModelIndex()) const override
Definition: FormattedTextModel.cpp:29
static bool isFormattingLine(LineType pType)
Definition: FormattedTextModel.cpp:94
FormattedTextRoles
Definition: FormattedTextModel.h:36
@ ContentRole
Definition: FormattedTextModel.h:37
@ LineTypeRole
Definition: FormattedTextModel.h:38
static QString stripFormattingCharacters(const QString &pLine, LineType pType)
Definition: FormattedTextModel.cpp:132
static LineType lineType(const QString &pLine)
Definition: FormattedTextModel.cpp:101
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
static QString replaceControlCharactersWithHtml(const QString &pLine)
Definition: FormattedTextModel.cpp:144
LineType
Definition: FormattedTextModel.h:25
@ HEADER
Definition: FormattedTextModel.h:27
@ LISTITEM
Definition: FormattedTextModel.h:31
@ SECTION
Definition: FormattedTextModel.h:28
@ SUBSECTION
Definition: FormattedTextModel.h:29
@ EMPTY
Definition: FormattedTextModel.h:26
@ REGULARTEXT
Definition: FormattedTextModel.h:30
FormattedTextModel(QObject *pParent, const QStringList &pLines=QStringList())
Definition: FormattedTextModel.cpp:20
A simple template renderer.
Definition: ActivationContext.h:15
Definition: FormattedTextModel.h:54
bool mSuccess
Definition: FormattedTextModel.h:55
QStringList mLines
Definition: FormattedTextModel.h:56