KRunner 5.109.0
Public Member Functions | List of all members
Plasma::RunnerSyntax

#include <KRunner/RunnerSyntax>

Public Member Functions

 RunnerSyntax (const QString &exampleQuery, const QString &description)
 Constructs a simple syntax object.
 
 RunnerSyntax (const QStringList &exampleQueries, const QString &description)
 Constructs a syntax object.
 
 RunnerSyntax (const RunnerSyntax &other)
 Copy constructor.
 
QString description () const
 
QStringList exampleQueries () const
 
RunnerSyntaxoperator= (const RunnerSyntax &rhs)
 Assignment operator.
 

Detailed Description

Since
4.3

Represents a query prototype that the runner accepts. These can be created and registered with AbstractRunner::addSyntax(Syntax &) to allow applications to show to the user what the runner is currently capable of doing.

Lets say the runner has a trigger word and then the user can type anything after that. In that case you could use ":q:" as a placeholder, which will get expanded to i18n("search term") and be put in brackets.

Plasma::RunnerSyntax syntax(QStringLiteral("sometriggerword :q:"), i18n("Description for this syntax"));
addSyntax(syntax);
Definition runnersyntax.h:42

But if the query the user has to enter is sth. specific like a program, url or file you should use a custom placeholder to make it easier to understand.

Plasma::RunnerSyntax syntax(QStringLiteral("sometriggereword <%1>").arg(i18n("program name"))), i18n("Description for this syntax"));
addSyntax(syntax);

Constructor & Destructor Documentation

◆ RunnerSyntax() [1/3]

Plasma::RunnerSyntax::RunnerSyntax ( const QString &  exampleQuery,
const QString &  description 
)

Constructs a simple syntax object.

Parameters
exampleQuerySee the class description for examples and placeholder conventions.
descriptionA description of what the described syntax does from the user's point of view.

◆ RunnerSyntax() [2/3]

Plasma::RunnerSyntax::RunnerSyntax ( const QStringList &  exampleQueries,
const QString &  description 
)
explicit

Constructs a syntax object.

Parameters
exampleQuerySee the class description for examples and placeholder conventions.
descriptionA description of what the described syntax does from the user's point of view.
Since
5.106

◆ RunnerSyntax() [3/3]

Plasma::RunnerSyntax::RunnerSyntax ( const RunnerSyntax other)

Copy constructor.

Member Function Documentation

◆ description()

QString Plasma::RunnerSyntax::description ( ) const
Returns
the description of what the syntax does from the user's point of view

◆ exampleQueries()

QStringList Plasma::RunnerSyntax::exampleQueries ( ) const
Returns
the example queries associated with this Syntax object

◆ operator=()

RunnerSyntax & Plasma::RunnerSyntax::operator= ( const RunnerSyntax rhs)

Assignment operator.