Save a .rtf file formatting the text in a QTextEdit
Solved
General and Desktop
-
As already told on so you use toPlaintText() and wonder why the formatting is not saved... isn't the function name meaningful enough?
-
@Christian-Ehrlicher alright, but is there a way to get the formatted text?
-
@HenkCoder I suggest you read that again maybe?
As documentation states, rich text formatting in Qt is done via HTML subset. So, in case of QTextEdit, you will look at toHtml() method to obtain formatted text.
RTF is closed format, owned by Microsoft, however its specification is available - since Qt lacks direct support my approach would be to implement a model that converts Qt Rich Text to RTF and vice versa https://docs.microsoft.com/en-us/previous-versions/office/developer/office2000/aa140280(v=office.10)?redirectedfrom=MSDN