Quantum GIS API Documentation
1.7.5-Wroclaw
|
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc. More...
#include <qgsapplication.h>
Public Types | |
enum | ENDIAN { XDR = 0, NDR = 1 } |
constants for endian-ness More... | |
typedef enum QgsApplication::ENDIAN | endian_t |
constants for endian-ness More... | |
Public Member Functions | |
QgsApplication (int &argc, char **argv, bool GUIenabled, QString customConfigPath=QString()) | |
virtual | ~QgsApplication () |
virtual bool | event (QEvent *event) |
Watch for QFileOpenEvent. More... | |
virtual bool | notify (QObject *receiver, QEvent *event) |
Catch exceptions when sending event to receiver. More... | |
Static Public Member Functions | |
static void | setFileOpenEventReceiver (QObject *receiver) |
Set the FileOpen event receiver. More... | |
static void | setThemeName (const QString theThemeName) |
Set the active theme to the specified theme. More... | |
static const QString | themeName () |
Set the active theme to the specified theme. More... | |
static const QString | authorsFilePath () |
Returns the path to the authors file. More... | |
static const QString | contributorsFilePath () |
Returns the path to the contributors file. More... | |
static const QString | sponsorsFilePath () |
Returns the path to the sponsors file. More... | |
static const QString | donorsFilePath () |
Returns the path to the donors file. More... | |
static const QString | translatorsFilePath () |
Returns the path to the sponsors file. More... | |
static const QString | developerPath () |
Returns the path to the developer image directory. More... | |
static const QString | helpAppPath () |
Returns the path to the help application. More... | |
static const QString | i18nPath () |
Returns the path to the translation directory. More... | |
static const QString | qgisMasterDbFilePath () |
Returns the path to the master qgis.db file. More... | |
static const QString | qgisSettingsDirPath () |
Returns the path to the settings directory in user's home dir. More... | |
static const QString | qgisUserDbFilePath () |
Returns the path to the user qgis.db file. More... | |
static const QString | splashPath () |
Returns the path to the splash screen image directory. More... | |
static const QString | iconsPath () |
Returns the path to the icons image directory. More... | |
static const QString | srsDbFilePath () |
Returns the path to the srs.db file. More... | |
static const QStringList | svgPaths () |
Returns the pathes to svg directories. More... | |
static Q_DECL_DEPRECATED const QString | svgPath () |
Returns the paths to svg applications svg directory. More... | |
static const QString | prefixPath () |
Returns the path to the application prefix directory. More... | |
static const QString | pluginPath () |
Returns the path to the application plugin directory. More... | |
static const QString | pkgDataPath () |
Returns the common root path of all application data directories. More... | |
static const QString | activeThemePath () |
Returns the path to the currently active theme directory. More... | |
static const QString | defaultThemePath () |
Returns the path to the default theme directory. More... | |
static QString | iconPath (QString iconFile) |
Returns path to the desired icon file. More... | |
static const QString | userStyleV2Path () |
Returns the path to user's style. Added in QGIS 1.4. More... | |
static const QString | defaultStyleV2Path () |
Returns the path to default style (works as a starting point). Added in QGIS 1.4. More... | |
static void | setPrefixPath (const QString thePrefixPath, bool useDefaultPaths=false) |
Alters prefix path - used by 3rd party apps. More... | |
static void | setPluginPath (const QString thePluginPath) |
Alters plugin path - used by 3rd party apps. More... | |
static void | setPkgDataPath (const QString thePkgDataPath) |
Alters pkg data path - used by 3rd party apps. More... | |
static void | setDefaultSvgPaths (const QStringList &pathList) |
Alters default svg paths - used by 3rd party apps. Added in QGIS 1.5. More... | |
static void | initQgis () |
loads providers More... | |
static void | exitQgis () |
deletes provider registry and map layer registry More... | |
static endian_t | endian () |
Returns whether this machine uses big or little endian. More... | |
static QString | reportStyleSheet () |
get a standard css style sheet for reports. More... | |
static QString | showSettings () |
Convenience function to get a summary of the paths used in this application instance useful for debugging mainly. More... | |
static void | registerOgrDrivers () |
Register OGR drivers ensuring this only happens once. More... | |
static QString | absolutePathToRelativePath (QString apath, QString targetPath) |
Converts absolute path to path relative to target. More... | |
static QString | relativePathToAbsolutePath (QString rpath, QString targetPath) |
Converts path relative to target to an absolute path. More... | |
Static Private Member Functions | |
static QObject * | ABISYM (mFileOpenEventReceiver) |
static QStringList | ABISYM (mFileOpenEventList) |
static QString | ABISYM (mPrefixPath) |
static QString | ABISYM (mPluginPath) |
static QString | ABISYM (mPkgDataPath) |
static QString | ABISYM (mThemeName) |
static QStringList | ABISYM (mDefaultSvgPaths) |
static QString | ABISYM (mConfigPath) |
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.
The QgsApplication class manages application-wide information.
This is a subclass of QApplication and should be instantiated in place of QApplication. Most methods are static in keeping witn the design of QApplication.
This class hides platform-specific path information and provides a portable way of referencing specific files and directories. Ideally, hard-coded paths should appear only here and not in other modules so that platform-conditional code is minimized and paths are easier to change due to centralization.
Definition at line 30 of file qgsapplication.h.
typedef enum QgsApplication::ENDIAN QgsApplication::endian_t |
constants for endian-ness
QgsApplication::QgsApplication | ( | int & | argc, |
char ** | argv, | ||
bool | GUIenabled, | ||
QString | customConfigPath = QString() |
||
) |
Definition at line 60 of file qgsapplication.cpp.
References ABISYM(), qgisSettingsDirPath(), and setPrefixPath().
|
virtual |
Definition at line 80 of file qgsapplication.cpp.
|
staticprivate |
Referenced by activeThemePath(), authorsFilePath(), contributorsFilePath(), defaultStyleV2Path(), developerPath(), donorsFilePath(), event(), i18nPath(), iconsPath(), pkgDataPath(), pluginPath(), prefixPath(), qgisMasterDbFilePath(), qgisSettingsDirPath(), QgsApplication(), setDefaultSvgPaths(), setFileOpenEventReceiver(), setPkgDataPath(), setPluginPath(), setPrefixPath(), setThemeName(), showSettings(), splashPath(), sponsorsFilePath(), srsDbFilePath(), svgPath(), svgPaths(), themeName(), and translatorsFilePath().
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
static |
Converts absolute path to path relative to target.
Definition at line 517 of file qgsapplication.cpp.
|
static |
Returns the path to the currently active theme directory.
Definition at line 203 of file qgsapplication.cpp.
References ABISYM().
Referenced by QgsComposerItem::drawSelectionBoxes(), iconPath(), QgsRasterLayer::legendAsPixmap(), QgsProjectionSelector::loadCrsList(), QgsProjectionSelector::loadUserCrsList(), QgsComposerSymbolItem::readXML(), and showSettings().
|
static |
Returns the path to the authors file.
Definition at line 246 of file qgsapplication.cpp.
References ABISYM().
|
static |
Returns the path to the contributors file.
Contributors are people who have submitted patches but don't have svn write access.
Definition at line 253 of file qgsapplication.cpp.
References ABISYM().
|
static |
Returns the path to default style (works as a starting point). Added in QGIS 1.4.
Definition at line 390 of file qgsapplication.cpp.
References ABISYM().
Referenced by QgsStyleV2::defaultStyle().
|
static |
Returns the path to the default theme directory.
Definition at line 199 of file qgsapplication.cpp.
Referenced by QgsComposerItem::drawSelectionBoxes(), iconPath(), and showSettings().
|
static |
Returns the path to the developer image directory.
Definition at line 284 of file qgsapplication.cpp.
References ABISYM().
|
static |
Returns the path to the donors file.
Definition at line 268 of file qgsapplication.cpp.
References ABISYM().
|
static |
Returns whether this machine uses big or little endian.
Definition at line 395 of file qgsapplication.cpp.
Referenced by QgsGeometry::convertToMultiType(), and QgsGeometry::exportGeosToWkb().
|
virtual |
Watch for QFileOpenEvent.
Definition at line 84 of file qgsapplication.cpp.
|
static |
deletes provider registry and map layer registry
Definition at line 409 of file qgsapplication.cpp.
References QgsMapLayerRegistry::instance(), and QgsProviderRegistry::instance().
|
static |
Returns the path to the help application.
Definition at line 292 of file qgsapplication.cpp.
References prefixPath().
Referenced by QgsContextHelp::start().
|
static |
Returns the path to the translation directory.
Definition at line 306 of file qgsapplication.cpp.
References ABISYM().
|
static |
Returns path to the desired icon file.
First it tries to use the active theme path, then default theme path
Definition at line 209 of file qgsapplication.cpp.
References activeThemePath(), and defaultThemePath().
|
static |
Returns the path to the icons image directory.
Definition at line 346 of file qgsapplication.cpp.
References ABISYM().
|
static |
loads providers
Definition at line 400 of file qgsapplication.cpp.
References QgsMapLayerRegistry::instance(), QgsProviderRegistry::instance(), and pluginPath().
|
virtual |
Catch exceptions when sending event to receiver.
Definition at line 112 of file qgsapplication.cpp.
References QgsException::what().
Referenced by event().
|
static |
Returns the common root path of all application data directories.
Definition at line 195 of file qgsapplication.cpp.
References ABISYM().
Referenced by QgsMapLayer::loadNamedStyle().
|
static |
Returns the path to the application plugin directory.
Definition at line 191 of file qgsapplication.cpp.
References ABISYM().
Referenced by initQgis().
|
static |
Returns the path to the application prefix directory.
Definition at line 187 of file qgsapplication.cpp.
References ABISYM().
Referenced by helpAppPath().
|
static |
Returns the path to the master qgis.db file.
Definition at line 314 of file qgsapplication.cpp.
References ABISYM().
Referenced by showSettings().
|
static |
Returns the path to the settings directory in user's home dir.
Returns the path to the settings directory in user's home dir
Definition at line 322 of file qgsapplication.cpp.
References ABISYM().
Referenced by QgsMapLayer::loadNamedStyle(), qgisUserDbFilePath(), QgsApplication(), QgsMapLayer::saveNamedStyle(), and userStyleV2Path().
|
static |
Returns the path to the user qgis.db file.
Definition at line 330 of file qgsapplication.cpp.
References qgisSettingsDirPath().
Referenced by QgsCoordinateReferenceSystem::createFromSrsId(), QgsCoordinateReferenceSystem::findMatchingProj(), QgsProjectionSelector::getLargestCRSIDMatch(), QgsCoordinateReferenceSystem::getRecord(), QgsCoordinateReferenceSystem::getRecordCount(), QgsProjectionSelector::getSelectedExpression(), QgsProjectionSelector::loadUserCrsList(), QgsProjectionSelector::on_pbnFind_clicked(), QgsCoordinateReferenceSystem::proj4FromSrsId(), QgsCoordinateReferenceSystem::saveAsUserCRS(), and QgsProjectionSelector::selectedProj4String().
|
static |
Register OGR drivers ensuring this only happens once.
This is a workaround for an issue with older gdal versions that caused duplicate driver name entries to appear in the list of registered drivers when QgsApplication::registerOgrDrivers was called multiple times.
Definition at line 509 of file qgsapplication.cpp.
Referenced by QgsVectorFileWriter::ogrDriverList(), QgsVectorFileWriter::QgsVectorFileWriter(), and QgsVectorFileWriter::supportedFiltersAndFormats().
|
static |
Converts path relative to target to an absolute path.
Definition at line 580 of file qgsapplication.cpp.
|
static |
get a standard css style sheet for reports.
Typically you will use this method by doing: QString myStyle = QgsApplication::reportStyleSheet(); textBrowserReport->document()->setDefaultStyleSheet(myStyle);
Definition at line 437 of file qgsapplication.cpp.
|
static |
Alters default svg paths - used by 3rd party apps. Added in QGIS 1.5.
Definition at line 182 of file qgsapplication.cpp.
References ABISYM().
|
static |
Set the FileOpen event receiver.
Definition at line 135 of file qgsapplication.cpp.
References ABISYM().
|
static |
Alters pkg data path - used by 3rd party apps.
Definition at line 173 of file qgsapplication.cpp.
References ABISYM(), and svgPath().
Referenced by setPrefixPath().
|
static |
Alters plugin path - used by 3rd party apps.
Definition at line 168 of file qgsapplication.cpp.
References ABISYM().
Referenced by setPrefixPath().
|
static |
Alters prefix path - used by 3rd party apps.
Definition at line 152 of file qgsapplication.cpp.
References ABISYM(), setPkgDataPath(), and setPluginPath().
Referenced by QgsApplication().
|
static |
Set the active theme to the specified theme.
The theme name should be a single word e.g. 'default','classic'. The theme search path usually will be pkgDataPath + "/themes/" + themName + "/" but plugin writers etc can use themeName() as a basis for searching for resources in their own datastores e.g. a Qt4 resource bundle.
Set the theme path to the specified theme.
Definition at line 223 of file qgsapplication.cpp.
References ABISYM().
|
static |
Convenience function to get a summary of the paths used in this application instance useful for debugging mainly.
Definition at line 415 of file qgsapplication.cpp.
References ABISYM(), activeThemePath(), defaultThemePath(), qgisMasterDbFilePath(), svgPaths(), and themeName().
|
static |
Returns the path to the splash screen image directory.
Definition at line 338 of file qgsapplication.cpp.
References ABISYM().
|
static |
Returns the path to the sponsors file.
Definition at line 260 of file qgsapplication.cpp.
References ABISYM().
|
static |
Returns the path to the srs.db file.
Definition at line 353 of file qgsapplication.cpp.
References ABISYM().
Referenced by QgsCoordinateReferenceSystem::createFromOgcWmsCrs(), QgsCoordinateReferenceSystem::createFromSrid(), QgsCoordinateReferenceSystem::createFromSrsId(), QgsCoordinateReferenceSystem::findMatchingProj(), QgsCoordinateReferenceSystem::getRecord(), QgsCoordinateReferenceSystem::proj4FromSrsId(), QgsProjectionSelector::QgsProjectionSelector(), and QgsDistanceArea::setEllipsoid().
|
static |
Returns the paths to svg applications svg directory.
Returns the path to the applications svg directories.
Definition at line 380 of file qgsapplication.cpp.
References ABISYM().
Referenced by setPkgDataPath().
|
static |
Returns the pathes to svg directories.
Returns the paths to the svg directories.
Definition at line 361 of file qgsapplication.cpp.
References ABISYM().
Referenced by QgsSvgMarkerSymbolLayerV2::listSvgFiles(), QgsMarkerCatalogue::refreshList(), QgsSymbol::setNamedPointSymbol(), showSettings(), QgsSvgMarkerSymbolLayerV2::symbolNameToPath(), QgsSvgMarkerSymbolLayerV2::symbolPathToName(), and QgsSymbol::writeXML().
|
static |
Set the active theme to the specified theme.
The theme name should be a single word e.g. 'default','classic'. The theme search path usually will be pkgDataPath + "/themes/" + themName + "/" but plugin writers etc can use this method as a basis for searching for resources in their own datastores e.g. a Qt4 resource bundle.
Get the active theme name
Definition at line 239 of file qgsapplication.cpp.
References ABISYM().
Referenced by showSettings().
|
static |
Returns the path to the sponsors file.
Returns the path to the sponsors file.
Definition at line 277 of file qgsapplication.cpp.
References ABISYM().
|
static |
Returns the path to user's style. Added in QGIS 1.4.
Definition at line 385 of file qgsapplication.cpp.
References qgisSettingsDirPath().
Referenced by QgsStyleV2::defaultStyle().