void Text4Edit( const QString& _text, Ui::TextEditEx& _edit, const Text2DocHtmlMode _htmlMode, const bool _convertLinks, const bool _breakDocument, const Text2HtmlUriCallback _uriCallback, const Emoji::EmojiSizePx _emojiSize, const QTextCharFormat::VerticalAlignment _aligment) { _edit.blockSignals(true); _edit.document()->blockSignals(true); _edit.setUpdatesEnabled(false); Text2DocConverter converter; converter.MakeUniqueResources(true); auto cursor = _edit.textCursor(); cursor.beginEditBlock(); converter.Convert(_text, cursor, _htmlMode, _convertLinks, _breakDocument, _uriCallback, _emojiSize, _aligment); cursor.endEditBlock(); _edit.mergeResources(converter.GetResources()); _edit.setUpdatesEnabled(true); _edit.document()->blockSignals(false); _edit.blockSignals(false); emit (_edit.document()->contentsChanged()); }
void Text4Edit(const QString& _text, Ui::TextEditEx& _edit, const Text2DocHtmlMode _htmlMode, const bool _convertLinks, const bool _breakDocument, const Text2HtmlUriCallback _uriCallback, const Emoji::EmojiSizePx _emojiSize) { _edit.document()->blockSignals(true); Text2DocConverter converter; converter.make_uniq_resources(true); QTextCursor cursor = _edit.textCursor(); converter.Convert(_text, cursor, _htmlMode, _convertLinks, _breakDocument, _uriCallback, _emojiSize); _edit.merge_resources(converter.get_resources()); _edit.document()->blockSignals(false); emit (_edit.document()->contentsChanged()); }