* Overwrites the text of the cursor. */
| 1325 | * Overwrites the text of the cursor. |
| 1326 | */ |
| 1327 | void PythonConsole::overrideCursor(const QString& txt) |
| 1328 | { |
| 1329 | // Go to the last line and the fourth position, right after the prompt |
| 1330 | QTextCursor cursor = this->inputBegin(); |
| 1331 | int blockLength = this->textCursor().block().text().length(); |
| 1332 | |
| 1333 | cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, blockLength); //<< select text |
| 1334 | // to override |
| 1335 | cursor.removeSelectedText(); |
| 1336 | cursor.insertText(txt); |
| 1337 | // move cursor to the end |
| 1338 | cursor.movePosition(QTextCursor::End); |
| 1339 | setTextCursor(cursor); |
| 1340 | } |
| 1341 | |
| 1342 | void PythonConsole::contextMenuEvent(QContextMenuEvent* e) |
| 1343 | { |
nothing calls this directly
no test coverage detected