FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
qtcore::PluginsLoader Class Reference

Provides run-time loading of Qt-based plugins located into search paths. More...

#include <qttools/core/plugins_loader.h>

Public Types

typedef
PluginsLoader_InstanceFilter 
InstanceFilter
 

Public Member Functions

 PluginsLoader ()
 
 ~PluginsLoader ()
 
bool autoDeletePlugins () const
 Is auto-deletion of plugins enabled ? More...
 
void setAutoDeletePlugins (bool on)
 
void addPath (const QString &path)
 Appends path to the plugins path list. More...
 
void removePath (const QString &path)
 Removes path from the list of plugin paths. More...
 
QStringList paths () const
 Returns the paths used when loading plugins at run-time (with loadPlugins()) More...
 
void setPaths (const QStringList &paths)
 Sets the list of directories to search when loading plugins to paths. More...
 
QStringList fileNameFilters () const
 Returns the list set with setFileNameFilters() More...
 
void setFileNameFilters (const QStringList &nameFilters)
 Sets the name filters used by loadPlugins() More...
 
void loadPlugins (InstanceFilter *filter, QStringList *errors=NULL)
 
void loadPlugins (const QList< InstanceFilter * > &filters, QStringList *errors=NULL)
 Loads plugins, any error is reported in errors. More...
 
void discardPlugin (QObject *plugin)
 Removes a previously loaded plugin object. More...
 
QString pluginFileName (const QObject *plugin) const
 
QVector< QObject * > plugins () const
 Returns all loaded plugin root components. More...
 
template<typename INTERFACE >
QVector< INTERFACE * > castPlugins () const
 

Detailed Description

Provides run-time loading of Qt-based plugins located into search paths.

Member Typedef Documentation

Constructor & Destructor Documentation

qtcore::PluginsLoader::PluginsLoader ( )
qtcore::PluginsLoader::~PluginsLoader ( )

Member Function Documentation

void qtcore::PluginsLoader::addPath ( const QString &  path)

Appends path to the plugins path list.

If path is empty or already in the path list, the path list is not changed.

bool qtcore::PluginsLoader::autoDeletePlugins ( ) const

Is auto-deletion of plugins enabled ?

If plugins auto-deletion is enabled, PluginsLoader will automatically delete plugins on destruction of this object.

Note
autoDeletePlugins() is enabled by default.
See also
setAutoDeletePlugins()
template<typename INTERFACE >
QVector< INTERFACE * > qtcore::PluginsLoader::castPlugins ( ) const

Returns all loaded plugin root components casted (with qobject_cast<>) to INTERFACE*

Template Parameters
INTERFACEInterface type used with qobject_cast<>

NULL plugins are not added to the result vector

void qtcore::PluginsLoader::discardPlugin ( QObject *  plugin)

Removes a previously loaded plugin object.

QStringList qtcore::PluginsLoader::fileNameFilters ( ) const

Returns the list set with setFileNameFilters()

void qtcore::PluginsLoader::loadPlugins ( InstanceFilter filter,
QStringList *  errors = NULL 
)
void qtcore::PluginsLoader::loadPlugins ( const QList< InstanceFilter * > &  filters,
QStringList *  errors = NULL 
)

Loads plugins, any error is reported in errors.

QStringList qtcore::PluginsLoader::paths ( ) const

Returns the paths used when loading plugins at run-time (with loadPlugins())

See also
addPath() setPaths()
QString qtcore::PluginsLoader::pluginFileName ( const QObject *  plugin) const

Returns file name of a loaded plugin object (e.g. libmy_plugin.so, other_plugin.dll, ...)

plugin must have been successfully loaded with loadPlugins()

QVector< QObject * > qtcore::PluginsLoader::plugins ( ) const

Returns all loaded plugin root components.

void qtcore::PluginsLoader::removePath ( const QString &  path)

Removes path from the list of plugin paths.

void qtcore::PluginsLoader::setAutoDeletePlugins ( bool  on)

Enables plugins auto-deletion if on is true; otherwise auto-deletion is disabled

See also
autoDeletePlugins()
void qtcore::PluginsLoader::setFileNameFilters ( const QStringList &  nameFilters)

Sets the name filters used by loadPlugins()

Each name filter is a wildcard (globbing) filter that understands * and ? wildcards.

See also
QDir::setNameFilters()
void qtcore::PluginsLoader::setPaths ( const QStringList &  paths)

Sets the list of directories to search when loading plugins to paths.

All existing paths will be deleted and the path list will consist of the paths given in paths.

See also
addPath(), removePath(), paths()

The documentation for this class was generated from the following files: