ICore Class

(Core::ICore)

The ICore class allows access to the different parts that make up the basic functionality of Qt Creator. More...

Header: #include <ICore>

Public Types

enum ContextPriority { High, Low }
enum OpenFilesFlags { None, SwitchMode, CanContainLineAndColumnNumbers, StopOnLoadFail, SwitchSplitIfAlreadyVisible }
enum SaveSettingsReason { InitializationDone, SettingsDialogDone, ModeChanged, MainWindowClosing }

Public Slots

void saveSettings(Core::ICore::SaveSettingsReason reason)

Signals

void contextAboutToChange(const QList<Core::IContext *> &context)
void contextChanged(const Core::Context &context)
void coreAboutToClose()
void coreAboutToOpen()
void coreOpened()
void newItemDialogStateChanged()
void saveSettingsRequested(Core::ICore::SaveSettingsReason reason)

Static Public Members

void addAdditionalContext(const Core::Context &context, Core::ICore::ContextPriority priority = ContextPriority::Low)
void addContextObject(Core::IContext *context)
void addPreCloseListener(const std::function<bool ()> &listener)
QStringList additionalAboutInformation()
void appendAboutInformation(const QString &line)
QString buildCompatibilityString()
QString cacheResourcePath()
QString clangExecutable(const QString &clangBinDirectory)
QString clangIncludeDirectory(const QString &clangVersion, const QString &clangResourceDirectory)
QString clangTidyExecutable(const QString &clangBinDirectory)
QString clazyStandaloneExecutable(const QString &clangBinDirectory)
Core::IContext *contextObject(QWidget *widget)
Core::IContext *currentContextObject()
QWidget *currentContextWidget()
QWidget *dialogParent()
Core::InfoBar *infoBar()
QString installerResourcePath()
Core::ICore *instance()
bool isNewItemDialogRunning()
QString libexecPath()
QMainWindow *mainWindow()
QString msgShowOptionsDialog()
QString msgShowOptionsDialogToolTip()
QWidget *newItemDialog()
void openFiles(const QStringList &arguments, Core::ICore::OpenFilesFlags flags = None)
QPrinter *printer()
void raiseWindow(QWidget *widget)
void registerWindow(QWidget *window, const Core::Context &context)
void removeAdditionalContext(const Core::Context &context)
void removeContextObject(Core::IContext *context)
QString resourcePath()
void restart()
QSettings *settings(QSettings::Scope scope = QSettings::UserScope)
Core::SettingsDatabase *settingsDatabase()
void setupScreenShooter(const QString &name, QWidget *w, const QRect &rc = QRect())
void showNewItemDialog(const QString &title, const QList<Core::IWizardFactory *> &factories, const QString &defaultLocation = QString(), const QVariantMap &extraVariables = QVariantMap())
bool showOptionsDialog(Core::Id page, QWidget *parent = nullptr)
bool showWarningWithOptions(const QString &title, const QString &text, const QString &details = QString(), Core::Id settingsId = Id(), QWidget *parent = nullptr)
QStatusBar *statusBar()
QString systemInformation()
void updateAdditionalContexts(const Core::Context &remove, const Core::Context &add, Core::ICore::ContextPriority priority = ContextPriority::Low)
QString userInterfaceLanguage()
QString userResourcePath()
QString versionString()

Detailed Description

The ICore class allows access to the different parts that make up the basic functionality of Qt Creator.

You should never create a subclass of this interface. The one and only instance is created by the Core plugin. You can access this instance from your plugin through instance().

Member Type Documentation

enum ICore::ContextPriority

enum ICore::OpenFilesFlags

enum ICore::SaveSettingsReason

Member Function Documentation

[static] void ICore::addAdditionalContext(const Core::Context &context, Core::ICore::ContextPriority priority = ContextPriority::Low)

Adds context with priority.

[static] void ICore::addContextObject(Core::IContext *context)

After registration, this context object automatically becomes the current context object, context, whenever its widget gets focus.

See also removeContextObject(), updateAdditionalContexts(), and currentContextObject().

[static] void ICore::addPreCloseListener(const std::function<bool ()> &listener)

Provides a hook for plugins to veto on closing the application.

When the application window requests a close, all listeners are called. If one of the listener calls returns false, the process is aborted and the event is ignored. If all calls return true, coreAboutToClose() is emitted and the event is accepted or performed.

[static] QStringList ICore::additionalAboutInformation()

[static] void ICore::appendAboutInformation(const QString &line)

[static] QString ICore::buildCompatibilityString()

[static] QString ICore::cacheResourcePath()

[static] QString ICore::clangExecutable(const QString &clangBinDirectory)

[static] QString ICore::clangIncludeDirectory(const QString &clangVersion, const QString &clangResourceDirectory)

[static] QString ICore::clangTidyExecutable(const QString &clangBinDirectory)

[static] QString ICore::clazyStandaloneExecutable(const QString &clangBinDirectory)

[signal] void ICore::contextAboutToChange(const QList<Core::IContext *> &context)

[signal] void ICore::contextChanged(const Core::Context &context)

[static] Core::IContext *ICore::contextObject(QWidget *widget)

[signal] void ICore::coreAboutToClose()

[signal] void ICore::coreAboutToOpen()

[signal] void ICore::coreOpened()

[static] Core::IContext *ICore::currentContextObject()

Returns the context object of the current main context.

See also updateAdditionalContexts() and addContextObject().

[static] QWidget *ICore::currentContextWidget()

[static] QWidget *ICore::dialogParent()

Returns a widget pointer suitable to use as parent for QDialogs.

[static] Core::InfoBar *ICore::infoBar()

[static] QString ICore::installerResourcePath()

[static] Core::ICore *ICore::instance()

[static] bool ICore::isNewItemDialogRunning()

[static] QString ICore::libexecPath()

Returns the path to the command line tools that are shipped with Qt Creator (corresponding to the IDE_LIBEXEC_PATH qmake variable).

[static] QMainWindow *ICore::mainWindow()

Returns the main window of the application.

For dialog parents use dialogParent().

[static] QString ICore::msgShowOptionsDialog()

[static] QString ICore::msgShowOptionsDialogToolTip()

[static] QWidget *ICore::newItemDialog()

[signal] void ICore::newItemDialogStateChanged()

[static] void ICore::openFiles(const QStringList &arguments, Core::ICore::OpenFilesFlags flags = None)

Opens files using arguments and flags like it would be done if they were given to Qt Creator on the command line, or they were opened via File > Open.

[static] QPrinter *ICore::printer()

Returns the application's printer object.

Always use this printer object for printing, so the different parts of the application re-use its settings.

[static] void ICore::raiseWindow(QWidget *widget)

[static] void ICore::registerWindow(QWidget *window, const Core::Context &context)

[static] void ICore::removeAdditionalContext(const Core::Context &context)

[static] void ICore::removeContextObject(Core::IContext *context)

Unregisters a context object from the list of know contexts.

See also addContextObject(), updateAdditionalContexts(), and currentContextObject().

[static] QString ICore::resourcePath()

Returns the absolute path that is used for resources like project templates and the debugger macros.

This abstraction is needed to avoid platform-specific code all over the place, since on macOS, for example, the resources are part of the application bundle.

[static] void ICore::restart()

[static slot] void ICore::saveSettings(Core::ICore::SaveSettingsReason reason)

[signal] void ICore::saveSettingsRequested(Core::ICore::SaveSettingsReason reason)

[static] QSettings *ICore::settings(QSettings::Scope scope = QSettings::UserScope)

Returns the application's main settings object.

You can use it to retrieve or set application-wide settings (in contrast to session or project specific settings).

If scope is QSettings::UserScope (the default), the settings will be read from the user's settings, with a fallback to global settings provided with Qt Creator.

If scope is QSettings::SystemScope, only the system settings shipped with the current version of Qt Creator will be read. This functionality exists for internal purposes only.

See also settingsDatabase().

[static] Core::SettingsDatabase *ICore::settingsDatabase()

Returns the application's settings database.

The settings database is meant as an alternative to the regular settings object. It is more suitable for storing large amounts of data. The settings are application wide.

See also SettingsDatabase.

[static] void ICore::setupScreenShooter(const QString &name, QWidget *w, const QRect &rc = QRect())

[static] void ICore::showNewItemDialog(const QString &title, const QList<Core::IWizardFactory *> &factories, const QString &defaultLocation = QString(), const QVariantMap &extraVariables = QVariantMap())

Opens a dialog where the user can choose from a set of factories that create new files or projects.

The title argument is shown as the dialog title. The path where the files will be created (if the user does not change it) is set in defaultLocation. Defaults to DocumentManager::projectsDirectory() or DocumentManager::fileDialogLastVisitedDirectory(), depending on wizard kind.

Additional variables for the wizards are set in extraVariables.

See also Core::DocumentManager.

[static] bool ICore::showOptionsDialog(Core::Id page, QWidget *parent = nullptr)

[static] bool ICore::showWarningWithOptions(const QString &title, const QString &text, const QString &details = QString(), Core::Id settingsId = Id(), QWidget *parent = nullptr)

Creates a message box with parent that contains a Settings button for opening the settings page specified by settingsId.

The dialog has title and displays the message text and detailed information specified by details.

Use this function to display configuration errors and to point users to the setting they should fix.

Returns true if the user accepted the settings dialog.

[static] QStatusBar *ICore::statusBar()

[static] QString ICore::systemInformation()

[static] void ICore::updateAdditionalContexts(const Core::Context &remove, const Core::Context &add, Core::ICore::ContextPriority priority = ContextPriority::Low)

Changes the currently active additional contexts.

Removes the list of additional contexts specified by remove and adds the list of additional contexts specified by add with priority.

[static] QString ICore::userInterfaceLanguage()

[static] QString ICore::userResourcePath()

Returns the absolute path in the users directory that is used for resources like project templates.

Use this function for finding the place for resources that the user may write to, for example, to allow for custom palettes or templates.

[static] QString ICore::versionString()