Add tests for ChatMarkdownHelper and rework how formats are applied to make it more robust.
This commit is contained in:
@@ -4,24 +4,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlEngine>
|
||||
|
||||
#include "enums/richformat.h"
|
||||
|
||||
class QQuickItem;
|
||||
class QTextDocument;
|
||||
|
||||
class ChatDocumentHandler;
|
||||
class QmlTextItemWrapper;
|
||||
|
||||
class ChatMarkdownHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
|
||||
public:
|
||||
explicit ChatMarkdownHelper(ChatDocumentHandler *parent);
|
||||
explicit ChatMarkdownHelper(QObject *parent = nullptr);
|
||||
|
||||
QQuickItem *textItem() const;
|
||||
void setTextItem(QQuickItem *textItem);
|
||||
|
||||
void handleExternalFormatChange();
|
||||
|
||||
Q_SIGNALS:
|
||||
void textItemChanged();
|
||||
void unhandledBlockFormat(RichFormat::Format format);
|
||||
|
||||
private:
|
||||
enum State {
|
||||
None,
|
||||
@@ -29,8 +35,8 @@ private:
|
||||
Started,
|
||||
};
|
||||
|
||||
QTextDocument *document() const;
|
||||
void connectDocument();
|
||||
QPointer<QmlTextItemWrapper> m_textItem;
|
||||
void connectTextItem();
|
||||
|
||||
State m_currentState = None;
|
||||
int m_startPos = 0;
|
||||
|
||||
Reference in New Issue
Block a user