Wizards: Format generated code according to current style

Needs ClangFormat to be enabled.

Task-number: QTCREATORBUG-25065
Change-Id: I127da0f9ac55af7f19dead19b28470a9b72c4ee5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-05-25 12:13:36 +02:00
parent 68b750d83d
commit 87861cf7ee
8 changed files with 58 additions and 5 deletions

View File

@@ -165,12 +165,16 @@ bool BaseFileWizardFactory::postGenerateOpenEditors(const GeneratedFiles &l, QSt
{
for (const GeneratedFile &file : std::as_const(l)) {
if (file.attributes() & GeneratedFile::OpenEditorAttribute) {
if (!EditorManager::openEditor(file.filePath(), file.editorId())) {
if (errorMessage)
*errorMessage = Tr::tr("Failed to open an editor for \"%1\".").
arg(file.filePath().toUserOutput());
IEditor * const editor = EditorManager::openEditor(file.filePath(), file.editorId());
if (!editor) {
if (errorMessage) {
*errorMessage = Tr::tr("Failed to open an editor for \"%1\".")
.arg(file.filePath().toUserOutput());
}
return false;
}
editor->document()->formatContents();
editor->document()->save(nullptr);
}
}
return true;