mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-11-16 23:12:55 -05:00
feat: Add cancel function for progress indicator
This commit is contained in:
@ -60,6 +60,11 @@ void CompletionProgressHandler::hideProgress()
|
||||
Utils::ToolTip::hideImmediately();
|
||||
}
|
||||
|
||||
void CompletionProgressHandler::setCancelCallback(std::function<void()> callback)
|
||||
{
|
||||
m_cancelCallback = callback;
|
||||
}
|
||||
|
||||
void CompletionProgressHandler::identifyMatch(
|
||||
TextEditor::TextEditorWidget *editorWidget, int pos, ReportPriority report)
|
||||
{
|
||||
@ -83,6 +88,11 @@ void CompletionProgressHandler::operateTooltip(
|
||||
|
||||
m_progressWidget = new ProgressWidget(editorWidget);
|
||||
|
||||
// Set cancel callback for the widget
|
||||
if (m_cancelCallback) {
|
||||
m_progressWidget->setCancelCallback(m_cancelCallback);
|
||||
}
|
||||
|
||||
const QRect cursorRect = editorWidget->cursorRect(editorWidget->textCursor());
|
||||
QPoint globalPos = editorWidget->viewport()->mapToGlobal(cursorRect.topLeft());
|
||||
QPoint localPos = editorWidget->mapFromGlobal(globalPos);
|
||||
|
||||
Reference in New Issue
Block a user