Johan
Johan

Reputation: 512

Show and edit escaped character in QLineEdit

Is there a way to show escaped characters like carriage return line feed "\r\n" characters in a QLineEdit in a human readable (escaped) way automatically?

Alternatively is there an easy method to automatically generate an escaped string.

Also I need to allow the user to edit the escaped string and when reading back the current text from the QLineEdit, storing it in a std::string it has to be non-escaped.

Use case. I want the user to set a termination string (for example \r\n) for a communication object. Passing \r\n to a QLineEdit without any manual escaping, results in two unvisible characters in the QLineEdit input box.

Upvotes: 0

Views: 692

Answers (1)

Mike
Mike

Reputation: 302

"\\r\\n" ? You can create an inline stub the calls qstring::replace and return std with .toStdString

Upvotes: 1

Related Questions