InfoBar: Make adding more buttons possible

Change-Id: Ic0c946cf3f87fe46cd06391f38e0bc71374ad340
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Eike Ziller
2022-01-17 16:47:31 +01:00
parent 49ac087955
commit 3749cfc896
22 changed files with 40 additions and 39 deletions

View File

@@ -1599,7 +1599,7 @@ void TextEditorWidgetPrivate::updateCannotDecodeInfo()
InfoBarEntry info(selectEncodingId,
TextEditorWidget::tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
.arg(m_document->displayName(), QString::fromLatin1(m_document->codec()->name())));
info.setCustomButtonInfo(TextEditorWidget::tr("Select Encoding"), [this]() { q->selectEncoding(); });
info.addCustomButton(TextEditorWidget::tr("Select Encoding"), [this]() { q->selectEncoding(); });
infoBar->addInfo(info);
} else {
infoBar->removeInfo(selectEncodingId);
@@ -3234,7 +3234,7 @@ void TextEditorWidgetPrivate::updateSyntaxInfoBar(const Highlighter::Definitions
BaseTextEditor::tr("A highlight definition was not found for this file. "
"Would you like to download additional highlight definition files?"),
InfoBarEntry::GlobalSuppression::Enabled);
info.setCustomButtonInfo(BaseTextEditor::tr("Download Definitions"), [missing, this]() {
info.addCustomButton(BaseTextEditor::tr("Download Definitions"), [missing, this]() {
m_document->infoBar()->removeInfo(missing);
Highlighter::downloadDefinitions();
});
@@ -3250,7 +3250,7 @@ void TextEditorWidgetPrivate::updateSyntaxInfoBar(const Highlighter::Definitions
this->configureGenericHighlighter(Highlighter::definitionForName(definition));
});
info.setCustomButtonInfo(BaseTextEditor::tr("Remember My Choice"), [multiple, this]() {
info.addCustomButton(BaseTextEditor::tr("Remember My Choice"), [multiple, this]() {
m_document->infoBar()->removeInfo(multiple);
rememberCurrentSyntaxDefinition();
});