ICore Class | Extending Qt Creator Manual

Extending Qt Creator Manual | ICore

Extending Qt Creator Manual 4.6.0

# 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>

- List of all members, including inherited members

## Public Types

enum | ContextPriority { High, Low }
enum | OpenFilesFlags { None, SwitchMode, CanContainLineAndColumnNumbers, StopOnLoadFail }

## Public Slots

void | saveSettings()

## Signals

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

## Static Public Members

void | addAdditionalContext(const Context &context, ContextPriority priority = ContextPriority::Low)
void | addContextObject(IContext *context)
void | addPreCloseListener(const std::function<bool() > &listener)
QStringList | additionalAboutInformation()
void | appendAboutInformation(const QString &line)
QString | buildCompatibilityString()
IContext * | currentContextObject()
QWidget * | currentContextWidget()
QWidget * | dialogParent()
QString | documentationPath()
QString | installerResourcePath()
ICore * | instance()
bool | isNewItemDialogRunning()
QString | libexecPath()
QMainWindow * | mainWindow()
QString | msgShowOptionsDialog()
QString | msgShowOptionsDialogToolTip()
QWidget * | newItemDialog()
void | openFiles(const QStringList &fileNames, OpenFilesFlags flags = None)
QPrinter * | printer()
void | raiseWindow(QWidget *widget)
void | registerWindow(QWidget *window, const Context &context)
void | removeAdditionalContext(const Context &context)
void | removeContextObject(IContext *context)
QString | resourcePath()
QSettings * | settings(QSettings::Scope scope = QSettings::UserScope)
SettingsDatabase * | settingsDatabase()
void | setupScreenShooter(const QString &name, QWidget *w, const QRect &rc = QRect())
void | showNewItemDialog(const QString &title, const QList<IWizardFactory *> &factories, const QString &defaultLocation = QString(), const QVariantMap &extraVariables = QVariantMap())
bool | showOptionsDialog(Id page, QWidget *parent = 0)
bool | showWarningWithOptions(const QString &title, const QString &text, const QString &details = QString(), Id settingsId = Id(), QWidget *parent = 0)
QStatusBar * | statusBar()
QString | systemInformation()
void | updateAdditionalContexts(const Context &remove, const Context &add, 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 `Core::instance()`.

## Member Type Documentation

### enum ICore::ContextPriority

### enum ICore::OpenFilesFlags

## Member Function Documentation

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

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

Registers an additional context object.

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

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

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

### `[static]` QStringList ICore::additionalAboutInformation()

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

### `[static]` QString ICore::buildCompatibilityString()

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

Indicates that a new context will shortly become the current context (meaning that its widget got focus).

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

Indicates that a new context just became the current context. This includes the context from the focus object as well as the additional context.

### `[signal]` void ICore::coreAboutToClose()

Enables plugins to perform some pre-end-of-life actions.

The application is guaranteed to shut down after this signal is emitted. It is there as an addition to the usual plugin lifecycle functions, namely `IPlugin::aboutToShutdown()`, just for convenience.

### `[signal]` void ICore::coreAboutToOpen()

### `[signal]` void ICore::coreOpened()

Indicates that all plugins have been loaded and the main window is shown.

### `[static]` IContext *ICore::currentContextObject()

Returns the context object of the current main context.

See also ICore::updateAdditionalContexts() and ICore::addContextObject().

### `[static]` QWidget *ICore::currentContextWidget()

### `[static]` QWidget *ICore::dialogParent()

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

### `[static]` QString ICore::documentationPath()

### `[static]` QString ICore::installerResourcePath()

### `[static]` 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 application window.

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 &fileNames, OpenFilesFlags flags = None)

Opens all files from a list of fileNames like it would be done if they were given to Qt Creator on the command line, or they were opened via File > Open.

### `[signal]` void ICore::optionsDialogRequested()

Enables plugins to perform actions just before the Tools > Options dialog is shown.

### `[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 Context &context)

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

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

Unregisters a context object from the list of know contexts.

}

See also ICore::addContextObject(), ICore::updateAdditionalContexts(), and ICore::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 Mac OS X, for example, the resources are part of the application bundle.

### `[static slot]` void ICore::saveSettings()

### `[signal]` void ICore::saveSettingsRequested()

Signals that the user has requested that the global settings should be saved to disk.

At the moment that happens when the application is closed, and on Save All.

### `[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 users settings will be read from the users 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]` 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<IWizardFactory *> &factories, const QString &defaultLocation = QString(), const QVariantMap &extraVariables = QVariantMap())

### `[static]` bool ICore::showOptionsDialog(Id page, QWidget *parent = 0)

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

### `[static]` QStatusBar *ICore::statusBar()

### `[static]` QString ICore::systemInformation()

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

### `[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()