Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

QTextEdit.selectAll() and clearSelection().

$
0
0
I’m trying to change the font size used in a QTextEdit object after the text has been loaded. My problem is how to un-select everything afterwards. Changing the font size is easy: QTextEdit theText; // Load text into theText and allow the user to edit it. theText.selectAll(); theText.setFontPointSize(size); but the text is shown in xor mode to indicate that it is selected. To bring the state of theText back to what it was before changing the font size, I’ve tried this QTextCursor theCursor = theText.textCursor(); theCursor.clearSelection(); I’ve also tried theCursor.movePosition(QTextCursor::NoMove,QTextCursor::MoveAnchor); and theCursor.movePosition(QTextCursor::Start,QTextCursor::MoveAnchor); and various other ways of moving the cursor after the change to the font size. Nothing seems to have any effect. If it matters, when theText was created, I called theText.setAcceptRichText(false); So the text is being displayed in plainest possible manner.

Viewing all articles
Browse latest Browse all 13965

Latest Images

Trending Articles



Latest Images