Reputation: 179
How can we store in QString
only selected text, which is typed in QTextEdit
and change it (for example toUpper()
) and change selected by it in QTextEdit
?
Upvotes: 0
Views: 1695
Reputation: 16334
This can be done through the QTextCursor
API:
QTextCursor cursor = textEdit->textCursor();
if(cursor.hasSelection())
{
cursor.insertText(cursor.selectedText().toUpper());
}
Upvotes: 3