Gazebo Gui

API Reference

9.0.0

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

#include <Application.hh>

Public Slots

void OnPluginClose ()
 Callback when user requests to close a plugin.
 

Signals

void PluginAdded (const QString &_objectName)
 Notify that a plugin has been added.
 

Public Member Functions

 Application (int &_argc, char **_argv, const WindowType _type=WindowType::kMainWindow, const char *_renderEngineGuiApiBackend=nullptr)
 Constructor.
 
virtual ~Application ()
 Destructor.
 
void AddPluginPath (const std::string &_path)
 Add an path to look for plugins.
 
bool CreateMainWindow ()
 Create a main window. Just calls InitializeMainWindow.
 
std::string DefaultConfigPath () const
 Get the location of the default configuration file.
 
QQmlApplicationEngine * Engine () const
 Get the QML engine.
 
bool LoadConfig (const std::string &_path)
 Load a configuration file, which includes window configurations and plugins. This function doesn't instantiate the plugins, it just keeps them in memory and they can be applied later by either instantiating a window or several dialogs.
 
bool LoadDefaultConfig ()
 Load the configuration from the default config file.
 
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. If a window has been initialized, the plugin is added to the window. Otherwise, the plugin is stored and can be later added to a window or dialog.
 
bool LoadWindowConfig (const tinyxml2::XMLElement &_window)
 Load window configuration from XML element. This is the <window> element inside a gui config file.
 
std::shared_ptr< PluginPluginByName (const std::string &_pluginName) const
 Get a plugin by its unique name.
 
std::vector< std::pair< std::string, std::vector< std::string > > > PluginList ()
 Get the list of available plugins, organized by path. The paths are given in the following order:
 
bool RemovePlugin (const std::string &_pluginName)
 Remove plugin by name. The plugin is removed from the application and its shared library unloaded if this was its last instance.
 
std::string ResolveConfigFile (const std::string &_path) const
 Given an input config path, resolve its absolute path, potentially searching for it in locations specified by GZ_GUI_RESOURCE_PATH.
 
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".
 
void SetPluginPathEnv (const std::string &_env)
 Set the environment variable which defines the paths to look for plugins.
 
- Public Member Functions inherited from QApplication
 QApplication (Display *display, int &argc, char **argv, Qt::HANDLE visual, Qt::HANDLE colormap)
 
 QApplication (Display *display, Qt::HANDLE visual, Qt::HANDLE colormap)
 
 QApplication (int &argc, char **argv)
 
 QApplication (int &argc, char **argv, bool GUIenabled)
 
 QApplication (int &argc, char **argv, Type type)
 
 QApplication (QApplication::QS60MainApplicationFactory factory, int &argc, char **argv)
 
virtual ~QApplication ()
 
void aboutToReleaseGpuResources ()
 
void aboutToUseGpuResources ()
 
int autoMaximizeThreshold () const
 
bool autoSipEnabled () const
 
virtual void commitData (QSessionManager &manager)
 
void commitDataRequest (QSessionManager &manager)
 
void focusChanged (QWidget *old, QWidget *now)
 
void fontDatabaseChanged ()
 
QInputContextinputContext () const
 
bool isSessionRestored () const
 
void lastWindowClosed ()
 
virtual bool macEventFilter (EventHandlerCallRef caller, EventRef event)
 
virtual bool notify (QObject *receiver, QEvent *e)
 
virtual bool qwsEventFilter (QWSEvent *event)
 
void qwsSetCustomColors (QRgb *colorTable, int start, int numColors)
 
virtual void saveState (QSessionManager &manager)
 
void saveStateRequest (QSessionManager &manager)
 
QString sessionId () const
 
QString sessionKey () const
 
void setAutoMaximizeThreshold (const int threshold)
 
void setAutoSipEnabled (const bool enabled)
 
void setInputContext (QInputContext *inputContext)
 
void setStyleSheet (const QString &sheet)
 
QString styleSheet () const
 
virtual bool symbianEventFilter (const QSymbianEvent *event)
 
int symbianProcessEvent (const QSymbianEvent *event)
 
virtual bool x11EventFilter (XEvent *event)
 
int x11ProcessEvent (XEvent *event)
 
- Public Member Functions inherited from QCoreApplication
 QCoreApplication (int &argc, char **argv)
 
 ~QCoreApplication ()
 
void aboutToQuit ()
 
bool filterEvent (void *message, long *result)
 
void lock ()
 
bool locked ()
 
EventFilter setEventFilter (EventFilter filter)
 
bool tryLock ()
 
void unlock (bool wakeUpGui)
 
virtual bool winEventFilter (MSG *msg, long *result)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Additional Inherited Members

- Static Public Member Functions inherited from QApplication
void aboutQt ()
 
QWidgetactiveModalWidget ()
 
QWidgetactivePopupWidget ()
 
QWidgetactiveWindow ()
 
void alert (QWidget *widget, int msec)
 
QWidgetList allWidgets ()
 
void beep ()
 
void changeOverrideCursor (const QCursor &cursor)
 
QClipboardclipboard ()
 
void closeAllWindows ()
 
ColorMode colorMode ()
 
int colorSpec ()
 
int cursorFlashTime ()
 
QDesktopWidgetdesktop ()
 
bool desktopSettingsAware ()
 
int doubleClickInterval ()
 
int exec ()
 
void flushX ()
 
QWidgetfocusWidget ()
 
QFont font ()
 
QFont font (const char *className)
 
QFont font (const QWidget *widget)
 
QFontMetrics fontMetrics ()
 
QSize globalStrut ()
 
bool hasGlobalMouseTracking ()
 
Qt::Alignment horizontalAlignment (QFlags< Qt::AlignmentFlag > align)
 
bool isEffectEnabled (Qt::UIEffect effect)
 
bool isLeftToRight ()
 
bool isRightToLeft ()
 
Qt::LayoutDirection keyboardInputDirection ()
 
int keyboardInputInterval ()
 
QLocale keyboardInputLocale ()
 
Qt::KeyboardModifiers keyboardModifiers ()
 
bool keypadNavigationEnabled ()
 
Qt::LayoutDirection layoutDirection ()
 
Qt::MacintoshVersion macVersion ()
 
QWidgetmainWidget ()
 
Qt::MouseButtons mouseButtons ()
 
Qt::NavigationMode navigationMode ()
 
QCursoroverrideCursor ()
 
QPalette palette ()
 
QPalette palette (const char *className)
 
QPalette palette (const QWidget *widget)
 
Qt::KeyboardModifiers queryKeyboardModifiers ()
 
bool quitOnLastWindowClosed ()
 
QDecorationqwsDecoration ()
 
QDecorationqwsSetDecoration (const QString &decoration)
 
void qwsSetDecoration (QDecoration *decoration)
 
void restoreOverrideCursor ()
 
bool reverseLayout ()
 
void setActiveWindow (QWidget *active)
 
void setColorMode (ColorMode mode)
 
void setColorSpec (int spec)
 
void setCursorFlashTime (int)
 
void setDesktopSettingsAware (bool on)
 
void setDoubleClickInterval (int)
 
void setEffectEnabled (Qt::UIEffect effect, bool enable)
 
void setFont (const QFont &font, bool b, const char *className)
 
void setFont (const QFont &font, const char *className)
 
void setGlobalMouseTracking (bool dummy)
 
void setGlobalStrut (const QSize &)
 
void setGraphicsSystem (const QString &system)
 
void setKeyboardInputInterval (int)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setMainWidget (QWidget *mainWidget)
 
void setNavigationMode (Qt::NavigationMode mode)
 
void setOverrideCursor (const QCursor &cursor)
 
void setOverrideCursor (const QCursor &cursor, bool replace)
 
void setPalette (const QPalette &pal, bool b, const char *className)
 
void setPalette (const QPalette &palette, const char *className)
 
void setQuitOnLastWindowClosed (bool quit)
 
void setReverseLayout (bool reverse)
 
void setStartDragDistance (int l)
 
void setStartDragTime (int ms)
 
QStylesetStyle (const QString &style)
 
void setStyle (QStyle *style)
 
void setWheelScrollLines (int)
 
void setWindowIcon (const QIcon &icon)
 
void setWinStyleHighlightColor (const QColor &c)
 
int startDragDistance ()
 
int startDragTime ()
 
QStylestyle ()
 
void syncX ()
 
QWidgettopLevelAt (const QPoint &point)
 
QWidgettopLevelAt (int x, int y)
 
QWidgetList topLevelWidgets ()
 
Type type ()
 
int wheelScrollLines ()
 
QWidgetwidgetAt (const QPoint &point)
 
QWidgetwidgetAt (const QPoint &point, bool child)
 
QWidgetwidgetAt (int x, int y)
 
QWidgetwidgetAt (int x, int y, bool child)
 
QIcon windowIcon ()
 
const QColorwinStyleHighlightColor ()
 
Qt::WindowsVersion winVersion ()
 
- Static Public Member Functions inherited from QCoreApplication
void addLibraryPath (const QString &path)
 
QString applicationDirPath ()
 
QString applicationFilePath ()
 
QString applicationName ()
 
qint64 applicationPid ()
 
QString applicationVersion ()
 
int argc ()
 
QStringList arguments ()
 
char ** argv ()
 
bool closingDown ()
 
int enter_loop ()
 
int exec ()
 
void exit (int returnCode)
 
void exit_loop ()
 
void flush ()
 
bool hasPendingEvents ()
 
void installTranslator (QTranslator *translationFile)
 
QCoreApplicationinstance ()
 
QStringList libraryPaths ()
 
int loopLevel ()
 
QString organizationDomain ()
 
QString organizationName ()
 
void postEvent (QObject *receiver, QEvent *event)
 
void postEvent (QObject *receiver, QEvent *event, int priority)
 
void processEvents (QFlags< QEventLoop::ProcessEventsFlag > flags)
 
void processEvents (QFlags< QEventLoop::ProcessEventsFlag > flags, int maxtime)
 
void processOneEvent ()
 
void quit ()
 
void removeLibraryPath (const QString &path)
 
void removePostedEvents (QObject *receiver)
 
void removePostedEvents (QObject *receiver, int eventType)
 
void removeTranslator (QTranslator *translationFile)
 
bool sendEvent (QObject *receiver, QEvent *event)
 
void sendPostedEvents ()
 
void sendPostedEvents (QObject *receiver, int event_type)
 
void setApplicationName (const QString &application)
 
void setApplicationVersion (const QString &version)
 
void setAttribute (Qt::ApplicationAttribute attribute, bool on)
 
void setLibraryPaths (const QStringList &paths)
 
void setOrganizationDomain (const QString &orgDomain)
 
void setOrganizationName (const QString &orgName)
 
bool startingUp ()
 
bool testAttribute (Qt::ApplicationAttribute attribute)
 
QString translate (const char *context, const char *sourceText, const char *disambiguation, Encoding encoding)
 
QString translate (const char *context, const char *sourceText, const char *disambiguation, Encoding encoding, int n)
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QApplication
typedef ColorMode
 
typedef QS60MainApplicationFactory
 
- Public Attributes inherited from QCoreApplication
typedef EventFilter
 
- Protected Member Functions inherited from QApplication
virtual bool event (QEvent *e)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QApplication
 autoMaximizeThreshold
 
 autoSipEnabled
 
 cursorFlashTime
 
 doubleClickInterval
 
 globalStrut
 
 keyboardInputInterval
 
 layoutDirection
 
 quitOnLastWindowClosed
 
 startDragDistance
 
 startDragTime
 
 styleSheet
 
 wheelScrollLines
 
 windowIcon
 
- Properties inherited from QCoreApplication
 applicationName
 
 applicationVersion
 
 organizationDomain
 
 organizationName
 
- Properties inherited from QObject
 objectName
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Application()

Application ( int &  _argc,
char **  _argv,
const WindowType  _type = WindowType::kMainWindow,
const char *  _renderEngineGuiApiBackend = nullptr 
)

Constructor.

Parameters
[in]_argcArgument count.
[in]_argvArgument values.
[in]_typeWindow type, by default it's a main window.
[in]_renderEngineGuiApiBackend–render-engine-gui-api-backend option

◆ ~Application()

virtual ~Application ( )
virtual

Destructor.

Member Function Documentation

◆ AddPluginPath()

void AddPluginPath ( const std::string _path)

Add an path to look for plugins.

Parameters
[in]_pathFull path.

◆ CreateMainWindow()

bool CreateMainWindow ( )

Create a main window. Just calls InitializeMainWindow.

Returns
True if successful
See also
InitializeMainWindow

◆ DefaultConfigPath()

std::string DefaultConfigPath ( ) const

Get the location of the default configuration file.

Returns
The default configuration path.
See also
LoadDefaultConfig
SetDefaultConfigPath

◆ Engine()

QQmlApplicationEngine * Engine ( ) const

Get the QML engine.

Returns
Pointer to QML engine

◆ LoadConfig()

bool LoadConfig ( const std::string _path)

Load a configuration file, which includes window configurations and plugins. This function doesn't instantiate the plugins, it just keeps them in memory and they can be applied later by either instantiating a window or several dialogs.

Parameters
[in]_pathFull path to configuration file.
Returns
True if successful
See also
InitializeMainWindow
InitializeDialogs

◆ LoadDefaultConfig()

bool LoadDefaultConfig ( )

Load the configuration from the default config file.

Returns
True if successful
See also
SetDefaultConfigPath
DefaultConfigPath
LoadConfig

◆ LoadPlugin()

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. If a window has been initialized, the plugin is added to the window. Otherwise, the plugin is stored and can be later added to a window or dialog.

Parameters
[in]_filenamePlugin filename.
[in]_pluginElemElement containing plugin configuration
Returns
True if successful
See also
LoadConfig
AddPluginsToWindow

◆ LoadWindowConfig()

bool LoadWindowConfig ( const tinyxml2::XMLElement &  _window)

Load window configuration from XML element. This is the <window> element inside a gui config file.

Parameters
[in]_windowXML element that contains the window configuration
Returns
True if successful

◆ OnPluginClose

void OnPluginClose ( )
slot

Callback when user requests to close a plugin.

◆ PluginAdded

void PluginAdded ( const QString _objectName)
signal

Notify that a plugin has been added.

Parameters
[in]_objectNamePlugin's object name.

◆ PluginByName()

std::shared_ptr< Plugin > PluginByName ( const std::string _pluginName) const

Get a plugin by its unique name.

Parameters
[in]_pluginNamePlugn instance's unique name. This is the plugin card's object name.
Returns
Pointer to plugin object, null if not found.

◆ PluginList()

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 ~/.gz/gui/plugins
  4. The path where Gazebo GUI plugins are installed
Returns
A vector of pairs, where each pair contains:
  • A path
  • A vector of plugins in that path

◆ RemovePlugin()

bool RemovePlugin ( const std::string _pluginName)

Remove plugin by name. The plugin is removed from the application and its shared library unloaded if this was its last instance.

Parameters
[in]_pluginNamePlugn instance's unique name. This is the plugin card's object name.
Returns
True if successful

◆ ResolveConfigFile()

std::string ResolveConfigFile ( const std::string _path) const

Given an input config path, resolve its absolute path, potentially searching for it in locations specified by GZ_GUI_RESOURCE_PATH.

Parameters
[in]_pathPath to a config file. If the path is absolute
Returns
The resolved path

◆ SetDefaultConfigPath()

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

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

◆ SetPluginPathEnv()

void SetPluginPathEnv ( const std::string _env)

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

Parameters
[in]_envName of environment variable.

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