All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Slots | Signals | Public Member Functions | Static Public Member Functions
Qtilities::CoreGui::QtilitiesApplication Class Reference

The QtilitiesApplication class is the same as QApplication with added functionality. More...

#include <QtilitiesApplication.h>

List of all members.

Public Slots

static QWidget * aboutQtilities (bool show=true)
 Returns a Qtilities::CoreGui::AboutWindow with information about the Qtilities libraries.

Signals

void settingsUpdateRequest (const QString &request_id)
 Signal which broadcasts that settings identified by the request_id changed and requires updating.

Public Member Functions

VersionNumber qtilitiesVersion ()
 Returns the version number of Qtilities.

Static Public Member Functions

static IActionManageractionManager ()
 Returns a reference to the action manager.
static bool applicationBusy ()
 Gets if the application is busy, thus it cannot be closed.
static quint32 applicationExportVersion ()
 Gets the application export format for your application.
static QString applicationSessionPath ()
 Returns a session path for your application where you can store session related information.
static IClipboardclipboardManager ()
 Returns a reference to the clipboard manager.
static QWidget * configWidget ()
 Gets the configuration widget reference for the application.
static IContextManagercontextManager ()
 Returns a reference to the context manager.
static bool hasInstance (const char *function, bool silent=false)
 Checks if a valid instance has been created.
static HelpManagerhelpManager ()
 Returns a reference to the help manager.
static void initialize ()
 Initializes the QtilitiesApplication object.
static QtilitiesApplicationinstance (bool silent=false)
 Returns a reference to the QtilitiesApplication instance.
static QWidget * mainWindow ()
 Gets the main window reference for the application.
static void newSettingsUpdateRequest (const QString &request_id)
 Create a new settings update request.
static IObjectManagerobjectManager ()
 Returns a reference to the object manager.
static QString qtilitiesVersionString ()
 Returns the version string of Qtilities as a QString.
static void setApplicationBusy (bool is_busy)
 Sets if the application is busy, thus it cannot be closed.
static void setApplicationExportVersion (quint32 application_export_version)
 Sets the application export format for your application.
static void setApplicationSessionPath (const QString &path)
 Sets the session path to be used in your application.
static void setConfigWidget (QWidget *configWidget)
 Sets the configuration widget reference for the application.
static void setMainWindow (QWidget *mainWindow)
 Sets the main window reference for the application.

Detailed Description

The QtilitiesApplication class is the same as QApplication with added functionality.

The QtilitiesApplication class is an extension of QApplication and should be used when building Qtilities applications. For example:

QtilitiesApplication a(argc, argv);
QtilitiesApplication::setOrganizationName("Jaco Naudé");
QtilitiesApplication::setOrganizationDomain("Qtilities");
QtilitiesApplication::setApplicationName("Example");
QtilitiesApplication::setApplicationVersion(QtilitiesApplication::qtilitiesVersionString());

If you for some reason don't want to use the QtilitiesApplication as shown above, you must call the initialize() function instead in your application's main function.

This class provides extra functionality which is not found in QApplication:

All functions on QtilitiesApplication are thread safe.

See also:
Qtilities::Core::QtilitiesCoreApplication

Member Function Documentation

Qtilities::CoreGui::Interfaces::IActionManager * Qtilities::CoreGui::QtilitiesApplication::actionManager ( )
static

Returns a reference to the action manager.

If you are using the action manager, you must specify a main window using setMainWindow() for the action manager to work correctly.

This function is thread-safe.

quint32 Qtilities::CoreGui::QtilitiesApplication::applicationExportVersion ( )
static

Gets the application export format for your application.

Default is 0.

See also:
Qtilities::Core::IExportable::applicationExportVersion(), setApplicationExportVersion()
QString Qtilities::CoreGui::QtilitiesApplication::applicationSessionPath ( )
static

Returns a session path for your application where you can store session related information.

Throughout Qtilities session information is saved to this session path. The information that is saved includes:

For more information about the way Qtilities saves session information see Configuration settings storage in Qtilities.

By default this is QDesktopServices::storageLocation(DataLocation).

Note:
In non-GUI applications, QDesktopServices is not available and the default session path is different for that reason. See Qtilities::Core::QtilitiesCoreApplication::applicationSessionPath() for more information.
See also:
setApplicationSessionPath()
Qtilities::CoreGui::Interfaces::IClipboard * Qtilities::CoreGui::QtilitiesApplication::clipboardManager ( )
static

Returns a reference to the clipboard manager.

This function is thread-safe.

Qtilities::Core::Interfaces::IContextManager * Qtilities::CoreGui::QtilitiesApplication::contextManager ( )
static

Returns a reference to the context manager.

This function is thread-safe.

bool Qtilities::CoreGui::QtilitiesApplication::hasInstance ( const char *  function,
bool  silent = false 
)
static

Checks if a valid instance has been created.

Parameters:
silentWhen true, a warning message will not be printed when the QtilitiesCoreApplication instance was not found.
Qtilities::CoreGui::HelpManager * Qtilities::CoreGui::QtilitiesApplication::helpManager ( )
static

Returns a reference to the help manager.

This function is thread-safe.

void Qtilities::CoreGui::QtilitiesApplication::initialize ( )
static

Initializes the QtilitiesApplication object.

Normally the QtilitiesApplication object will be initialized automatically in the application's main function as follows:

QtilitiesApplication a(argc, argv);

If it however not possible to use QtilitiesApplication as show above it should be initialized directly after the above set of statements, as follows:

QApplication a(argc, argv);
QApplication::setOrganizationName("My Organization");
QApplication::setApplicationName("My Application");

Example scenarios where this might happen is when you are using a different class which inherits QApplication, for example the QtSingleApplication solution.

It is important to note that the initialize() function does not create an QtilitiesApplication instance, thus instance() will return 0. The goal of the function used in this way is to register all needed Qtilities classes in the Qtilities factory.

Note:
Make sure to set your application name and organization name before calling this function as shown in the second example above.
Qtilities::CoreGui::QtilitiesApplication * Qtilities::CoreGui::QtilitiesApplication::instance ( bool  silent = false)
static

Returns a reference to the QtilitiesApplication instance.

Parameters:
silentWhen true, a warning message will not be printed when the QtilitiesCoreApplication instance was not found.
static void Qtilities::CoreGui::QtilitiesApplication::newSettingsUpdateRequest ( const QString &  request_id)
inlinestatic

Create a new settings update request.

This function allows settings update requests to be sent anywhere in an application. This allows objects which depend on specific settings to update themselves when these settings change.

This function will emit settingsUpdateRequest() with the given request_id.

Qtilities::Core::Interfaces::IObjectManager * Qtilities::CoreGui::QtilitiesApplication::objectManager ( )
static

Returns a reference to the object manager.

This function is thread-safe.

QString Qtilities::CoreGui::QtilitiesApplication::qtilitiesVersionString ( )
static

Returns the version string of Qtilities as a QString.

Returns:
The version of Qtilities, for example: 0.1 Beta 1. Note that the v is not part of the returned string.
void Qtilities::CoreGui::QtilitiesApplication::setApplicationBusy ( bool  is_busy)
static

Sets if the application is busy, thus it cannot be closed.

This function uses a stacked approach, thus your setApplicationBusy(false) calls must match the number of setApplicationBusy(true) calls. For more information on this type of stacked approach, see Qtilities::Core::Observer::startProcessingCycle().

If you use Qtilities::CoreGui::QtilitiesMainWindow as your main window, it will automatically block close events when you application is busy and present the user with a message box saying that the application is busy.

This function is thread-safe.

void Qtilities::CoreGui::QtilitiesApplication::setApplicationExportVersion ( quint32  application_export_version)
static

Sets the application export format for your application.

See also:
Qtilities::Core::IExportable::applicationExportVersion(), applicationExportVersion()
void Qtilities::CoreGui::QtilitiesApplication::setApplicationSessionPath ( const QString &  path)
static

Sets the session path to be used in your application.

Note:
This function will automatically update the session path used by the Logger as well by calling Qtilities::Logging::Logger::setLoggerSessionConfigPath().
See also:
applicationSessionPath()


Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé