MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / overrideCursor

Method overrideCursor

src/Gui/PythonConsole.cpp:1327–1340  ·  view source on GitHub ↗

* Overwrites the text of the cursor. */

Source from the content-addressed store, hash-verified

1325 * Overwrites the text of the cursor.
1326 */
1327void 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
1342void PythonConsole::contextMenuEvent(QContextMenuEvent* e)
1343{

Callers

nothing calls this directly

Calls 6

inputBeginMethod · 0.95
blockMethod · 0.80
insertTextMethod · 0.80
lengthMethod · 0.45
textMethod · 0.45
textCursorMethod · 0.45

Tested by

no test coverage detected