On this page

Utils::AiProvider Class

class Utils::AiProvider

The AiProvider class is the base class for plugins that can carry out an AiRequest. More...

Header: #include <aiassistance.h>
Inherits: QObject

Public Functions

AiProvider(Utils::Id id, const QString &displayName)
virtual ~AiProvider() override
QString displayName() const
virtual void execute(const Utils::AiRequest &request, const Utils::AiTargetSelection &selection, Utils::AiResponse *response) = 0
Utils::Id id() const
std::optional<Utils::AiTarget> target(const QString &targetId) const
QList<Utils::AiTarget> targets() const

Signals

Detailed Description

A provider registers itself on construction and unregisters on destruction. Its targets can change at any time, for example when a provider learns which models an agent offers only after talking to it.

Member Function Documentation

AiProvider::AiProvider(Utils::Id id, const QString &displayName)

Creates and registers a provider with the unique id, which is shown as displayName.

[override virtual noexcept] AiProvider::~AiProvider()

Unregisters the provider.

QString AiProvider::displayName() const

Returns the name of the provider that the user sees.

[pure virtual] void AiProvider::execute(const Utils::AiRequest &request, const Utils::AiTargetSelection &selection, Utils::AiResponse *response)

Carries out request on the target and with the parameters in selection. Every parameter of the target has a value in selection.

The provider must eventually call AiResponse::reportFinished() on response, and should stop working on the request when AiResponse::cancelRequested() is emitted.

Utils::Id AiProvider::id() const

Returns the id of the provider.

std::optional<Utils::AiTarget> AiProvider::target(const QString &targetId) const

Returns the target with targetId, if the provider has it.

QList<Utils::AiTarget> AiProvider::targets() const

Returns the targets of the provider.

[signal] void AiProvider::targetsChanged()

This signal is emitted when the targets of the provider changed.

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.