| 62 | } |
| 63 | |
| 64 | void QFramedTextAttribute::frame(QTextCursor cursor) |
| 65 | { |
| 66 | auto text = cursor.document()->findBlockByNumber(cursor.blockNumber()).text(); |
| 67 | |
| 68 | QTextCharFormat format; |
| 69 | format.setObjectType(type()); |
| 70 | format.setProperty(FramedString, cursor.selectedText()); |
| 71 | |
| 72 | if (cursor.selectionEnd() > cursor.selectionStart()) |
| 73 | { |
| 74 | cursor.setPosition(cursor.selectionStart()); |
| 75 | } |
| 76 | else |
| 77 | { |
| 78 | cursor.setPosition(cursor.selectionEnd()); |
| 79 | } |
| 80 | |
| 81 | cursor.insertText(QString(QChar::ObjectReplacementCharacter), format); |
| 82 | } |
| 83 | |
| 84 | void QFramedTextAttribute::clear(QTextCursor cursor) |
| 85 | { |
no test coverage detected