Plasma
Plasma::QueryMatch Class Reference
A match returned by an AbstractRunner in response to a given RunnerContext. More...
#include <Plasma/QueryMatch>
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 |
QAction * | selectedAction () 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 | setSelectedAction (QAction *action) |
void | setSubtext (const QString &text) |
void | setText (const QString &text) |
void | setType (Type type) |
QString | subtext () const |
QString | text () const |
Type | type () const |
~QueryMatch () |
Detailed Description
A match returned by an AbstractRunner in response to a given RunnerContext.Definition at line 46 of file querymatch.h.
Member Enumeration Documentation
The type of match.
Value is important here as it is used for sorting
- Enumerator:
-
NoMatch Null match. CompletionMatch Possible completion for the data of the query. PossibleMatch Something that may match the query. InformationalMatch A purely informational, non-actionable match, such as the answer to a question or calculation. HelperMatch A match that represents an action not directly related to activating the given search term, such as a search in an external tool or a command learning trigger. Helper matches tend to be generic to the query and should not be autoactivated just because the user hits "Enter" while typing. They must be explicitly selected to be activated, but unlike InformationalMatch cause an action to be triggered.
ExactMatch An exact match to the query.
Definition at line 52 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 61 of file querymatch.cpp.
Plasma::QueryMatch::QueryMatch | ( | const QueryMatch & | other | ) |
Plasma::QueryMatch::~QueryMatch | ( | ) |
Definition at line 75 of file querymatch.cpp.
Member Function Documentation
QVariant Plasma::QueryMatch::data | ( | ) | const |
Definition at line 146 of file querymatch.cpp.
QIcon Plasma::QueryMatch::icon | ( | ) | const |
Definition at line 161 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 84 of file querymatch.cpp.
bool Plasma::QueryMatch::isEnabled | ( | ) | const |
Definition at line 171 of file querymatch.cpp.
bool Plasma::QueryMatch::isValid | ( | ) | const |
Definition at line 79 of file querymatch.cpp.
bool Plasma::QueryMatch::operator< | ( | const QueryMatch & | other | ) | const |
Definition at line 186 of file querymatch.cpp.
QueryMatch & Plasma::QueryMatch::operator= | ( | const QueryMatch & | other | ) |
Definition at line 205 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 104 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
- See also:
- AbstractRunner::run
Definition at line 214 of file querymatch.cpp.
AbstractRunner * Plasma::QueryMatch::runner | ( | ) | const |
QAction * Plasma::QueryMatch::selectedAction | ( | ) | 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 124 of file querymatch.cpp.
void Plasma::QueryMatch::setEnabled | ( | bool | enable | ) |
Definition at line 166 of file querymatch.cpp.
void Plasma::QueryMatch::setIcon | ( | const QIcon & | icon | ) |
Definition at line 141 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 130 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 99 of file querymatch.cpp.
void Plasma::QueryMatch::setSelectedAction | ( | QAction * | action | ) |
void Plasma::QueryMatch::setSubtext | ( | const QString & | text | ) |
Definition at line 119 of file querymatch.cpp.
void Plasma::QueryMatch::setText | ( | const QString & | text | ) |
Definition at line 114 of file querymatch.cpp.
void Plasma::QueryMatch::setType | ( | Type | type | ) |
QString Plasma::QueryMatch::subtext | ( | ) | const |
Definition at line 156 of file querymatch.cpp.
QString Plasma::QueryMatch::text | ( | ) | const |
Definition at line 151 of file querymatch.cpp.
QueryMatch::Type Plasma::QueryMatch::type | ( | ) | const |
The type of action this is.
Defaults to PossibleMatch.
Definition at line 94 of file querymatch.cpp.
The documentation for this class was generated from the following files: