KTextEditor
katewordcompletion.cpp
55void KateWordCompletionModel::saveMatches(KTextEditor::View *view, const KTextEditor::Range &range)
168bool KateWordCompletionModel::shouldAbortCompletion(KTextEditor::View *view, const KTextEditor::Range &range, const QString ¤tCompletion)
177 return CodeCompletionModelControllerInterface::shouldAbortCompletion(view, range, currentCompletion);
180void KateWordCompletionModel::completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType it)
191QStringList KateWordCompletionModel::allMatches(KTextEditor::View *view, const KTextEditor::Range &range)
194 const int minWordSize = qMax(2, qobject_cast<KTextEditor::ViewPrivate *>(view)->config()->wordCompletionMinimalWordLength());
198 const int endLine = std::min(cursorPosition.line() + maxLinesToScan, view->document()->lines());
231 const auto language = static_cast<KTextEditor::DocumentPrivate *>(document)->defaultDictionary();
256void KateWordCompletionModel::executeCompletionItem(KTextEditor::View *view, const KTextEditor::Range &word, const QModelIndex &index) const
261KTextEditor::CodeCompletionModelControllerInterface::MatchReaction KateWordCompletionModel::matchingItem(const QModelIndex & /*matched*/)
293 d->liRange = m_view->document()->newMovingRange(KTextEditor::Range::invalid(), KTextEditor::MovingRange::DoNotExpand);
296 a->setBackground(static_cast<KTextEditor::ViewPrivate *>(view)->rendererConfig()->selectionColor());
377 connect(m_view, &KTextEditor::View::cursorPositionChanged, this, &KateWordCompletionView::slotCursorMoved);
423 connect(m_view, &KTextEditor::View::cursorPositionChanged, this, &KateWordCompletionView::slotCursorMoved);
426 const QRegularExpression wordRegEx(QLatin1String("\\b") + doc->text(d->dcRange) + QLatin1String("(\\w+)"), QRegularExpression::UseUnicodePropertiesOption);
433 pos = fw ? ln.indexOf(wordRegEx, d->dcCursor.column(), &match) : ln.lastIndexOf(wordRegEx, d->dcCursor.column(), &match);
438 if (m != doc->text(*d->liRange) && (d->dcCursor.line() != d->dcRange.start().line() || pos != d->dcRange.start().column())) {
502 disconnect(m_view, &KTextEditor::View::cursorPositionChanged, this, &KateWordCompletionView::slotCursorMoved);
QAction * addAction(const QString &name, const QObject *receiver=nullptr, const char *member=nullptr)
static void setDefaultShortcut(QAction *action, const QKeySequence &shortcut)
QExplicitlySharedDataPointer< Attribute > Ptr
Shared data pointer for Attribute.
Definition attribute.h:56
MatchReaction
Definition codecompletionmodelcontrollerinterface.h:156
@ InheritanceDepth
Returns the inheritance depth of the completion.
Definition codecompletionmodel.h:207
@ GroupRole
Using this Role, it is possible to greatly optimize the time needed to process very long completion-l...
Definition codecompletionmodel.h:352
@ UnimportantItemRole
Return a nonzero value here to enforce sorting the item at the end of the list.
Definition codecompletionmodel.h:357
constexpr int column() const noexcept
Retrieve the column on which this cursor is situated.
Definition cursor.h:192
constexpr int line() const noexcept
Retrieve the line on which this cursor is situated.
Definition cursor.h:174
virtual bool removeText(Range range, bool block=false)=0
Remove the text specified in range.
virtual bool replaceText(Range range, const QString &text, bool block=false)
Replace text from range with specified text.
Definition document.cpp:85
@ DoNotExpand
Don't expand to encapsulate new characters in either direction. This is the default.
Definition movingrange.h:140
An object representing a section of text, from one Cursor to another.
Definition include/ktexteditor/range.h:49
constexpr Cursor end() const noexcept
Get the end position of this range.
Definition include/ktexteditor/range.h:163
constexpr Cursor start() const noexcept
Get the start position of this range.
Definition include/ktexteditor/range.h:153
void setRange(Range range) noexcept
Set the start and end cursors to range.start() and range.end() respectively.
Definition utils/range.cpp:35
constexpr int columnWidth() const noexcept
Returns the number of columns separating the start() and end() positions.
Definition include/ktexteditor/range.h:290
static constexpr Range invalid() noexcept
Returns an invalid range.
Definition include/ktexteditor/range.h:121
virtual Document * document() const =0
Get the view's document, that means the view is a view of the returned document.
virtual Cursor cursorPosition() const =0
Get the view's current cursor position.
void cursorPositionChanged(KTextEditor::View *view, KTextEditor::Cursor newPosition)
This signal is emitted whenever the view's cursor position changed.
QStringList suggest(const QString &word) const
bool isCorrect(const QString &word) const
bool isValid() const
void setLanguage(const QString &lang)
Q_SCRIPTABLE Q_NOREPLY void start()
QString i18n(const char *text, const TYPE &arg...)
KCOREADDONS_EXPORT Result match(QStringView pattern, QStringView str)
const QList< QKeySequence > & end()
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition katetextblock.h:18
QModelIndex createIndex(int row, int column, const void *ptr) const const
void setShortcutContext(Qt::ShortcutContext context)
void triggered(bool checked)
bool isLetter(char32_t ucs4)
bool isLetterOrNumber(char32_t ucs4)
bool isNumber(char32_t ucs4)
bool isSpace(char32_t ucs4)
QIcon fromTheme(const QString &name)
T & first()
qsizetype size() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
QObject * parent() const const
T qobject_cast(QObject *object)
UseUnicodePropertiesOption
iterator insert(const T &value)
qsizetype size() const const
const QChar at(qsizetype position) const const
QChar * data()
qsizetype indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
bool isNull() const const
qsizetype lastIndexOf(QChar ch, Qt::CaseSensitivity cs) const const
QString left(qsizetype n) const const
qsizetype length() const const
QString mid(qsizetype position, qsizetype n) const const
QString & remove(QChar ch, Qt::CaseSensitivity cs)
qsizetype size() const const
QStringView mid(qsizetype start, qsizetype length) const const
qsizetype length() const const
QString toString() const const
DisplayRole
Key_8
CTRL
WidgetWithChildrenShortcut
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:55:24 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:55:24 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.