LeechCraft
0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
tagscompleter.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#include "
tagscompleter.h
"
10
#include <QtDebug>
11
#include <QStringList>
12
#include "
tagslineedit.h
"
13
14
namespace
LC::Util
15
{
16
QAbstractItemModel *TagsCompleter::CompletionModel_ =
nullptr
;
17
18
TagsCompleter::TagsCompleter
(
TagsLineEdit
*
toComplete
)
19
: QCompleter (
toComplete
)
20
, Edit_ (
toComplete
)
21
{
22
setCompletionRole
(Qt::DisplayRole);
23
setModel
(CompletionModel_);
24
toComplete
->SetCompleter (
this
);
25
}
26
27
void
TagsCompleter::OverrideModel
(QAbstractItemModel *
model
)
28
{
29
setModel
(
model
);
30
}
31
32
QStringList
TagsCompleter::splitPath
(
const
QString
&
string
)
const
33
{
34
const
auto
&
sep
= Edit_->
GetSeparator
().trimmed ();
35
auto
result
=
string
.split (
sep
, Qt::SkipEmptyParts);
36
for
(
auto
&
s
:
result
)
37
s
=
s
.trimmed ();
38
return
result
;
39
}
40
}
LC::Util::TagsCompleter::TagsCompleter
UTIL_TAGS_API TagsCompleter(TagsLineEdit *line)
Constructs the completer.
Definition
tagscompleter.cpp:18
LC::Util::TagsCompleter::splitPath
UTIL_TAGS_API QStringList splitPath(const QString &path) const override
Path splitter override.
Definition
tagscompleter.cpp:32
LC::Util::TagsCompleter::OverrideModel
UTIL_TAGS_API void OverrideModel(QAbstractItemModel *model)
Replaces the model this completer works with.
Definition
tagscompleter.cpp:27
LC::Util::TagsLineEdit
A line edit class suitable for use with TagsCompleter.
Definition
tagslineedit.h:29
LC::Util::TagsLineEdit::GetSeparator
QString GetSeparator() const
Returns the separator for the tags.
Definition
tagslineedit.cpp:87
LC::Util
Definition
icoreproxy.h:34
LC::Util::Filter
Container< T > Filter(const Container< T > &c, F f)
Definition
prelude.h:118
tagscompleter.h
tagslineedit.h
src
util
tags
tagscompleter.cpp
Generated by
1.10.0