aboutsummaryrefslogtreecommitdiff
path: root/ui.qt/source/Document.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ui.qt/source/Document.hpp')
-rw-r--r--ui.qt/source/Document.hpp72
1 files changed, 0 insertions, 72 deletions
diff --git a/ui.qt/source/Document.hpp b/ui.qt/source/Document.hpp
deleted file mode 100644
index 5ef1bba..0000000
--- a/ui.qt/source/Document.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#pragma once
-
-#include "fwd.hpp"
-
-#include <QAbstractItemModel>
-#include <QDateTime>
-#include <QObject>
-#include <QQuickTextDocument>
-#include <QTextCharFormat>
-
-// To be instanciated in QML as the logic backend to some TextArea
-class DocumentHandler : public QObject
-{
- Q_OBJECT
- QML_ELEMENT
-
- Q_PROPERTY(QQuickTextDocument* document READ getDoc WRITE setDoc NOTIFY docChanged)
- Q_PROPERTY(QDateTime modifyTime READ getModifyTime NOTIFY modificationChanged)
-
- Q_PROPERTY(int cursorPos READ getCursorPos WRITE setCursorPos NOTIFY cursorPosChanged)
- Q_PROPERTY(int selectionBegin READ getSelectionBegin WRITE setSelectionBegin NOTIFY selectionBeginChanged)
- Q_PROPERTY(int selectionEnd READ getSelectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
-
- Q_PROPERTY(QFont activeFont READ getActiveFont WRITE setActiveFont NOTIFY activeFontChanged)
- Q_PROPERTY(QColor activeTextColor READ getActiveTextColor WRITE setActiveTextColor NOTIFY activeTextColorChanged)
-
-private:
- QQuickTextDocument* mDoc = nullptr;
- QDateTime mModifyTime;
-
- int mCursorPos;
- int mSelectionBegin;
- int mSelectionEnd;
-
-public:
- explicit DocumentHandler(QObject* parent = nullptr);
-
- QQuickTextDocument* getDoc() const;
- void setDoc(QQuickTextDocument* newDoc);
-
- const QDateTime& getModifyTime() const;
-
- int getCursorPos() const;
- void setCursorPos(int newCursorPos);
-
- int getSelectionBegin() const;
- void setSelectionBegin(int newSelectionBegin);
-
- int getSelectionEnd() const;
- void setSelectionEnd(int newSelectionEnd);
-
- QFont getActiveFont() const;
- void setActiveFont(const QFont& font);
-
- QColor getActiveTextColor() const;
- void setActiveTextColor(const QColor& color);
-
-signals:
- void docChanged(QQuickTextDocument* oldDoc);
- void modificationChanged(); // Redirected from the currently bound document
-
- void cursorPosChanged();
- void selectionBeginChanged();
- void selectionEndChanged();
-
- void activeFontChanged();
- void activeTextColorChanged();
-
-private:
- QTextCursor makeTextCursor() const;
- void mergeFormatOnWordOrSelection(const QTextCharFormat& format);
-};