cumbia-qtcontrols 1.x
Qt widgets on top of the cumbia C++ library
Public Member Functions | List of all members
CuPluginLoader Class Reference

Helper class that loads Qt plugins searching in the default cumbia plugin path and in directories listed in a proper environment variable. More...

#include <cupluginloader.h>

Public Member Functions

 CuPluginLoader ()
 
QStringList getPluginAbsoluteFilePaths (const QString &default_plugin_path, const QRegExp &match=QRegExp(".*"))
 get a list of the absolute file paths of the plugins which name matches the regular expression match. More...
 
QString getPluginAbsoluteFilePath (const QString &default_plugin_path, const QString &name)
 get the absolute file path of the plugin with name name. More...
 
QString getPluginPath () const
 CuPluginLoader::getPluginPath returns the plugin path from the CUMBIA_PLUGIN_PATH environment variable. More...
 
QString getDefaultPluginPath () const
 
template<class T >
T * get (const QString &name, QObject **plugin_as_qobject, const QString &default_plugin_path=QString())
 

Detailed Description

Helper class that loads Qt plugins searching in the default cumbia plugin path and in directories listed in a proper environment variable.

Plugins can be loaded from a default cumbia plugin library directory which is defined in the cumbia-qtcontrols.pri file and passed to the compiler with a -D option. The name is:

Plugins are searched also in one of the colon separated list of directories exported through the CUMBIA_PLUGIN_PATH environment variable.

Constructor & Destructor Documentation

◆ CuPluginLoader()

CuPluginLoader::CuPluginLoader ( )

Member Function Documentation

◆ get()

template<class T >
T * CuPluginLoader::get ( const QString &  name,
QObject **  plugin_as_qobject,
const QString &  default_plugin_path = QString() 
)
inline

◆ getDefaultPluginPath()

QString CuPluginLoader::getDefaultPluginPath ( ) const

◆ getPluginAbsoluteFilePath()

QString CuPluginLoader::getPluginAbsoluteFilePath ( const QString &  default_plugin_path,
const QString &  name 
)

get the absolute file path of the plugin with name name.

Returns
the absolute file path of the plugin with the given name, an empty string otherwise
Parameters
default_plugin_paththe default cumbia plugin installation directory (CUMBIA_QTCONTROLS_PLUGIN_DIR)
namethe exact name of the desired plugin, for example "libactions-extension-plugin.so" or "libcumbia-dbus-plugin.so"
Note
Plugin search gives priority to folders listed in the CUMBIA_QTCONTROLS_PLUGIN_DIR environment variable. default_plugin_path folder is searched last.
See also
getPluginAbsoluteFilePaths

References getPluginAbsoluteFilePaths().

Referenced by get().

◆ getPluginAbsoluteFilePaths()

QStringList CuPluginLoader::getPluginAbsoluteFilePaths ( const QString &  default_plugin_path,
const QRegExp &  match = QRegExp(".*") 
)

get a list of the absolute file paths of the plugins which name matches the regular expression match.

Returns
a list of the absolute file paths of the plugins matching the given match, or an empty list if no plugin file name matches the given pattern
Parameters
default_plugin_paththe default cumbia plugin installation directory (e.g. CUMBIA_QTCONTROLS_PLUGIN_DIR). If empty, the default plugin path is set to CUMBIA_QTCONTROLS_PLUGIN_DIR, defined in cumbia-qtcontrols.pri
matcha regular expression to match the desired plugin name. For example the ".*context-menu-actions\.so" can be used to find all the plugins extending the contextual menu of a cumbia-qtcontrols widget.
Note
Plugin search gives priority to folders listed in the CUMBIA_PLUGIN_PATH environment variable. default_plugin_path folder is searched last.
See also
getPluginAbsoluteFilePath

Referenced by QuXtraWidgetPluginLoader::getPlugin(), getPluginAbsoluteFilePath(), and CuContextMenu::prepare().

◆ getPluginPath()

QString CuPluginLoader::getPluginPath ( ) const

CuPluginLoader::getPluginPath returns the plugin path from the CUMBIA_PLUGIN_PATH environment variable.

Returns
the plugin path set with the environment variable CUMBIA_PLUGIN_PATH or an empty string if the variable is unset

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