- Extending Qt Creator Manual
- Utils Namespace
- Extending Qt Creator Manual 21.0.0-beta1

# Utils Namespace

The Utils namespace contains a collection of utility classes and functions for use by all plugins. More...

Header: | `#include <Utils>`

## Namespaces

namespace | FileUtils
namespace | Internal
namespace | MathUtils
namespace | SettingsDatabase

## Classes

class | GuardedObject
class | Result
class | TreeModel
class | TypedAspect

## Types

enum | FindFlag { FindBackward, FindCaseSensitively, FindWholeWords, FindRegularExpression, FindPreserveCase, DontFindBinaryFiles }
enum class | ProgressIndicatorSize { Small, Medium, Large }
enum | ResultSpecialErrorCode { ResultAssert, ResultUnimplemented }

## Variables

Utils::Q_DECL_IMPORT | QString

## Functions

Utils::Q_DECL_IMPORT | addToolTipsToMenu(QMenu *menu)
Utils::Q_DECL_IMPORT | triggerShutdownGuard()

## Detailed Description

## Namespaces

### namespace Utils::FileUtils

### namespace Utils::Internal

### namespace Utils::MathUtils

### namespace Utils::SettingsDatabase

The settings database is SQLite based, and lazily retrieves data when it is asked for. It also does incremental updates of the database rather than rewriting the whole file each time one of the settings change.

The SettingsDatabase API mimics that of QSettings.

See also settings().

## Classes

### class GuardedObject

The GuardedObject class owns a heap-allocated object and deletes it when the shutdown guard is destroyed. More...

### class Result

Result<T> is used for returning either a success value or an error string from a function. More...

### class TreeModel

The TreeModel class is a convienience base class for models to use in a QTreeView. More...

### class TypedAspect

The `TypedAspect` class is a helper class for implementing a simple aspect. More...

## Type Documentation

### enum Utils::FindFlag

This enum holds the find flags.

Constant | Value | Description
--- | --- | ---
`Utils::FindBackward` | `0x01` | Searches backwards.
`Utils::FindCaseSensitively` | `0x02` | Considers case when searching.
`Utils::FindWholeWords` | `0x04` | Finds only whole words.
`Utils::FindRegularExpression` | `0x08` | Uses a regular epression as a search term.
`Utils::FindPreserveCase` | `0x10` | Preserves the case when replacing search terms.
`Utils::DontFindBinaryFiles` | `0x20` | Does not include binary files in search results.

### enum class Utils::ProgressIndicatorSize

Size of a progress indicator.

Constant | Value | Description
--- | --- | ---
`Utils::ProgressIndicatorSize::Small` | `0` | Small icon size. Useful for tool bars, status bars, rows in tree views, and so on.
`Utils::ProgressIndicatorSize::Medium` | `1` | Larger progress indicator useful for covering whole medium sized widgets.
`Utils::ProgressIndicatorSize::Large` | `2` | Very large progress indicator that can be used to cover large parts of a UI.

See also Utils::ProgressIndicator and Utils::ProgressIndicatorPainter.

### enum Utils::ResultSpecialErrorCode

The ResultSpecialErrorCode enum is used with the Utils::ResultError class to provide a set of standardized error messages.

Constant | Value | Description
--- | --- | ---
`Utils::ResultAssert` | `0` | An internal error that indicates that preconditions are violated.
`Utils::ResultUnimplemented` | `1` | A backend unexpectedly did not provide an implementation of this functionality.

See also Utils::ResultError.

## Variable Documentation

### Utils::Q_DECL_IMPORT Utils::QString

Returns a copy of string that has ch characters removed from the start and the end.

## Function Documentation

### Utils::Q_DECL_IMPORT Utils::addToolTipsToMenu(QMenu *menu)

Adds tool tips to the menu that show the action's tool tip when hovering over an entry.

### Utils::Q_DECL_IMPORT Utils::triggerShutdownGuard()

Destroys the shutdown guard object and consequently all objects guarded by it.

In a normal run of the application this function is called automatically at the appropriate time.