Rich text formatting font changing problem, working code example
-
Hello, I have a problem with changing font in a qtextbrowser.
Or let it be qtextedit, does not matter.
I can change everything, like making text underlined, change its color, and so on, and if I overwrite it with, let's say italic, it keeps the old underline and the other formats.
But not, if I change the font! I am really without a clue here. Perhaps I don't see the point through all this stuff, because you can interact with the text's format in so many ways.. QTextCursor, QTextCharFormat, QTextEdit also...
Please try out the code below!
To change fontsize, hold ctrl and scroll with mousewheel. Set bold with Ctrl+B. Change fontsize with click on button. Why does the fontchange remove underline, bold, (italic, ...) and size? Why does it not remove the font color?Here is my code, it is fully working:
I could not post it here, because it is too long.
Thank you.