Core::ICore Class
class Core::ICoreICore 클래스를 사용하면 Qt Creator 의 기본 기능을 구성하는 여러 부분에 접근할 수 있습니다. 더 보기...
| Header: | #include <coreplugin/icore.h> |
| Inherits: | QObject |
공개 유형
| enum class | ContextPriority { High, Low } |
신호
| void | contextAboutToChange(const QList<Core::IContext *> &context) |
| void | contextChanged(const Core::Context &context) |
| void | coreAboutToClose() |
| void | coreAboutToOpen() |
| void | coreOpened() |
| void | saveSettingsRequested(Core::ICore::SaveSettingsReason reason) |
정적 공용 멤버
| void | addAdditionalContext(const Core::Context &context, Core::ICore::ContextPriority priority = ContextPriority::Low) |
| void | addContextObject(Core::IContext *context) |
| void | addPreCloseListener(const std::function<bool ()> &listener) |
| bool | askForRestart(const QString &text, const QString &altButtonText = {}) |
| Utils::FilePath | cacheResourcePath(const QString &rel = {}) |
| QList<Core::IContext *> | contextObjects(QWidget *widget) |
| QList<Core::IContext *> | currentContextObjects() |
| QWidget * | currentContextWidget() |
| QWidget * | dialogParent() |
| bool | enablePlugins(const QSet<ExtensionSystem::PluginSpec *> &plugins) |
| Utils::InfoBar * | infoBar() |
| Utils::FilePath | installerResourcePath(const QString &rel = {}) |
| Core::ICore * | instance() |
| bool | isNewItemDialogRunning() |
| Utils::FilePath | libexecPath(const QString &rel = {}) |
| QMainWindow * | mainWindow() |
| QString | msgShowSettings() |
| QString | msgShowSettingsToolTip() |
| QWidget * | newItemDialog() |
| QPrinter * | printer() |
| void | raiseWindow(QWidget *widget) |
| void | registerWindow(QWidget *window, const Core::Context &context, const Core::Context &actionContext = {}) |
| void | removeAdditionalContext(const Core::Context &context) |
| void | removeContextObject(Core::IContext *context) |
| Utils::FilePath | resourcePath(const QString &rel = {}) |
| void | restart() |
| Utils::QtcSettings * | settings(QSettings::Scope scope = QSettings::UserScope) |
| void | showNewItemDialog(const QString &title, const QList<Core::IWizardFactory *> &factories, const Utils::FilePath &defaultLocation = {}, const QVariantMap &extraVariables = {}) |
| void | showSettings(const Utils::Id page) |
| void | showSettings(const Utils::Id page, Utils::Id item) |
| void | showWarningWithOptions(const QString &title, const QString &text, const QString &details = QString(), Utils::Id settingsId = {}) |
| void | updateAdditionalContexts(const Core::Context &remove, const Core::Context &add, Core::ICore::ContextPriority priority = ContextPriority::Low) |
| QString | userInterfaceLanguage() |
| Utils::FilePath | userResourcePath(const QString &rel = {}) |
| QString | versionString() |
상세 설명
이 인터페이스의 하위 클래스를 절대 생성해서는 안 됩니다. 유일한 인스턴스는 Core 플러그인에 의해 생성됩니다. 플러그인에서 instance()을 통해 이 인스턴스에 접근할 수 있습니다.
멤버 유형 설명
enum class ICore::ContextPriority
이 열거형은 추가 컨텍스트의 우선순위를 정의합니다.
| 상수 | 값 | 설명 |
|---|---|---|
Core::ICore::ContextPriority::High | 0 | Core::IContext 인스턴스의 컨텍스트보다 우선순위가 높은 추가 컨텍스트. |
Core::ICore::ContextPriority::Low | 1 | Core::IContext 인스턴스의 컨텍스트보다 우선순위가 낮은 추가 컨텍스트입니다. |
Core::ICore::updateAdditionalContexts()도 참조하십시오 .
멤버 함수 문서
[static] void ICore::addAdditionalContext(const Core::Context &context, Core::ICore::ContextPriority priority = ContextPriority::Low)
priority 를 가진 context 를 활성 추가 컨텍스트 목록에 추가합니다.
updateAdditionalContexts()도 참조하십시오 .
[static] void ICore::addContextObject(Core::IContext *context)
등록된 IContext 인스턴스 목록에 context 를 추가합니다. IContext 의 widget 가 애플리케이션 포커스 위젯의 상위 계층 구조에 포함될 때마다, 해당 context 가 활성 컨텍스트 목록에 추가됩니다.
removeContextObject(), updateAdditionalContexts(), currentContextObjects() 및 ‘액션 관리자 및 명령(The Action Manager and Commands)’ 항목도 참조하십시오 .
[static] void ICore::addPreCloseListener(const std::function<bool ()> &listener)
플러그인이 애플리케이션 종료 시 이를 차단할 수 있는 메서드를 제공합니다.
애플리케이션 창이 종료를 요청하면 모든 리스너가 호출됩니다. listener 호출 중 하나라도 ` false`를 반환하면 프로세스가 중단되고 이벤트는 무시됩니다. 모든 호출이 ` true`를 반환하면 ` coreAboutToClose()`가 발생하고 이벤트는 수락되거나 실행됩니다.
[static] bool ICore::askForRestart(const QString &text, const QString &altButtonText = {})
사용자에게 Qt Creator 을 다시 시작할 것인지 묻는 모달 대화 상자를 표시합니다.
대화 상자의 주요 텍스트로 ' text '를 사용하며, 사용자가 ' Restart Now ' 버튼을 선택하면 Qt Creator 의 재시작을 실행합니다.
이 대화 상자에는 Later 버튼도 있습니다. Later 버튼의 텍스트를 변경하려면 altButtonText 을 설정하십시오.
사용자가 ‘ Restart Now ’을 선택하면 ‘ true ’을 반환합니다.
[static] Utils::FilePath ICore::cacheResourcePath(const QString &rel = {})
rel 라는 상대 경로에 대해, 영구 캐시 파일에 사용할 수 있는 쓰기 가능한 경로를 반환합니다.
[signal] void ICore::contextAboutToChange(const QList<Core::IContext *> &context)
새로운 context 가 곧 현재 컨텍스트가 될 것임을 나타냅니다(즉, 해당 위젯이 포커스를 얻게 됨을 의미합니다).
[signal] void ICore::contextChanged(const Core::Context &context)
새로운 ` context `가 방금 현재 컨텍스트가 되었음을 나타냅니다. 여기에는 포커스 대상의 컨텍스트와 추가 컨텍스트가 모두 포함됩니다.
[static] QList<Core::IContext *> ICore::contextObjects(QWidget *widget)
지정된 ` widget`에 대해 등록된 모든 ` IContext ` 인스턴스를 반환합니다(있는 경우).
[signal] void ICore::coreAboutToClose()
플러그인이 수명 종료 전에 수행해야 할 일부 작업을 수행할 수 있도록 합니다.
이 신호가 발생하면 애플리케이션이 반드시 종료됩니다. 이는 편의상, 일반적인 플러그인 라이프사이클 함수인 IPlugin::aboutToShutdown() 에 추가로 제공되는 기능입니다.
[signal] void ICore::coreAboutToOpen()
모든 플러그인이 로드되었으며 메인 창이 곧 표시될 것임을 나타냅니다.
[signal] void ICore::coreOpened()
모든 플러그인이 로드되었으며 메인 창이 표시되었음을 나타냅니다.
[static] QList<Core::IContext *> ICore::currentContextObjects()
현재 최상위 컨텍스트 위젯에 대한 IContext 목록을 반환하거나, 해당 위젯이 없는 경우 빈 목록을 반환합니다.
updateAdditionalContexts(), addContextObject() 및 ‘액션 매니저와 명령’항목도 참조하십시오 .
[static] QWidget *ICore::currentContextWidget()
현재 컨텍스트의 최상위 IContext 위젯을 반환하며, 해당 위젯이 없는 경우에는 nullptr 를 반환합니다.
currentContextObjects()도 참조하십시오 .
[static] QWidget *ICore::dialogParent()
QDialog의 부모로 사용하기에 적합한 위젯 포인터를 반환합니다.
특히 모달 대화 상자의 경우, 새 대화 상자의 부모로 현재 모달 대화 상자(있는 경우)를 사용하는 것이 중요합니다. 그렇지 않으면 새 대화 상자가 기존 대화 상자 뒤에 열릴 수 있을 뿐만 아니라, 기존 대화 상자와의 상호작용도 차단될 수 있기 때문입니다. dialogParent()를 사용하면 이를 보장할 수 있습니다.
또한, 특별한 수명 주기 관리가 필요 없는 비모달 대화 상자의 경우에도 dialogParent()를 사용하십시오. 비모달 대화 상자의 수명 주기를 제어해야 하는 경우(예: 애플리케이션의 다른 부분이 해당 대화 상자에 의존하는 경우), 대신 더 구체적인 부모를 사용하십시오.
[static] bool ICore::enablePlugins(const QSet<ExtensionSystem::PluginSpec *> &plugins)
사용자에게 ‘ plugins ’ 및 해당 종속 항목을 활성화할지 묻습니다. 사용자가 동의하면 플러그인이 활성화됩니다. 모든 플러그인이 재시작 없이 소프트 로드 가능한 경우, 해당 플러그인이 즉시 로드됩니다. 그렇지 않은 경우 “재시작 필요” 대화 상자가 표시됩니다.
사용자가 플러그인 활성화에 동의했는지 여부를 반환합니다.
[static] Utils::InfoBar *ICore::infoBar()
Qt Creator 의 메인 창에 표시되는 중앙 InfoBar를 반환합니다. 대화 상자를 띄워 작업을 방해하지 않고 사용자에게 무언가를 알릴 때 사용합니다. 적당히 사용하십시오.
[static] Utils::FilePath ICore::installerResourcePath(const QString &rel = {})
rel 라는 상대 경로를 기준으로, 설치 프로그램이 작성한 리소스(예: 미리 정의된 키트 및 툴체인)의 경로를 반환합니다.
[static] Core::ICore *ICore::instance()
인스턴스에 대한 포인터를 반환합니다. 신호에 연결할 때만 사용하십시오.
[static] bool ICore::isNewItemDialogRunning()
현재 새 항목 대화 상자가 열려 있는지 여부를 반환합니다.
[static] Utils::FilePath ICore::libexecPath(const QString &rel = {})
rel 의 상대 경로를 기준으로, Qt Creator 설치본에 포함된 명령줄 도구의 경로를 반환합니다.
[static] QMainWindow *ICore::mainWindow()
애플리케이션의 메인 창을 반환합니다.
대화 상자의 부모 창인 경우 ` dialogParent()`를 사용하십시오.
dialogParent()도 참조하십시오 .
[static] QString ICore::msgShowSettings()
환경 설정 모드를 여는 버튼에 사용할 텍스트를 반환합니다.
showSettings() 및 msgShowOptionsDialogToolTip()도 참조하십시오 .
[static] QString ICore::msgShowSettingsToolTip()
환경 설정 모드를 여는 버튼에 사용할 툴팁을 반환합니다.
showSettings() 및 msgShowOptionsDialog()도 참조하십시오 .
[static] QWidget *ICore::newItemDialog()
현재 열려 있는 새 항목 대화 상자 위젯을 반환하거나, 해당 위젯이 없는 경우 ` nullptr `를 반환합니다.
isNewItemDialogRunning() 및 showNewItemDialog()도 참조하십시오 .
[static] QPrinter *ICore::printer()
애플리케이션의 프린터 객체를 반환합니다.
인쇄할 때는 항상 이 프린터 객체를 사용해야 하며, 이렇게 하면 애플리케이션의 여러 부분에서 해당 설정을 재사용할 수 있습니다.
[static] void ICore::raiseWindow(QWidget *widget)
widget 의 창을 표시하고 활성화합니다. 여기에는 X11에 대한 해결 방법이 포함되어 있습니다.
[static] void ICore::registerWindow(QWidget *window, const Core::Context &context, const Core::Context &actionContext = {})
지정된 ` context`를 사용하여 ` window `를 등록합니다. 등록된 창은 ` Window ` 메뉴에 표시되며, 최소화, 확대/축소, 전체 화면 및 닫기 등 다양한 창 관련 동작에 대해 등록됩니다. 동작의 컨텍스트는 기본적으로 ` context `이지만, ` actionContext`을 사용하여 재정의할 수 있습니다.
응용 프로그램의 포커스가 window 에 있을 때마다, 해당 context 가 활성화됩니다.
[static] void ICore::removeAdditionalContext(const Core::Context &context)
활성 추가 컨텍스트 목록에서 ‘ context ’를 제거합니다.
updateAdditionalContexts()도 참조하십시오 .
[static] void ICore::removeContextObject(Core::IContext *context)
등록된 IContext 인스턴스 목록에서 context 객체의 등록을 해제합니다. IContext 인스턴스는 삭제될 때 자동으로 제거됩니다.
addContextObject(), updateAdditionalContexts(), currentContextObjects()도 참조하십시오 .
[static] Utils::FilePath ICore::resourcePath(const QString &rel = {})
프로젝트 템플릿이나 디버거 매크로와 같은 리소스에 사용되는 상대 경로 rel 에 대한 절대 경로를 반환합니다.
예를 들어 macOS에서는 리소스가 애플리케이션 번들의 일부이므로, 플랫폼별 코드가 여기저기 흩어지는 것을 방지하기 위해 이러한 추상화가 필요합니다.
userResourcePath()도 참조하십시오 .
[static] void ICore::restart()
Qt Creator 를 다시 시작하고 마지막 세션을 복원합니다.
[signal] void ICore::saveSettingsRequested(Core::ICore::SaveSettingsReason reason)
사용자가 전역 설정을 디스크에 저장하도록 요청했다는 신호를 reason 에 전달합니다.
현재 이 작업은 애플리케이션이 종료될 때와 Save All 에서 수행됩니다.
[static] Utils::QtcSettings *ICore::settings(QSettings::Scope scope = QSettings::UserScope)
애플리케이션의 기본 설정 객체를 반환합니다.
이 객체를 사용하여 (세션이나 프로젝트별 설정과 달리) 애플리케이션 전체에 적용되는 설정을 가져오거나 설정할 수 있습니다.
scope 가 QSettings::UserScope (기본값)인 경우, 설정은 사용자의 설정에서 읽히며, Qt Creator 로 제공되는 전역 설정이 대체로 사용됩니다.
scope 가 QSettings::SystemScope 인 경우, 현재 버전의 Qt Creator 에 포함된 설치 설정만 읽힙니다. 이 기능은 내부 용도로만 제공됩니다.
[static] void ICore::showNewItemDialog(const QString &title, const QList<Core::IWizardFactory *> &factories, const Utils::FilePath &defaultLocation = {}, const QVariantMap &extraVariables = {})
사용자가 새 파일이나 프로젝트를 생성하는 일련의 ‘ factories ’ 중에서 선택할 수 있는 대화 상자를 엽니다.
title 인수는 대화 상자의 제목으로 표시됩니다. 파일이 생성될 경로(사용자가 변경하지 않는 경우)는 defaultLocation 에서 설정됩니다. 기본값은 마법사의 종류에 따라 DocumentManager::projectsDirectory() 또는 DocumentManager::fileDialogLastVisitedDirectory()입니다.
마법사에 대한 추가 변수는 extraVariables 에서 설정됩니다.
Core::DocumentManager, isNewItemDialogRunning() 및 newItemDialog()도 참조하십시오 .
[static] void ICore::showSettings(const Utils::Id page)
지정된 page 에서 환경설정 모드를 엽니다.
msgShowOptionsDialog () 및 msgShowOptionsDialogToolTip()도 참조하십시오 .
[static] void ICore::showSettings(const Utils::Id page, Utils::Id item)
지정된 page 에서 환경 설정 모드를 엽니다. 대화 상자의 parent 는 기본적으로 dialogParent()로 설정됩니다. 이 메서드가 호출될 때 대화 상자가 이미 표시되어 있는 경우, 지정된 page 로 전환됩니다. 대화 상자가 해석할 수 있는 item 로 지정된 대화 상자의 일부를 미리 선택합니다.
msgShowOptionsDialog () 및 msgShowOptionsDialogToolTip()도 참조하십시오 .
[static] void ICore::showWarningWithOptions(const QString &title, const QString &text, const QString &details = QString(), Utils::Id settingsId = {})
parent 속성이 지정된 메시지 상자를 생성하며, 이 상자에는 settingsId 로 지정된 설정 페이지를 여는 ‘ Configure ’ 버튼이 포함됩니다.
이 대화 상자는 title 을 포함하며, " text "이라는 메시지와 details 으로 지정된 상세 정보를 표시합니다.
이 함수를 사용하여 구성 오류를 표시하고, 사용자가 수정해야 할 설정을 안내하십시오.
showSettings()도 참조하십시오 .
[static] void ICore::updateAdditionalContexts(const Core::Context &remove, const Core::Context &add, Core::ICore::ContextPriority priority = ContextPriority::Low)
remove 에 지정된 컨텍스트를 활성 추가 컨텍스트 목록에서 제거하고, add 에 지정된 컨텍스트를 priority 와 함께 추가합니다.
추가 컨텍스트는 IContext 인스턴스와 연관되어 있지 않습니다.
우선순위가 높은 추가 컨텍스트는 IContext 인스턴스에 의해 추가된 컨텍스트보다 우선순위가 높고, 우선순위가 낮은 추가 컨텍스트는 IContext 인스턴스에 의해 추가된 컨텍스트보다 우선순위가 낮습니다.
addContextObject() 및 ‘액션 매니저와 명령’항목도 참조하십시오 .
[static] QString ICore::userInterfaceLanguage()
Qt Creator 에 현재 설정된 사용자 인터페이스 언어에 해당하는 로케일 문자열을 반환합니다. 이 값을 사용하여 QTranslator 를 통해 플러그인의 번역 파일을 설치하십시오.
[static] Utils::FilePath ICore::userResourcePath(const QString &rel = {})
프로젝트 템플릿과 같은 리소스에 사용되는 users 디렉터리 내의 상대 경로 rel 에 대한 절대 경로를 반환합니다.
이 함수는 사용자가 쓰기 작업을 수행할 수 있는 리소스의 위치를 찾는 데 사용합니다. 예를 들어, 사용자 정의 팔레트나 템플릿을 허용하기 위한 경우입니다.
resourcePath()도 참조하십시오 .
[static] QString ICore::versionString()
IDE의 이름과 버전이 “Qt Creator X.Y.Z” 형식으로 포함된 문자열을 반환합니다. “Generated by” 문자열이나 이와 유사한 작업에 이 함수를 사용하십시오.
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.