On this page

Core::AiTaskButton Class

class Core::AiTaskButton

The AiTaskButton class is a button with the icon of the AI chat that runs a task tree in which an AI does something, such as writing a commit message. More...

Header: #include <aitaskbutton.h>
Inherits: QToolButton

Public Functions

AiTaskButton(QWidget *parent = nullptr)
virtual ~AiTaskButton() override
void cancel()
bool isRunning() const
void setIdleToolTip(const QString &toolTip)
void setProgress(const QString &title, Utils::Id id)
void setRecipe(const Core::AiTaskButton::RecipeFactory &recipe)
void setRequestMode(Utils::AiRequest::Mode mode)
void start()

Detailed Description

The recipe that setRecipe() sets usually collects the context and then runs a Utils::AiRequestTask. While it runs, the button shows a spinner, and the progress shows in the status bar. Clicking the button again or canceling the progress cancels the task tree, and with it the request.

The button is hidden while no target can run requests of the mode that setRequestMode() sets.

See also Utils::AiAssistance.

Member Function Documentation

[explicit] AiTaskButton::AiTaskButton(QWidget *parent = nullptr)

Creates a button with parent.

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

Ends a running task tree without calling its handlers.

void AiTaskButton::cancel()

Cancels the task tree if it runs.

bool AiTaskButton::isRunning() const

Returns whether the task tree runs.

void AiTaskButton::setIdleToolTip(const QString &toolTip)

Sets the toolTip of the button while it does not run.

void AiTaskButton::setProgress(const QString &title, Utils::Id id)

Shows the progress of a running task tree with title in the status bar, as a task of type id.

void AiTaskButton::setRecipe(const Core::AiTaskButton::RecipeFactory &recipe)

Sets the function that returns the recipe of the task tree that the button runs. It is called each time the button starts.

void AiTaskButton::setRequestMode(Utils::AiRequest::Mode mode)

Sets the mode of the AI request that the recipe runs, which decides whether the button is shown.

The default is Utils::AiRequest::Interactive.

void AiTaskButton::start()

Starts the task tree, unless it runs already.

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.