libplasma
Plasma::QueryMatch Class Reference
#include <querymatch.h>
Detailed Description
A match returned by an AbstractRunner in response to a given RunnerContext.Definition at line 43 of file querymatch.h.
Public Types | |
enum | Type { NoMatch = 0, CompletionMatch = 10, PossibleMatch = 30, InformationalMatch = 50, HelperMatch = 70, ExactMatch = 100 } |
Public Member Functions | |
QVariant | data () const |
QIcon | icon () const |
QString | id () const |
bool | isEnabled () const |
bool | isValid () const |
bool | operator< (const QueryMatch &other) const |
QueryMatch & | operator= (const QueryMatch &other) |
QueryMatch (const QueryMatch &other) | |
QueryMatch (AbstractRunner *runner) | |
qreal | relevance () const |
void | run (const RunnerContext &context) const |
AbstractRunner * | runner () const |
void | setData (const QVariant &data) |
void | setEnabled (bool enable) |
void | setIcon (const QIcon &icon) |
void | setId (const QString &id) |
void | setRelevance (qreal relevance) |
void | setSubtext (const QString &text) |
void | setText (const QString &text) |
void | setType (Type type) |
QString | subtext () const |
QString | text () const |
Type | type () const |
~QueryMatch () |
Member Enumeration Documentation
The type of match.
Value is important here as it is used for sorting
- Enumerator:
Definition at line 49 of file querymatch.h.
Constructor & Destructor Documentation
Plasma::QueryMatch::QueryMatch | ( | AbstractRunner * | runner | ) | [explicit] |
Constructs a PossibleMatch associated with a given RunnerContext and runner.
- search the RunnerContext this match belongs to
- runner the runner this match belongs to
Definition at line 59 of file querymatch.cpp.
Plasma::QueryMatch::QueryMatch | ( | const QueryMatch & | other | ) |
Plasma::QueryMatch::~QueryMatch | ( | ) |
Definition at line 73 of file querymatch.cpp.
Member Function Documentation
QVariant Plasma::QueryMatch::data | ( | ) | const |
Definition at line 145 of file querymatch.cpp.
QIcon Plasma::QueryMatch::icon | ( | ) | const |
Definition at line 160 of file querymatch.cpp.
QString Plasma::QueryMatch::id | ( | ) | const |
A string that can be used as an ID for this match, even between different queries.
It is based in part on the source of the match (the AbstractRunner) and distinguishing information provided by the runner, ensuring global uniqueness as well as consistency between query matches.
Definition at line 82 of file querymatch.cpp.
bool Plasma::QueryMatch::isEnabled | ( | ) | const |
Definition at line 170 of file querymatch.cpp.
bool Plasma::QueryMatch::isValid | ( | ) | const |
Definition at line 77 of file querymatch.cpp.
bool Plasma::QueryMatch::operator< | ( | const QueryMatch & | other | ) | const |
Definition at line 175 of file querymatch.cpp.
QueryMatch & Plasma::QueryMatch::operator= | ( | const QueryMatch & | other | ) |
Definition at line 194 of file querymatch.cpp.
qreal Plasma::QueryMatch::relevance | ( | ) | const |
The relevance of this action to the search.
By default, the relevance is 1.
- Returns:
- a number between 0 and 1
Definition at line 102 of file querymatch.cpp.
void Plasma::QueryMatch::run | ( | const RunnerContext & | context | ) | const |
Requests this match to activae using the given context.
- Parameters:
-
context the context to use in conjunction with this run
Definition at line 203 of file querymatch.cpp.
AbstractRunner * Plasma::QueryMatch::runner | ( | ) | const |
void Plasma::QueryMatch::setData | ( | const QVariant & | data | ) |
Sets data to be used internally by the associated AbstractRunner.
When set, it is also used to form part of the id() for this match. If that is innapropriate as an id, the runner may generate its own id and set that with setId(const QString&) directly after calling setData
Definition at line 122 of file querymatch.cpp.
void Plasma::QueryMatch::setEnabled | ( | bool | enable | ) |
Definition at line 165 of file querymatch.cpp.
void Plasma::QueryMatch::setIcon | ( | const QIcon & | icon | ) |
Definition at line 140 of file querymatch.cpp.
void Plasma::QueryMatch::setId | ( | const QString & | id | ) |
Sets the id for this match; useful if the id does not match data().toString().
The id must be unique to all matches from this runner, and should remain constant for the same query for best results.
- Parameters:
-
id the new identifying string to use to refer to this entry
Definition at line 128 of file querymatch.cpp.
void Plasma::QueryMatch::setRelevance | ( | qreal | relevance | ) |
Sets the relevance of this action for the search it was created for.
- Parameters:
-
relevance a number between 0 and 1.
Definition at line 97 of file querymatch.cpp.
void Plasma::QueryMatch::setSubtext | ( | const QString & | text | ) |
Definition at line 117 of file querymatch.cpp.
void Plasma::QueryMatch::setText | ( | const QString & | text | ) |
Definition at line 112 of file querymatch.cpp.
void Plasma::QueryMatch::setType | ( | Type | type | ) |
QString Plasma::QueryMatch::subtext | ( | ) | const |
Definition at line 155 of file querymatch.cpp.
QString Plasma::QueryMatch::text | ( | ) | const |
Definition at line 150 of file querymatch.cpp.
QueryMatch::Type Plasma::QueryMatch::type | ( | ) | const |
The type of action this is.
Defaults to PossibleMatch.
Definition at line 92 of file querymatch.cpp.
The documentation for this class was generated from the following files: