Core::BaseFileWizardFactory Class
class Core::BaseFileWizardFactoryLa classe `BaseFileWizardFactory` implementa una procedura guidata generica per la creazione di file. Per saperne di più...
| Header: | #include <coreplugin/basefilewizardfactory.h> |
| Inherits: | Core::IWizardFactory |
Membri pubblici statici
| Utils::FilePath | buildFileName(const Utils::FilePath &path, const QString &baseName, const QString &extension) |
Funzioni protette
| virtual Core::BaseFileWizard * | create(const Core::WizardDialogParameters ¶meters) const = 0 |
| virtual Utils::Result<> | postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l) const |
| virtual Utils::Result<> | writeFiles(const Core::GeneratedFiles &files) const |
Membri statici protetti
| Utils::Result<> | postGenerateOpenEditors(const Core::GeneratedFiles &l) |
| QString | preferredSuffix(const QString &mimeType) |
| Utils::Result<Core::BaseFileWizardFactory::OverwriteResult> | promptOverwrite(Core::GeneratedFiles *files) |
Descrizione dettagliata
È necessario implementare le seguenti funzioni astratte:
- create(): Viene chiamata per creare la finestra di dialogo " QWizard " da visualizzare.
- generateFiles(): Genera il contenuto dei file.
Il comportamento può essere ulteriormente personalizzato sovrascrivendo la funzione virtuale postGenerateFiles(), che viene chiamata dopo la generazione dei file.
Nota: Anziché utilizzare questa classe, si consiglia di creare procedure guidate basate su JSON, come indicato in Qt Creator: Aggiungere procedure guidate e Qt Creator: Procedure guidate personalizzate.
Vedi anche Core::GeneratedFile, Core::WizardDialogParameters e Core::BaseFileWizard.
Documentazione sulle funzioni membro
[static] Utils::FilePath BaseFileWizardFactory::buildFileName(const Utils::FilePath &path, const QString &baseName, const QString &extension)
Crea un nome di file che include path, aggiungendo extension a meno che baseName non ne abbia già uno.
[pure virtual protected] Core::BaseFileWizard *BaseFileWizardFactory::create(const Core::WizardDialogParameters ¶meters) const
Crea la procedura guidata utilizzando l'parameters.
[virtual protected] Utils::Result<> BaseFileWizardFactory::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l) const
Sovrascrivere per eseguire le operazioni previste dalla procedura guidata w dopo che i file specificati da l sono stati effettivamente creati.
L'implementazione predefinita apre gli editor con i file appena generati che hanno l'opzione GeneratedFile::OpenEditorAttribute impostata.
[static protected] Utils::Result<> BaseFileWizardFactory::postGenerateOpenEditors(const Core::GeneratedFiles &l)
Apre gli editor per i file l se il loro attributo GeneratedFile::OpenEditorAttribute è impostato di conseguenza.
Se non è possibile aprire gli editor, restituisce Utils::ResultError.
[static protected] QString BaseFileWizardFactory::preferredSuffix(const QString &mimeType)
Restituisce il suffisso preferito per mimeType.
[static protected] Utils::Result<Core::BaseFileWizardFactory::OverwriteResult> BaseFileWizardFactory::promptOverwrite(Core::GeneratedFiles *files)
Esegue un controllo di sovrascrittura su un insieme di file files. Verifica se il file esiste e se può essere sovrascritto, quindi mostra all'utente un riepilogo.
Restituisce se il file può essere sovrascritto.
[virtual protected] Utils::Result<> BaseFileWizardFactory::writeFiles(const Core::GeneratedFiles &files) const
Scrive fisicamente su files.
Se non è possibile scrivere i file, restituisce Utils::ResultError.
Reimplementare (richiamando l'implementazione di base) per creare file con GeneratedFile::CustomGeneratorAttribute impostato.
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.