コード例 #1
0
	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());
	}
コード例 #2
0
	void Text2Doc(const QString &text,
		QTextCursor &cursor,
		const Text2DocHtmlMode htmlMode,
		const bool convertLinks,
		const Text2HtmlUriCallback uriCallback)
	{
		Text2DocConverter converter;
        cursor.document()->blockSignals(true);
		converter.Convert(text, cursor, htmlMode, convertLinks, false, uriCallback, Emoji::EmojiSizePx::Auto);
        cursor.document()->blockSignals(false);
        emit (cursor.document()->contentsChanged());
	}
コード例 #3
0
	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());
	}