Add special characters as text to QTextEditor or other widgets
-
@Q139 said in Add special characters as text to QTextEditor or other widgets:
but i am unable to write a search function to auto replace every "" with ""
Why not? What did you try?
-
@Pl45m4 how to replace it without seeking for each special char seperately?
After compiled to string it is threated as single special char...
Basically id like to show all info as raw text in text browser. Including \n \r etc but incoming data format is QString... -
text.indexOf('\'); //wont compile text.indexOf('\\'); //wont find the text as special chars are threated as single char..
@Q139 said in Add special characters as text to QTextEditor or other widgets:
text.indexOf('\'); //wont compile
Of course not.
Regarding text.indexOf('\'); : you want to replace new-lines, right? So, it should be:
text.indexOf('\n');
To replace a simple
someString.replace("\n", "\\n");
-
@Q139 said in Add special characters as text to QTextEditor or other widgets:
text.indexOf('\'); //wont compile
Of course not.
Regarding text.indexOf('\'); : you want to replace new-lines, right? So, it should be:
text.indexOf('\n');
To replace a simple
someString.replace("\n", "\\n");
-
@jsulm Not only new lines but all special chars..
I guess 1 way is to loop trough text and use isNonCharacter() then add the extra "\"
-
@Q139 im afraid compiler removes 2 chars and replaces with 1 as there are not enough keys on keyboard for special chars.