/*
#ifndef RICH_TEXT_HANDLER_HPP
#define RICH_TEXT_HANDLER_HPP

#include <QtGui/QTextCharFormat>
#include <QtCore/QTextCodec>

#include <QQuickTextDocument>
#include <QTextDocument>
#include <QTextCursor>

class RichTextHandler : public QObject {
  Q_OBJECT;

  QQuickItem* target = nullptr;
  QTextDocument* target_doc = nullptr;

  int cursor_pos = -1,
      start_pos = -1,
      end_pos = -1;

  QTextCursor textCursor() const;
  void mergeFormatOnWordOrSelection(const QTextCharFormat &format);

  Q_PROPERTY(QQuickItem* target READ getTarget WRITE setTarget NOTIFY targetChanged)
  Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
  Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
  Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
public:
  RichTextHandler(QObject* parent = nullptr);

  QQuickItem* getTarget() const;
public slots:
  void setTarget(QQuickItem* target);

signals:
  void targetChanged(QQuickItem* target);


};

/*
    Q_PROPERTY(QQuickItem *target READ target WRITE setTarget NOTIFY targetChanged)
    Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
    Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
    Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)

    Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor NOTIFY textColorChanged)
    Q_PROPERTY(QString fontFamily READ fontFamily WRITE setFontFamily NOTIFY fontFamilyChanged)
    Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)

    Q_PROPERTY(bool bold READ bold WRITE setBold NOTIFY boldChanged)
    Q_PROPERTY(bool italic READ italic WRITE setItalic NOTIFY italicChanged)
    Q_PROPERTY(bool underline READ underline WRITE setUnderline NOTIFY underlineChanged)

    Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)

    Q_PROPERTY(QStringList defaultFontSizes READ defaultFontSizes NOTIFY defaultFontSizesChanged)

    Q_PROPERTY(QUrl fileUrl READ fileUrl WRITE setFileUrl NOTIFY fileUrlChanged)
    Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
    Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle NOTIFY documentTitleChanged)

*/


#endif // RICH_TEXT_HANDLER_HPP
*/
