Gazebo Gui

API Reference

8.3.0
gz::gui Namespace Reference

Namespaces

 plugins
 Namespace for all plugins.
 

Classes

class  Application
 A Gazebo GUI application loads a QML engine and provides an API to load plugins and configuration files. The application supports either running a single main window or several plugins as standalone dialogs. More...
 
class  Dialog
 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  GridConfig
 Manages grids in a Gazebo Rendering scene. This plugin can be used for: More...
 
class  KeyPublisher
 Publish keyboard stokes to "keyboard/keypress" topic. More...
 
class  MainWindow
 The main window class creates a QQuickWindow and acts as an interface which provides properties and functions which can be called from Main.qml. More...
 
class  PlotData
 Plot Data containter to hold value and registered charts Can be a Field or a PlotComponent Used by PlottingInterface and Gazebo Plotting. More...
 
class  PlottingInterface
 Plotting Interface Responsible for plotting transport msgs-fields Used by TransportPlotting Plugin & GazeboPlotting Plugin Accepts dragged items from TopicViewer Plugin & ComponentInspector Plugin. More...
 
class  Plugin
 Base class for Gazebo GUI plugins. More...
 
class  SearchModel
 Customize the proxy model to display search results. More...
 
class  TapeMeasure
 Provides buttons for the tape measure tool. More...
 
class  Topic
 Plotting Topic to handle published topics & their registered fields. More...
 
class  Transport
 Handle transport topics subscribing for one object (Chart) More...
 
struct  WindowConfig
 Holds configurations related to a MainWindow. More...
 
class  WorldControlEventListener
 Helper class for testing listening to events emitted by the WorldControl plugin. This is used for testing the event behavior of the WorldControl plugin. More...
 

Enumerations

enum  DataRole { DISPLAY_NAME = Qt::UserRole + 100 , URI_QUERY , TYPE , TO_EXPAND }
 Data roles. More...
 
enum class  ExitAction { CLOSE_GUI , SHUTDOWN_SERVER }
 The action executed when GUI is closed without prompt. More...
 
enum  FileType { CSVFile , PDFFile }
 File types. More...
 
enum class  NumberType { NONE , DOUBLE , INT , UINT }
 Number types. More...
 
enum class  StringType { NONE , LINE , PLAIN_TEXT }
 String types. More...
 
enum class  WindowType : int { kMainWindow = 0 , kDialog = 1 }
 Type of window which the application will display. More...
 

Functions

ApplicationApp ()
 Get current running application, this is a cast of qGuiApp. More...
 
QColor convert (const math::Color &_color)
 Return the equivalent Qt color. More...
 
QPointF convert (const math::Vector2d &_pt)
 Return the equivalent QPointF. More...
 
QVector3D convert (const math::Vector3d &_vec)
 Return the equivalent Qt vector 3d. More...
 
math::Color convert (const QColor &_color)
 Return the equivalent Gazebo color. More...
 
common::KeyEvent convert (const QKeyEvent &_e)
 Return the equivalent Gazebo key event. More...
 
common::MouseEvent convert (const QMouseEvent &_e)
 Return the equivalent Gazebo mouse event. More...
 
math::Vector2d convert (const QPointF &_pt)
 Return the equivalent Gazebo vector. More...
 
math::Vector3d convert (const QVector3D &_vec)
 Return the equivalent Gazebo vector 3d. More...
 
common::MouseEvent convert (const QWheelEvent &_e)
 Return the equivalent Gazebo mouse event. 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::string getInstallPrefix ()
 getInstallPrefix return the install prefix of the library i.e. CMAKE_INSTALL_PREFIX unless the library has been moved More...
 
std::string getPluginInstallDir ()
 getPluginInstallDir return the install directory of the plugins More...
 
std::string humanReadable (const std::string &_key)
 Create a human readable key, capitalizing the first letter and removing characters like "_". More...
 
const QString qmlQrcImportPath ()
 Import path for gz-gui QML modules added to the Qt resource system. This helper function returns the QRC resource path where custom Gazebo QML modules can be imported from. To import a Gazebo QML module, add this path to the QML engine's import path list before attempting to load a QML file that imports Gazebo QML modules. 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...
 
std::string renderEngineBackendApiName ()
 Just like renderEngineName(), but valid entries are: More...
 
std::string renderEngineName ()
 The main window's "renderEngine" property may be filled with a string of the render engine gui name. This information can be used by plugins to set the GUI render engine This helper function provides a handy access to the render engine GUI name. 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...
 
QStringList worldNames ()
 The main window's "worldNames" property may be filled with a list of the names of all worlds currently loaded. This information can be used by plugins to choose which world to work with. This helper function provides a handy access to the world names list. 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.

◆ ExitAction

enum ExitAction
strong

The action executed when GUI is closed without prompt.

Enumerator
CLOSE_GUI 

Close GUI and leave server running.

SHUTDOWN_SERVER 

Close GUI and shutdown server.

◆ 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.

◆ WindowType

enum WindowType : int
strong

Type of window which the application will display.

Enumerator
kMainWindow 

A main window, which may contain top-level menus and multiple plugins.

kDialog 

One independent dialog per plugin. Also useful to open a startup dialog before the main window.

Function Documentation

◆ App()

Application* gz::gui::App ( )

Get current running application, this is a cast of qGuiApp.

Returns
Pointer to running application, or nullptr if none is running.

◆ convert() [1/9]

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

Return the equivalent Qt color.

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

◆ convert() [2/9]

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

Return the equivalent QPointF.

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

◆ convert() [3/9]

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

Return the equivalent Qt vector 3d.

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

◆ convert() [4/9]

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

Return the equivalent Gazebo color.

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

◆ convert() [5/9]

common::KeyEvent gz::gui::convert ( const QKeyEvent _e)

Return the equivalent Gazebo key event.

Parameters
[in]_eQt key event
Returns
Gazebo key event

◆ convert() [6/9]

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

Return the equivalent Gazebo 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
Gazebo mouse event

◆ convert() [7/9]

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

Return the equivalent Gazebo vector.

Parameters
[in]_ptQPointF to convert
Returns
Gazebo Vector2d.

◆ convert() [8/9]

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

Return the equivalent Gazebo vector 3d.

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

◆ convert() [9/9]

common::MouseEvent gz::gui::convert ( const QWheelEvent _e)

Return the equivalent Gazebo mouse event.

Note that there isn't a 1-1 mapping between these types.

Parameters
[in]_eQt wheel event
Returns
Gazebo mouse event

◆ findFirstByProperty()

T gz::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.

◆ getInstallPrefix()

std::string gz::gui::getInstallPrefix ( )

getInstallPrefix return the install prefix of the library i.e. CMAKE_INSTALL_PREFIX unless the library has been moved

◆ getPluginInstallDir()

std::string gz::gui::getPluginInstallDir ( )

getPluginInstallDir return the install directory of the plugins

◆ humanReadable()

std::string gz::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.

◆ qmlQrcImportPath()

const QString gz::gui::qmlQrcImportPath ( )

Import path for gz-gui QML modules added to the Qt resource system. This helper function returns the QRC resource path where custom Gazebo QML modules can be imported from. To import a Gazebo QML module, add this path to the QML engine's import path list before attempting to load a QML file that imports Gazebo QML modules.

Returns
Resousrce path prefix as a string

◆ rangeFromKey()

void gz::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.

◆ renderEngineBackendApiName()

std::string gz::gui::renderEngineBackendApiName ( )

Just like renderEngineName(), but valid entries are:

  • opengl (default)
  • metal (Apple only)
  • vulkan
    Returns
    Name of API backend used on the GUI, as stored in the MainWindow's "renderEngineBackendApiName" property.

◆ renderEngineName()

std::string gz::gui::renderEngineName ( )

The main window's "renderEngine" property may be filled with a string of the render engine gui name. This information can be used by plugins to set the GUI render engine This helper function provides a handy access to the render engine GUI name.

Returns
Name of render engine used on the GUI, as stored in the MainWindow's "renderEngine" property.

◆ stringTypeFromKey()

StringType gz::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 gz::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 gz::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.

◆ worldNames()

QStringList gz::gui::worldNames ( )

The main window's "worldNames" property may be filled with a list of the names of all worlds currently loaded. This information can be used by plugins to choose which world to work with. This helper function provides a handy access to the world names list.

Returns
List of world names, as stored in the MainWindow's "worldNames" property.