LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
LC::Util::TagsCompleter Class Reference

Completer suitable for tag completion. More...

#include "tagscompleter.h"

+ Inheritance diagram for LC::Util::TagsCompleter:
+ Collaboration diagram for LC::Util::TagsCompleter:

Public Member Functions

UTIL_TAGS_API TagsCompleter (TagsLineEdit *line)
 Constructs the completer. More...
 
UTIL_TAGS_API void OverrideModel (QAbstractItemModel *model)
 Replaces the model this completer works with. More...
 
UTIL_TAGS_API QStringList splitPath (const QString &path) const override
 Path splitter override. More...
 

Static Protected Member Functions

static void SetModel (QAbstractItemModel *model)
 

Friends

class LC::TagsManager
 

Detailed Description

Completer suitable for tag completion.

Handles tag completions. One would need special class for this because standard QCompleter doesn't work: tag sequence isn't hierarchical, it is rather a set.

Despite the TagsCompleter is designed for tags completion and, consequently, uses the globally available tags model from LeechCraft's tags manager, it's possible to use the completer for other ';'-separated lists of values, by setting the appropriate completion model via OverrideModel() method.

See also
TagsCompletionModel
TagsLineEdit

Definition at line 38 of file tagscompleter.h.

Constructor & Destructor Documentation

◆ TagsCompleter()

LC::Util::TagsCompleter::TagsCompleter ( TagsLineEdit line)
explicit

Constructs the completer.

Sets up for completion and prepares line for work with itself.

Parameters
[in]lineThe line edit which would be used for tag completion.

Definition at line 24 of file tagscompleter.cpp.

Member Function Documentation

◆ OverrideModel()

void LC::Util::TagsCompleter::OverrideModel ( QAbstractItemModel *  model)

Replaces the model this completer works with.

By default, the completer uses global tags model, which is suitable for autocompletion of tags. If you want to use a custom model with custom contents, use this method to override the model used for completion.

Parameters
[in]modelThe model to use.

Definition at line 33 of file tagscompleter.cpp.

References LC::Util::TagsLineEdit::GetSeparator().

+ Here is the call graph for this function:

◆ SetModel()

static void LC::Util::TagsCompleter::SetModel ( QAbstractItemModel *  model)
inlinestaticprotected

Definition at line 77 of file tagscompleter.h.

◆ splitPath()

QStringList LC::Util::TagsCompleter::splitPath ( const QString &  path) const
override

Path splitter override.

Handles sequence of tags considering its set structure. Splits the path by spaces and returns the resulting string list.

Parameters
[in]pathThe tags sequence to split.
Returns
Splitted sequence.

Definition at line 38 of file tagscompleter.cpp.

Friends And Related Function Documentation

◆ LC::TagsManager

friend class LC::TagsManager
friend

Definition at line 43 of file tagscompleter.h.


The documentation for this class was generated from the following files: