| 687 | } |
| 688 | |
| 689 | void 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 | |
| 707 | QCompleter *QCodeEditor::completer() const |
| 708 | { |
nothing calls this directly
no test coverage detected