MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / insertCompletion

Method insertCompletion

lib/QCodeEditor/src/internal/QCodeEditor.cpp:689–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

687}
688
689void QCodeEditor::insertCompletion(QString s)
690{
691 if (m_completer->widget() != this)
692 {
693 return;
694 }
695
696 // Replace the dotted prefix that produced the match, not just the
697 // word under the cursor, so "io.getLat" -> "io.getLatestFrame"
698 auto tc = textCursor();
699 const auto prefixLength = m_completer->completionPrefix().length();
700 tc.movePosition(QTextCursor::MoveOperation::Left,
701 QTextCursor::MoveMode::KeepAnchor,
702 static_cast<int>(prefixLength));
703 tc.insertText(s);
704 setTextCursor(tc);
705}
706
707QCompleter *QCodeEditor::completer() const
708{

Callers

nothing calls this directly

Calls 2

lengthMethod · 0.80
completionPrefixMethod · 0.80

Tested by

no test coverage detected