void TextEmojiWrapper::setTextDocument(QQuickTextDocument *doc) { if(p->document == doc) return; p->document = doc; emit textDocumentChanged(); refresh(); }
void DocumentHandler::setQuickTextDocument(QQuickTextDocument* _document) { m_textDocument = _document; delete m_syntaxHighlighter; m_syntaxHighlighter = nullptr; if(m_textDocument) { m_doc = m_textDocument->textDocument(); m_syntaxHighlighter = new KSyntaxHighlighting::SyntaxHighlighter(m_doc); m_syntaxHighlighter->setTheme(m_repository.defaultTheme(KSyntaxHighlighting::Repository::LightTheme)); if(not m_highlightingDefinition.isEmpty()) { KSyntaxHighlighting::Definition def = m_repository.definitionForName(m_highlightingDefinition); if(def.isValid()) { m_syntaxHighlighter->setDefinition(def); } else { qWarning() << "No syntax definition for " << m_highlightingDefinition; } } } emit(textDocumentChanged()); }