PDA

View Full Version : Deleting a QTextFrame in a QTextDocument



enno
7th November 2015, 14:53
I can successfully insert blocks and frames in a QTextDocument. I see no way to delete any of those frames and/or blocks.

QTextEdit::cut() deletes selected text from a QTextEdit. (doesn't seem to work for me either) but according to the documentation, not from the document (?).

Can I delete a frame and any containing blocks from a document. If so, how?

Appreciate any help,
Enno

ChrisW67
8th November 2015, 22:09
Calling delete on the QTextFrame pointer will destroy the frame and remove it from the QTextDocument it belongs to. You can get the currentFrame() from a suitably positioned QTextCursor (this may be the rootFrame()). AFAICT, QTextBlocks will be removed automatically when you remove the frame containing them or QTextCursor::removeSelectedText().

prabhatjha
13th November 2015, 05:56
hey please tell me how to insert block/frames in qtextdocument.

ChrisW67
13th November 2015, 10:12
QTextCursor::insertFrame(),
QTextCursor::insertBlock(),
Rich Text Processing (http://doc.qt.io/qt-5/richtext.html)