이 페이지에서

Core::BaseFileWizardFactory Class

class Core::BaseFileWizardFactory

BaseFileWizardFactory 클래스는 파일을 생성하기 위한 범용 마법사를 구현합니다. 더 보기...

Header: #include <coreplugin/basefilewizardfactory.h>
Inherits: Core::IWizardFactory

정적 공용 멤버

Utils::FilePath buildFileName(const Utils::FilePath &path, const QString &baseName, const QString &extension)

보호된 함수

virtual Core::BaseFileWizard *create(const Core::WizardDialogParameters &parameters) const = 0
virtual Utils::Result<> postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l) const
virtual Utils::Result<> writeFiles(const Core::GeneratedFiles &files) const

정적 보호 멤버

Utils::Result<> postGenerateOpenEditors(const Core::GeneratedFiles &l)
QString preferredSuffix(const QString &mimeType)
Utils::Result<Core::BaseFileWizardFactory::OverwriteResult> promptOverwrite(Core::GeneratedFiles *files)

상세 설명

다음 추상 함수는 반드시 구현되어야 합니다:

  • create(): 표시할 ' QWizard ' 대화 상자를 생성하기 위해 호출됩니다.
  • generateFiles(): 파일 내용을 생성합니다.

파일 생성 후 호출되는 가상 함수 ` postGenerateFiles()`을 재정의하여 동작을 추가로 사용자 정의할 수 있습니다.

참고: 이 클래스를 사용하는대신 , Qt Creator: Add wizards 및 Qt Creator: Custom wizards에 설명된 대로 JSON 기반 마법사를 생성하는 것을 권장합니다.

Core::GeneratedFile, Core::WizardDialogParameters 및 Core::BaseFileWizard도 참조하십시오 .

멤버 함수 문서

[static] Utils::FilePath BaseFileWizardFactory::buildFileName(const Utils::FilePath &path, const QString &baseName, const QString &extension)

path 를 포함하는 파일 이름을 생성하며, baseName 에 이미 파일이 존재하지 않는 경우 extension 를 추가합니다.

[pure virtual protected] Core::BaseFileWizard *BaseFileWizardFactory::create(const Core::WizardDialogParameters &parameters) const

parameters 를 사용하여 마법사를 생성합니다.

[virtual protected] Utils::Result<> BaseFileWizardFactory::postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l) const

l 에서 지정한 파일이 실제로 생성된 후, 마법사 w 에서 수행할 단계를 실행하려면 이 파일을 덮어쓰십시오.

기본 구현에서는 GeneratedFile::OpenEditorAttribute 가 설정된 새로 생성된 파일을 편집기에 열어줍니다.

[static protected] Utils::Result<> BaseFileWizardFactory::postGenerateOpenEditors(const Core::GeneratedFiles &l)

l 파일에 대한 편집기를, 해당 파일의 GeneratedFile::OpenEditorAttribute 속성이 적절히 설정되어 있는 경우 엽니다.

편집기를 열 수 없는 경우, ` Utils::ResultError`을 반환합니다.

[static protected] QString BaseFileWizardFactory::preferredSuffix(const QString &mimeType)

mimeType 에 대한 권장 접미사를 반환합니다.

[static protected] Utils::Result<Core::BaseFileWizardFactory::OverwriteResult> BaseFileWizardFactory::promptOverwrite(Core::GeneratedFiles *files)

files 에 대한 덮어쓰기 검사를 수행합니다. 파일이 존재하는지, 그리고 덮어쓰기가 가능한지 여부를 확인한 후, 사용자에게 요약 내용을 표시합니다.

파일을 덮어쓸 수 있는지 여부를 반환합니다.

[virtual protected] Utils::Result<> BaseFileWizardFactory::writeFiles(const Core::GeneratedFiles &files) const

files 를 실제로 기록합니다.

파일에 쓰기가 불가능할 경우, ` Utils::ResultError`를 반환합니다.

GeneratedFile::CustomGeneratorAttribute 가 설정된 파일을 생성하도록 (기본 구현을 호출하여) 재구현하십시오.

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.