Gazebo Gui

API Reference

3.12.0
ignition::gui Namespace Reference

Namespaces

 events
 Namespace for all events.
 
 plugins
 

Classes

class  Application
 An 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  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  Plugin
 Base class for Gazebo GUI plugins. More...
 
class  SearchModel
 Customize the proxy model to display search results. 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  ExitAction { CLOSE_GUI, SHUTDOWN_SERVER }
 The action executed when GUI is closed without prompt. 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...
 
enum  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...
 
msgs::Time convert (const common::Time &_t)
 Convert an gz::common::Time to an gz::msgs::Time. 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...
 
common::Time convert (const msgs::Time &_t)
 Convert an gz::msgs::Time to an gz::common::Time. More...
 
math::Color convert (const QColor &_color)
 Return the equivalent gazebo color. 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...
 
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 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...
 
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* ignition::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]

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

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

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

◆ convert() [2/9]

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

Return the equivalent qt color.

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

◆ convert() [3/9]

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

Return the equivalent QPointF.

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

◆ convert() [4/9]

QVector3D ignition::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() [5/9]

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

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

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

◆ convert() [6/9]

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

Return the equivalent gazebo color.

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

◆ convert() [7/9]

common::MouseEvent ignition::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() [8/9]

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

Return the equivalent gazebo vector.

Parameters
[in]_ptQPointF to convert
Returns
Gazebo Vector2d.

◆ convert() [9/9]

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

Return the equivalent gazebo vector 3d.

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

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

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

◆ qmlQrcImportPath()

const QString ignition::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 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.

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

◆ worldNames()

QStringList ignition::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.