KRunner::QueryMatch
#include <KRunner/QueryMatch>
Public Types | |
enum class | CategoryRelevance { Lowest = 0 , Low = 30 , Moderate = 50 , High = 70 , Highest = 100 } |
Detailed Description
A match returned by an AbstractRunner in response to a given RunnerContext.
Definition at line 31 of file querymatch.h.
Member Enumeration Documentation
◆ CategoryRelevance
|
strong |
Helper for reading standardized category relevance values.
Definition at line 66 of file querymatch.h.
Constructor & Destructor Documentation
◆ QueryMatch() [1/2]
|
explicit |
Constructs a PossibleMatch associated with a given RunnerContext and runner.
- Parameters
-
runner the runner this match belongs to
Definition at line 87 of file querymatch.cpp.
◆ QueryMatch() [2/2]
KRunner::QueryMatch::QueryMatch | ( | const QueryMatch & | other | ) |
Copy constructor.
Definition at line 92 of file querymatch.cpp.
Member Function Documentation
◆ actions()
KRunner::Actions KRunner::QueryMatch::actions | ( | ) | const |
List of actions set for this match.
- Returns
- actions
- Since
- 5.75
Definition at line 298 of file querymatch.cpp.
◆ addAction()
void KRunner::QueryMatch::addAction | ( | const KRunner::Action & | action | ) |
Adds an action to this match.
- Since
- 5.75
- See also
- setActions
Definition at line 292 of file querymatch.cpp.
◆ categoryRelevance()
qreal KRunner::QueryMatch::categoryRelevance | ( | ) | const |
◆ data()
QVariant KRunner::QueryMatch::data | ( | ) | const |
- Returns
- the data associated with this match; usually runner-specific
Definition at line 195 of file querymatch.cpp.
◆ icon()
QIcon KRunner::QueryMatch::icon | ( | ) | const |
- Returns
- the icon for this match
Definition at line 213 of file querymatch.cpp.
◆ iconName()
QString KRunner::QueryMatch::iconName | ( | ) | const |
◆ id()
QString KRunner::QueryMatch::id | ( | ) | const |
- Returns
- 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 104 of file querymatch.cpp.
◆ isEnabled()
bool KRunner::QueryMatch::isEnabled | ( | ) | const |
- Returns
- true if the match is enabled and therefore runnable, otherwise false
Definition at line 242 of file querymatch.cpp.
◆ isMultiLine()
bool KRunner::QueryMatch::isMultiLine | ( | ) | const |
If the text should be displayed as a multiLine string If no explicit value is set set using setMultiline it will default to false.
- Returns
- bool
- Since
- 5.82
Definition at line 262 of file querymatch.cpp.
◆ isValid()
bool KRunner::QueryMatch::isValid | ( | ) | const |
- Returns
- true if the match is valid and can therefore be run, an invalid match does not have an associated AbstractRunner
Definition at line 99 of file querymatch.cpp.
◆ matchCategory()
QString KRunner::QueryMatch::matchCategory | ( | ) | const |
Extra information about the match which can be used to categorize the type.
The default is AbstractRunner::name
Definition at line 128 of file querymatch.cpp.
◆ operator!=()
bool KRunner::QueryMatch::operator!= | ( | const QueryMatch & | other | ) | const |
Definition at line 281 of file querymatch.cpp.
◆ operator=()
QueryMatch & KRunner::QueryMatch::operator= | ( | const QueryMatch & | other | ) |
Definition at line 267 of file querymatch.cpp.
◆ operator==()
bool KRunner::QueryMatch::operator== | ( | const QueryMatch & | other | ) | const |
Definition at line 276 of file querymatch.cpp.
◆ relevance()
qreal KRunner::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 141 of file querymatch.cpp.
◆ runner()
AbstractRunner * KRunner::QueryMatch::runner | ( | ) | const |
- Returns
- the runner associated with this action
Definition at line 146 of file querymatch.cpp.
◆ selectedAction()
KRunner::Action KRunner::QueryMatch::selectedAction | ( | ) | const |
The action that the user has selected when running the match.
This returns a nullptr if no action was selected.
Definition at line 247 of file querymatch.cpp.
◆ setActions()
void KRunner::QueryMatch::setActions | ( | const QList< KRunner::Action > & | actions | ) |
Set the actions for this match.
This method allows you to set the actions inside of the AbstractRunner::match method
- See also
- RunnerManager::actionsForMatch
- Since
- 5.75
Definition at line 286 of file querymatch.cpp.
◆ setCategoryRelevance() [1/2]
|
inline |
Relevance for matches in the category.
The match with the highest relevance is respected for the entire category. This value only affects the sorting of categories and not the sorting within the category. Use setRelevance for this. The value should be from 0 to 100.
- Since
- 6.0
Definition at line 81 of file querymatch.h.
◆ setCategoryRelevance() [2/2]
void KRunner::QueryMatch::setCategoryRelevance | ( | qreal | relevance | ) |
Internal for now, consumers should utilize CategoryRelevance enum
- Since
- 6.0
Definition at line 113 of file querymatch.cpp.
◆ setData()
void KRunner::QueryMatch::setData | ( | const QVariant & | data | ) |
Sets data to be used internally by the runner's AbstractRunner::run implementation.
When set, it is also used to form part of the id for this match. If that is inappropriate as an id, the runner may generate its own id and set that with setId
Definition at line 163 of file querymatch.cpp.
◆ setEnabled()
void KRunner::QueryMatch::setEnabled | ( | bool | enable | ) |
Sets whether or not this match can be activited.
- Parameters
-
enable true if the match is enabled and therefore runnable
Definition at line 237 of file querymatch.cpp.
◆ setIcon()
void KRunner::QueryMatch::setIcon | ( | const QIcon & | icon | ) |
Sets the icon associated with this match.
Prefer using setIconName.
- Parameters
-
icon the icon to show along with the match
Definition at line 183 of file querymatch.cpp.
◆ setIconName()
void KRunner::QueryMatch::setIconName | ( | const QString & | iconName | ) |
Sets the icon name associated with this match.
- Parameters
-
icon the name of the icon to show along with the match
- Since
- 5.24
Definition at line 189 of file querymatch.cpp.
◆ setId()
void KRunner::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.
If the "X-Plasma-Runner-Unique-Results" property from the metadata is set to true, the runnerId will not be prepended to the ID. This allows KRunner to de-duplicate results from different runners. In case the runner's matches are less specific than ones from other runners, the "X-Plasma-Runner-Weak-Results" property can be set so that duplicates from this runner are removed.
- Parameters
-
id the new identifying string to use to refer to this entry
Definition at line 177 of file querymatch.cpp.
◆ setMatchCategory()
void KRunner::QueryMatch::setMatchCategory | ( | const QString & | category | ) |
Sets information about the type of the match which is used to group the matches.
This string should be translated as it is displayed in an UI. The default is AbstractRunner::name
Definition at line 123 of file querymatch.cpp.
◆ setMultiLine()
void KRunner::QueryMatch::setMultiLine | ( | bool | multiLine | ) |
Set if the text should be displayed as a multiLine string.
- Parameters
-
multiLine
- Since
- 5.82
Definition at line 257 of file querymatch.cpp.
◆ setRelevance()
void KRunner::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 136 of file querymatch.cpp.
◆ setSubtext()
void KRunner::QueryMatch::setSubtext | ( | const QString & | text | ) |
Sets the descriptive text for this match; can be longer than the main title text.
- Parameters
-
text the text to use as the description
Definition at line 157 of file querymatch.cpp.
◆ setText()
void KRunner::QueryMatch::setText | ( | const QString & | text | ) |
Sets the main title text for this match; should be short enough to fit nicely on one line in a user interface For styled and multiline text, setMultiLine should be set to true.
- Parameters
-
text the text to use as the title
Definition at line 151 of file querymatch.cpp.
◆ setUrls()
Sets the urls, if any, associated with this match.
Definition at line 225 of file querymatch.cpp.
◆ subtext()
QString KRunner::QueryMatch::subtext | ( | ) | const |
- Returns
- the descriptive text for this match
Definition at line 207 of file querymatch.cpp.
◆ text()
QString KRunner::QueryMatch::text | ( | ) | const |
- Returns
- the title text for this match
Definition at line 201 of file querymatch.cpp.
◆ urls()
- Returns
- the urls for this match, empty list if none These will be used in the default implementation of AbstractRunner::mimeDataForMatch
Definition at line 231 of file querymatch.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.