I'm trying to append string "\t<b>Test</b>" to QTextEdit widget. The problem is that widget renders only HTML and doesn't add tab symbol. Are there any ways to render both escape symbols and HTML tags? I really appreciate any advices.
The editor seems to like it.
code looks like
<html><head/><body><p><span style=" font-size:8.25pt; font-weight:600;"> TEST</span></p></body></html>
you can use QPlainTextEdit to enter plain text instead of HTML.
If you want in QTextEdit.
QTextEdit m_textedit = new QTextEdit;
it will append tab space and then prints text
And if you want to have the text bold and increase font size
Qt have provided setStyleSheet method
You can use it
@Pradeep-Kumar So I need to setStyleSheet for every HTML tag, and what about other tags like inserting image? Don't think that It's good solution.
As I see QTextEdit can't work with both type of symbols, am I correct?
It can work with tabs.
Just right click a textedit and use the editor.
You can then see the
HTML code directly.
HTML has no "tab space" so it's not a limitation of Qt but of HTML itself, you can use
as a mimic replacement
I will try to solve my problem this way.
as specified by @VRonin
you can use
and if you want to insert image also you can use tags as well.
QTextDocumentFragment fragment; fragment = QTextDocumentFragment::fromHtml("<img src=':/new/prefix1/images/image.png'>"); m_textedit->textCursor().insertFragment(fragment);