Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Replacing a character in a QLineEdit text
To simplify, I am using a QlineEdit line that contains : PRTU
I would like to replace the character 'R' by ' S'.
I tried :
line.text().replace('R','S') But it seems not to work.
I tried also:
if (line.text().contains('R') text=text+"S"
but with no avail.
Could you help me, please
QString text = line.text();
That should work.
Thank you for your reply.
As you advised I wrote:
But the computer erases the charactere 'R' but put nothing instead.
What do I do wrong?
I don't know. Code looks ok.
I found my mistake. I feel so stupid.
I made the changes in a constructor window that it not read at the beginning.
Well sorry for my stupidity.
Thanks for your help.
No problem, we all make mistakes in our apps :)