MCPcopy Create free account
hub / github.com/Kitware/ParaView / swapImpl

Method swapImpl

Qt/Python/pqPythonUndoCommand.cxx:20–46  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

18
19//-----------------------------------------------------------------------------
20void pqPythonUndoCommand::swapImpl(const pqPythonTextHistoryEntry& h)
21{
22 // We block all text signals (this is done to avoid pushing twice
23 // the text in the undo stack)
24 const bool oldState = this->Text.blockSignals(true);
25
26 const QString highlightedText = this->Highlighter->Highlight(h.content);
27 if (!highlightedText.isEmpty())
28 {
29 this->Text.setHtml(highlightedText);
30 }
31 else
32 {
33 this->Text.setText(h.content);
34 }
35
36 // Move the cursor
37 if (!h.isEmpty())
38 {
39 QTextCursor cursor = this->Text.textCursor();
40 cursor.setPosition(h.cursorPosition);
41 this->Text.setTextCursor(cursor);
42 }
43
44 // re-enable the signals
45 this->Text.blockSignals(oldState);
46};
47
48//-----------------------------------------------------------------------------
49void pqPythonUndoCommand::undo()

Callers 2

undoMethod · 0.95
redoMethod · 0.95

Calls 4

HighlightMethod · 0.80
setPositionMethod · 0.80
isEmptyMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected