How to style characters from index x (eg. x=10) to end of text in QLineEdit?
Example:
Text in QLineEdit:
0123456789
And I want make characters from index 2 (that is 2) to the end should be bold.
0123456789
How to style characters from index x (eg. x=10) to end of text in QLineEdit?
Example:
Text in QLineEdit:
0123456789
And I want make characters from index 2 (that is 2) to the end should be bold.
0123456789
QLineedit
is a one line of plain text which you may not easily handle such character formatting. On the other hand Qt provides text widgets for plain and rich text, that can accept formatting such as html. For instance the QTextEdit
widget can be used and render such formatting of text with html tags.
QString html = "01<b>23456789</b>";
QTextEdit::setHtml(html);