Ignition Gui

API Reference

0.1.0
ignition::gui Namespace Reference

Namespaces

 plugins
 

Classes

class  BoolWidget
 A widget which holds a boolean property. More...
 
class  CollapsibleWidget
 A widget consisting of a button and some content. The content is hidden or shown as the button is toggled. It inherits from property widget, but it doesn't hold a property value. More...
 
class  ColorWidget
 A widget which holds a color property. More...
 
class  Dialog
 Gui plugin. More...
 
class  Dock
 Gui plugin. More...
 
class  DragDropModel
 Customized item model so that we can pass along an URI query as MIME information during a drag-drop. More...
 
class  EditableLabel
 Editable Label. The widget toggles between a QLabel and QLineEdit to support edits to the label text. More...
 
class  EnumWidget
 A widget which holds an enum property, which consists of a list of possible string values. More...
 
class  GeometryWidget
 A widget which holds a geometry property based on an ignition::msgs::Geometry message. More...
 
class  MainWindow
 
class  MessageWidget
 Generate a widget with property fields based on a Google Protobuf message. More...
 
class  NumberWidget
 A widget which holds a number property such as a double, int or uint. More...
 
class  Plugin
 Gui plugin. More...
 
class  Pose3dWidget
 A widget which holds a pose 3d property. More...
 
class  PropertyWidget
 Abstract base class for widgets which hold properties, such as numbers and strings. Each derived class specializes in a property type. The value of any derived widget can be retrieved as a QVariant. More...
 
class  SearchModel
 Customize the proxy model to display search results. More...
 
class  StringWidget
 A widget which holds a string property (std::string). More...
 
class  VariablePill
 A pill-shaped label which can be dragged onto other widgets. More...
 
class  VariablePillContainer
 A container for holding variable pills. More...
 
class  Vector3dWidget
 A widget which holds a vector 3d property. More...
 
struct  WindowConfig
 Holds configurations related to a MainWindow. More...
 

Enumerations

enum  DataRole { DISPLAY_NAME = Qt::UserRole + 100, URI_QUERY, TYPE, TO_EXPAND }
 Data roles. More...
 
enum  FileType { CSVFile, PDFFile }
 File types. More...
 
enum  NumberType { NONE, DOUBLE, INT, UINT }
 Number types. More...
 
enum  StringType { NONE, LINE, PLAIN_TEXT }
 String types. More...
 

Functions

void addPluginPath (const std::string &_path)
 Add an path to look for plugins. More...
 
bool addPluginsToWindow ()
 Add previously loaded plugins to the main window. More...
 
bool applyConfig ()
 Apply previously loaded config to the main window. More...
 
QColor convert (const math::Color &_color)
 Return the equivalent qt color. More...
 
math::Color convert (const QColor &_color)
 Return the equivalent ignition color. More...
 
QPointF convert (const math::Vector2d &_pt)
 Return the equivalent QPointF. More...
 
math::Vector2d convert (const QPointF &_pt)
 Return the equivalent ignition vector. More...
 
QVector3D convert (const math::Vector3d &_vec)
 Return the equivalent qt vector 3d. More...
 
math::Vector3d convert (const QVector3D &_vec)
 Return the equivalent ignition vector 3d. More...
 
common::MouseEvent convert (const QMouseEvent &_e)
 Return the equivalent ignition mouse event. More...
 
common::Time convert (const msgs::Time &_t)
 Convert an ignition::msgs::Time to an ignition::common::Time. More...
 
msgs::Time convert (const common::Time &_t)
 Convert an ignition::common::Time to an ignition::msgs::Time. More...
 
bool createMainWindow ()
 Run previously loaded plugins on a single main window. An empty window will be created if no plugins have been loaded. More...
 
std::string defaultConfigPath ()
 Get the location of the default configuration file. More...
 
std::vector< Dialog * > dialogs ()
 Get the dialogs, if they have been generated. More...
 
template<class T >
findFirstByProperty (const QList< T > _list, const char *_key, QVariant _value)
 Returns the first element on a QList which matches the given property. More...
 
std::vector< std::pair< std::string, std::vector< std::string > > > getPluginList ()
 Get the list of available plugins, organized by path. The paths are given in the following order: More...
 
std::string humanReadable (const std::string &_key)
 Create a human readable key, capitalizing the first letter and removing characters like "_". More...
 
bool initApp ()
 Initialize the application. This must be run before everything else. More...
 
void listPlugins ()
 Print the available plugins, organized by path. More...
 
bool loadConfig (const std::string &_config)
 Load plugins from a configuration file. More...
 
bool loadDefaultConfig ()
 Load the configuration from the default config file. More...
 
bool loadPlugin (const std::string &_filename, const tinyxml2::XMLElement *_pluginElem=nullptr)
 Load a plugin from a file name. The plugin file must be in the path. More...
 
MainWindowmainWindow ()
 Get the main window, if one has been generated. Use this to customize the window before running it. More...
 
void rangeFromKey (const std::string &_key, double &_min, double &_max)
 Returns the range for a given key. For example, the key "transparency" returns min == 0, max == 1. More...
 
bool runConfig (const std::string &_config)
 Run a main window using the given configuration file. This is the main entry point for the command line tool "ign gui -c". More...
 
bool runDialogs ()
 Run previously loaded plugins as individual dialogs. This has no effect if no plugins have been loaded. More...
 
bool runEmptyWindow ()
 Run an empty window. More...
 
bool runMainWindow ()
 Run previously created window. More...
 
bool runStandalone (const std::string &_filename)
 Run a given plugin as a standalone window. This is the main entry point for the command line tool "ign gui -s". More...
 
void setDefaultConfigPath (const std::string &_path)
 Specifies the location of the default configuration file. This is the file that stores the user settings when pressing "Save configuration". More...
 
void setPluginPathEnv (const std::string &_env)
 Set the environment variable which defines the paths to look for plugins. More...
 
bool setStyleFromFile (const std::string &_qssFile)
 Set the global style sheet from a file. More...
 
bool setStyleFromString (const std::string &_styleSheet)
 Set the global style sheet from a string. More...
 
void setVerbosity (const unsigned int _verbosity)
 Set the verbosity level (from 0 to 4). More...
 
bool stop ()
 Stop the graphical interface. More...
 
StringType stringTypeFromKey (const std::string &_key)
 Returns the string type for a given key. For example, the key "innerxml" has a PLAIN_TEXT type while "name" is a LINE. More...
 
std::string uniqueFilePath (const std::string &_pathAndName, const std::string &_extension)
 Generates a path for a file which doesn't collide with existing files, by appending numbers to it (i.e. (0), (1), ...) More...
 
std::string unitFromKey (const std::string &_key, const std::string &_type="")
 Returns the unit for a given key. For example, the key "mass" returns "kg". More...
 

Enumeration Type Documentation

◆ DataRole

enum DataRole

Data roles.

Enumerator
DISPLAY_NAME 

Text which is displayed for the user.

URI_QUERY 

URI including detailed query. This is the information carried during a drag-drop operation.

TYPE 

Data type name, such as "Double" or "Bool", or "model", "link". Used to specialize display according to type.

TO_EXPAND 

Flag indicating whether an item should be expanded or not.

◆ FileType

enum FileType

File types.

Enumerator
CSVFile 

Comma separated value (CSV)

PDFFile 

Portable document format (PDF)

◆ NumberType

enum NumberType
strong

Number types.

Enumerator
NONE 

Undefined type.

DOUBLE 

Double.

INT 

Integer.

UINT 

Unsigned integer.

◆ StringType

enum StringType
strong

String types.

Enumerator
NONE 

Undefined type.

LINE 

Use line for short strings which usually fit in a single line.

PLAIN_TEXT 

Use text for longer strings which span multiple lines.

Function Documentation

◆ addPluginPath()

void ignition::gui::addPluginPath ( const std::string _path)

Add an path to look for plugins.

Parameters
[in]_pathFull path.

◆ addPluginsToWindow()

bool ignition::gui::addPluginsToWindow ( )

Add previously loaded plugins to the main window.

  • Make sure the window is created first
  • Be sure to call loadPlugin() for each plugin first
  • Plugins previously added must be loaded again
    Returns
    True if successful

◆ applyConfig()

bool ignition::gui::applyConfig ( )

Apply previously loaded config to the main window.

  • Make sure the window is created first
  • Be sure to call loadConfig() for each plugin first
    Returns
    True if successful

◆ convert() [1/9]

QColor ignition::gui::convert ( const math::Color _color)

Return the equivalent qt color.

Parameters
[in]_colorIgnition color to convert
Returns
Qt color value

◆ convert() [2/9]

math::Color ignition::gui::convert ( const QColor _color)

Return the equivalent ignition color.

Parameters
[in]_colorQt color to convert
Returns
Ignition color value

◆ convert() [3/9]

QPointF ignition::gui::convert ( const math::Vector2d _pt)

Return the equivalent QPointF.

Parameters
[in]_ptIgnition vector to convert.
Returns
QPointF.

◆ convert() [4/9]

math::Vector2d ignition::gui::convert ( const QPointF _pt)

Return the equivalent ignition vector.

Parameters
[in]_ptQPointF to convert
Returns
Ignition Vector2d.

◆ convert() [5/9]

QVector3D ignition::gui::convert ( const math::Vector3d _vec)

Return the equivalent qt vector 3d.

Parameters
[in]_vecIgnition vector 3d to convert.
Returns
Qt vector 3d value.

◆ convert() [6/9]

math::Vector3d ignition::gui::convert ( const QVector3D _vec)

Return the equivalent ignition vector 3d.

Parameters
[in]_vecQt vector 3d to convert.
Returns
Ignition vector 3d value

◆ convert() [7/9]

common::MouseEvent ignition::gui::convert ( const QMouseEvent _e)

Return the equivalent ignition mouse event.

Note that there isn't a 1-1 mapping between these types, so fields such as common::MouseEvent::PressPos need to be set afterwards.

Parameters
[in]_eQt mouse event
Returns
Ignition mouse event

◆ convert() [8/9]

common::Time ignition::gui::convert ( const msgs::Time &  _t)

Convert an ignition::msgs::Time to an ignition::common::Time.

Parameters
[in]_tThe time to convert
Returns
An ignition::common::Time object

◆ convert() [9/9]

msgs::Time ignition::gui::convert ( const common::Time &  _t)

Convert an ignition::common::Time to an ignition::msgs::Time.

Parameters
[in]_tThe time to convert
Returns
An ignition::msgs::Time object

◆ createMainWindow()

bool ignition::gui::createMainWindow ( )

Run previously loaded plugins on a single main window. An empty window will be created if no plugins have been loaded.

Returns
True if successful

◆ defaultConfigPath()

std::string ignition::gui::defaultConfigPath ( )

Get the location of the default configuration file.

Returns
The default configuration path.
See also
loadDefaultConfig
setDefaultConfigPath

◆ dialogs()

std::vector<Dialog *> ignition::gui::dialogs ( )

Get the dialogs, if they have been generated.

◆ findFirstByProperty()

T ignition::gui::findFirstByProperty ( const QList< T >  _list,
const char *  _key,
QVariant  _value 
)

Returns the first element on a QList which matches the given property.

Parameters
[in]_listThe list to search through.
[in]_keyThe property key value.
[in]_valueThe property value.
Returns
The first matching element.

◆ getPluginList()

std::vector<std::pair<std::string, std::vector<std::string> > > ignition::gui::getPluginList ( )

Get the list of available plugins, organized by path. The paths are given in the following order:

  1. Paths given by the environment variable
  2. Paths added by calling addPluginPath
  3. Path ~/.ignition/gui/plugins
  4. The path where Ignition GUI plugins are installed
Returns
A vector of pairs, where each pair contains:
  • A path
  • A vector of plugins in that path

◆ humanReadable()

std::string ignition::gui::humanReadable ( const std::string _key)

Create a human readable key, capitalizing the first letter and removing characters like "_".

Parameters
[in]_keyNon-human-readable key.
Returns
Human-readable key.

◆ initApp()

bool ignition::gui::initApp ( )

Initialize the application. This must be run before everything else.

Returns
True on success.

◆ listPlugins()

void ignition::gui::listPlugins ( )

Print the available plugins, organized by path.

◆ loadConfig()

bool ignition::gui::loadConfig ( const std::string _config)

Load plugins from a configuration file.

Parameters
[in]_configPath to configuration file.
Returns
True if successful

◆ loadDefaultConfig()

bool ignition::gui::loadDefaultConfig ( )

Load the configuration from the default config file.

Returns
True if successful
See also
setDefaultConfigPath
defaultConfigPath

◆ loadPlugin()

bool ignition::gui::loadPlugin ( const std::string _filename,
const tinyxml2::XMLElement *  _pluginElem = nullptr 
)

Load a plugin from a file name. The plugin file must be in the path.

Parameters
[in]_filenamePlugin filename.
[in]_pluginElemElement containing plugin configuration
Returns
True if successful

◆ mainWindow()

MainWindow* ignition::gui::mainWindow ( )

Get the main window, if one has been generated. Use this to customize the window before running it.

◆ rangeFromKey()

void ignition::gui::rangeFromKey ( const std::string _key,
double &  _min,
double &  _max 
)

Returns the range for a given key. For example, the key "transparency" returns min == 0, max == 1.

Parameters
[in]_keyThe key.
[out]_minThe minimum value.
[out]_maxThe maximum value.

◆ runConfig()

bool ignition::gui::runConfig ( const std::string _config)

Run a main window using the given configuration file. This is the main entry point for the command line tool "ign gui -c".

Parameters
[in]_configFull path to configuration file.
Returns
True if successful

◆ runDialogs()

bool ignition::gui::runDialogs ( )

Run previously loaded plugins as individual dialogs. This has no effect if no plugins have been loaded.

Returns
True if successful

◆ runEmptyWindow()

bool ignition::gui::runEmptyWindow ( )

Run an empty window.

Returns
True if successful

◆ runMainWindow()

bool ignition::gui::runMainWindow ( )

Run previously created window.

Returns
True if successful

◆ runStandalone()

bool ignition::gui::runStandalone ( const std::string _filename)

Run a given plugin as a standalone window. This is the main entry point for the command line tool "ign gui -s".

Parameters
[in]_filenamePlugin file name. The file must be in the path.
Returns
True if successful

◆ setDefaultConfigPath()

void ignition::gui::setDefaultConfigPath ( const std::string _path)

Specifies the location of the default configuration file. This is the file that stores the user settings when pressing "Save configuration".

Parameters
[in]_pathThe default configuration full path including filename.
See also
loadDefaultConfig
defaultConfigPath

◆ setPluginPathEnv()

void ignition::gui::setPluginPathEnv ( const std::string _env)

Set the environment variable which defines the paths to look for plugins.

Parameters
[in]_envName of environment variable.

◆ setStyleFromFile()

bool ignition::gui::setStyleFromFile ( const std::string _qssFile)

Set the global style sheet from a file.

Parameters
[in]_qssFilePath to QSS file. Use :/style.qss for Ignition GUI's default style sheet.
See also
setStyleFromString

◆ setStyleFromString()

bool ignition::gui::setStyleFromString ( const std::string _styleSheet)

Set the global style sheet from a string.

Parameters
[in]_styleSheetStyle sheet in QSS format. Pass an empty string to use Qt's default style.
Returns
True if successful.
See also
setStyleFromFile

◆ setVerbosity()

void ignition::gui::setVerbosity ( const unsigned int  _verbosity)

Set the verbosity level (from 0 to 4).

◆ stop()

bool ignition::gui::stop ( )

Stop the graphical interface.

Returns
True if successful

◆ stringTypeFromKey()

StringType ignition::gui::stringTypeFromKey ( const std::string _key)

Returns the string type for a given key. For example, the key "innerxml" has a PLAIN_TEXT type while "name" is a LINE.

Parameters
[in]_keyThe key.
Returns
The string type.

◆ uniqueFilePath()

std::string ignition::gui::uniqueFilePath ( const std::string _pathAndName,
const std::string _extension 
)

Generates a path for a file which doesn't collide with existing files, by appending numbers to it (i.e. (0), (1), ...)

Parameters
[in]_pathAndNameFull absolute path and file name up to the file extension.
[in]_extensionFile extension, such as "pdf".
Returns
Full path, with name and extension, which doesn't collide with existing files

◆ unitFromKey()

std::string ignition::gui::unitFromKey ( const std::string _key,
const std::string _type = "" 
)

Returns the unit for a given key. For example, the key "mass" returns "kg".

Parameters
[in]_keyThe key.
[in]_typeIn case the key may have more than one type, the type must be given too. For example, a prismatic joint will have different units from a revolute joint.
Returns
The unit.