Pages
API Documentation
On this page

KRunner::ResultsModel Class

A model that exposes and sorts results for a given query. This class was introduced in Qt 6.0. More...

  • Header: #include <KRunner/ResultsModel>
  • Since: Qt 6.0
  • CMake: find_package(KF6 REQUIRED COMPONENTS Runner)
    target_link_libraries(mytarget PRIVATE KF6::Runner)
  • Inherits: QSortFilterProxyModel

List of all members, including inherited members

Public Types

Properties

Public Functions

Signals

Detailed Description

Member Type Documentation

enum ResultsModel::Roles

Constant
KRunner::ResultsModel::IdRole Qt::UserRole + 1
KRunner::ResultsModel::CategoryRelevanceRole 258
KRunner::ResultsModel::RelevanceRole 259
KRunner::ResultsModel::EnabledRole 260
KRunner::ResultsModel::CategoryRole 261
KRunner::ResultsModel::SubtextRole 262
KRunner::ResultsModel::ActionsRole 263
KRunner::ResultsModel::MultiLineRole 264
KRunner::ResultsModel::UrlsRole 265

Property Documentation

favoriteIds : QStringList

Access functions:

  • QStringList favoriteIds() const
  • void setFavoriteIds(const QStringList &ids)

Notifier signal:

  • void favoriteIdsChanged()

limit : int

The preferred maximum number of matches in the model

If there are lots of results from different categories, the limit can be slightly exceeded.

Default is 0, which means no limit.

Access functions:

  • int limit() const
  • void setLimit(int limit)
  • void resetLimit()

Notifier signal:

  • void limitChanged()

queryString : QString

The query string to run

Access functions:

  • QString queryString() const
  • void setQueryString(const QString &queryString)

Notifier signal:

  • void queryStringChanged(const QString &queryString)

[read-only] querying : bool

Whether the query is currently being run

This can be used to show a busy indicator

Access functions:

  • bool querying() const

Notifier signal:

  • void queryingChanged()

runnerManager : KRunner::RunnerManager*

Access functions:

  • KRunner::RunnerManager *runnerManager() const
  • void setRunnerManager(KRunner::RunnerManager *manager)

Notifier signal:

singleRunner : QString

The single runner to use for querying in single runner mode

Defaults to empty string which means all runners

Access functions:

  • QString singleRunner() const
  • void setSingleRunner(const QString &runner)

Notifier signal:

  • void singleRunnerChanged()

[read-only] singleRunnerMetaData : KPluginMetaData

Access functions:

  • KPluginMetaData singleRunnerMetaData() const

Notifier signal:

Member Function Documentation

[explicit] ResultsModel::ResultsModel(QObject *parent = nullptr)

[explicit] ResultsModel::ResultsModel(const KConfigGroup &configGroup, const KConfigGroup &stateConfigGroup, QObject *parent = nullptr)

[invokable] void ResultsModel::clear()

Clears the model content and resets the runner context, i.e. no new items will appear.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[invokable] QMimeData *ResultsModel::getMimeData(const QModelIndex &idx) const

Get mime data for the result at given model index idx

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

KRunner::QueryMatch ResultsModel::getQueryMatch(const QModelIndex &idx) const

Get match for the result at given model index idx

[signal] void ResultsModel::queryStringChangeRequested(const QString &queryString, int pos)

This signal is emitted when a an InformationalMatch is run, and it is advised to update the search term, e.g. used for calculator runner results

[invokable] bool ResultsModel::run(const QModelIndex &idx)

Run the result at the given model index idx

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[invokable] bool ResultsModel::runAction(const QModelIndex &idx, int actionNumber)

Run the action actionNumber at given model index idx

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[signal, since 6.9] void ResultsModel::runnerManagerChanged()

Note: Notifier signal for property runnerManager.

This function was introduced in Qt 6.9.

void ResultsModel::setFavoriteIds(const QStringList &ids)

IDs of favorite plugins. Those plugins are always in a fixed order before the other ones.

ids KPluginMetaData::pluginId values of plugins

Note: Setter function for property favoriteIds.

See also favoriteIds()

[since 6.9] void ResultsModel::setRunnerManager(KRunner::RunnerManager *manager)

Note: Setter function for property runnerManager.

This function was introduced in Qt 6.9.

See also runnerManager()

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.