KRunner::ResultsModel Class
class KRunner::ResultsModelA model that exposes and sorts results for a given query. More...
Header: | #include <KRunner/ResultsModel> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Runner) target_link_libraries(mytarget PRIVATE KF6::Runner) |
Since: | 6.0 |
Inherits: | QSortFilterProxyModel |
Public Types
enum | Roles { IdRole, CategoryRelevanceRole, RelevanceRole, EnabledRole, CategoryRole, …, FavoriteIndexRole } |
Properties
|
|
Public Functions
ResultsModel(QObject *parent = nullptr) | |
ResultsModel(const KConfigGroup &configGroup, const KConfigGroup &stateConfigGroup, QObject *parent = nullptr) | |
void | clear() |
QStringList | favoriteIds() const |
QMimeData * | getMimeData(const QModelIndex &idx) const |
KRunner::QueryMatch | getQueryMatch(const QModelIndex &idx) const |
int | limit() const |
QString | queryString() const |
bool | querying() const |
void | resetLimit() |
bool | run(const QModelIndex &idx) |
bool | runAction(const QModelIndex &idx, int actionNumber) |
KRunner::RunnerManager * | runnerManager() const |
void | setFavoriteIds(const QStringList &ids) |
void | setLimit(int limit) |
void | setQueryString(const QString &queryString) |
(since 6.9) void | setRunnerManager(KRunner::RunnerManager *manager) |
void | setSingleRunner(const QString &runner) |
QString | singleRunner() const |
KPluginMetaData | singleRunnerMetaData() const |
Signals
void | favoriteIdsChanged() |
void | limitChanged() |
void | queryStringChangeRequested(const QString &queryString, int pos) |
void | queryStringChanged(const QString &queryString) |
void | queryingChanged() |
(since 6.9) void | runnerManagerChanged() |
void | singleRunnerChanged() |
Detailed Description
Member Type Documentation
enum ResultsModel::Roles
Constant | Value |
---|---|
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 |
KRunner::ResultsModel::QueryMatchRole | 266 |
KRunner::ResultsModel::FavoriteIndexRole | 267 |
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 : const 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:
void | runnerManagerChanged() |
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 : const KPluginMetaData
Access functions:
KPluginMetaData | singleRunnerMetaData() const |
Notifier signal:
void | singleRunnerChanged() |
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 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 6.9.
See also runnerManager().