roviz  0.7
Code Documentation of roviz
Signals | Public Member Functions | Protected Member Functions | List of all members
GuiManager Class Reference

The GuiManager class handels widgets and actions on the main window. More...

#include <gui_manager.h>

Inheritance diagram for GuiManager:
Inheritance graph
Collaboration diagram for GuiManager:
Collaboration graph

Signals

void mainWindowActivationChange ()
 is emited when the activation of the main window changed
 

Public Member Functions

void setMode (GuiMode mode)
 Sets the GUI mode to mode. More...
 
QWidget * removeWidget (QString const &name)
 removeFromLayout removes widget from the GUI. Caller takes ownership of the widget More...
 
bool addWidget (QWidget *widget, QString const &name, WidgetArea area, WidgetType type=WidgetType::DockWidget)
 Adds a widget to the mainwindow. More...
 
QString addWidget (QWidget *widget, WidgetArea area, WidgetType type=WidgetType::DockWidget)
 Adds a widget to the mainwindow.
Uses the objectName or className as name.
Appends a number if a a widget is already stored with that name. More...
 
bool moveWidget (QString const &name, WidgetArea area)
 moveWidget change the position of a widget More...
 
void setVisible (QString const &name, bool visible)
 setVisible changes the visibility of a widget More...
 
QWidget * widgetReference ()
 widgetReference method to access the main window More...
 
bool addAction (QAction *action, QString const &name, QString const &parent)
 adds an action a menu or a toolbar More...
 
bool addActionToParent (QString const &name, QString const &parent)
 Adds the action name to the action or widget parent. More...
 
QString addAction (QAction *action, QString const &parent)
 Adds an action to a menu or a toolbar
Uses the objectName or className as name.
Appends a number if something is already stored with that name. More...
 
QAction * action (QString const &name) const
 Access to reference of an action. More...
 
QAction * removeAction (QString const &name, QString const &parent=QString())
 Removes an action from the gui and returns it. More...
 
void registerCloseHandler (std::function< bool()> callback)
 This callback will be executed by an application close event. If the callback returns true the close process will be continue -> shutdown application. If the callback returns false the close process will be interrupted. More...
 
QStringList parents (QString const &name)
 Access to the names of the parents of an registered action. More...
 
QStringList children (QString const &name) const
 Access to the names of the children of an registered action or widget. More...
 
QStringList registeredActions () const
 Access to all the names of the registered actions. More...
 
QStringList registeredWidgets () const
 Access to all the names of the registered widgets. More...
 
QStringList registeredWidgets (WidgetType type) const
 registeredWidgets return all registered widgets of the given type More...
 
bool mainWindowIsActive () const
 mainWindowIsActive More...
 

Protected Member Functions

bool postInit ()
 postInit will be called after all components and singletons have been constructed/initialized More...
 
bool preDestroy ()
 preDestroy will be called before any of the components and singletons will be destructed/deinitailized More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< GuiManager >
static GuiManagerinstance ()
 Returns the current instance of the singleton. More...
 

Detailed Description

The GuiManager class handels widgets and actions on the main window.

Member Function Documentation

◆ action()

QAction * GuiManager::action ( QString const &  name) const

Access to reference of an action.

Parameters
nameName of the action
Returns
Reference to the action, NULL when it doesn't exist
Here is the caller graph for this function:

◆ addAction() [1/2]

bool GuiManager::addAction ( QAction *  action,
QString const &  name,
QString const &  parent 
)

adds an action a menu or a toolbar

Parameters
ActionThe action that is added, GuiManager doesn't takes ownership, can't be NULL
NameThe name of the action, is used to access the action later on, must be unique or
parentThe name of the parent under which the action is added, parent must be an action that is a menu, a menubar when the action is a menu or a toolbar when the action isn't a menu
Returns
True when the action could be added

◆ addAction() [2/2]

QString GuiManager::addAction ( QAction *  action,
QString const &  parent 
)

Adds an action to a menu or a toolbar
Uses the objectName or className as name.
Appends a number if something is already stored with that name.

Parameters
actionPointer to the action, GuiManager doesn't takes ownership
parentThe name of the parent under which the action is added, parent must be an action that is a menu, a menubar when the action is a menu or a toolbar when the action isn't a menu
Returns
name under which the action was added, is empty when the widget couldn't be added

◆ addActionToParent()

bool GuiManager::addActionToParent ( QString const &  name,
QString const &  parent 
)

Adds the action name to the action or widget parent.

Parameters
nameName of the action or widget, must be an action
parent,Thename of the parent under which the action is added, parent must be an action that is a menu, a menubar when the action is a menu or a toolbar when the action isn't a menu
Returns
True when the action could be added to parent

◆ addWidget() [1/2]

bool GuiManager::addWidget ( QWidget *  widget,
QString const &  name,
WidgetArea  area,
WidgetType  type = WidgetType::DockWidget 
)

Adds a widget to the mainwindow.

Parameters
widgetpointer to the widget, action that are already within a Toolbar or MenuBar are also registered whe
namename of the specified widget, name can be used to access the widget later, must be unique
areadock- or toolbox-area where the widget will be placed, use WidgetType::NoArea for other widgets
typewhat type of widget it is. Note that if a widget with a type that occurs only once (CentralWidget, MenuBar, StatusBar) is added, the old widget will be deleted.
Returns
true if the widget could be added

Takes the ownership of the passed window

Here is the caller graph for this function:

◆ addWidget() [2/2]

QString GuiManager::addWidget ( QWidget *  widget,
WidgetArea  area,
WidgetType  type = WidgetType::DockWidget 
)

Adds a widget to the mainwindow.
Uses the objectName or className as name.
Appends a number if a a widget is already stored with that name.

Parameters
widgetpointer to the widget, action that are already within a Toolbar or MenuBar are also registered
areadock- or toolbox-area where the widget will be placed, use WidgetType::NoArea for other widgets
typewhat type of widget it is. Note that if a widget with a type that occurs only once (CentralWidget, MenuBar, StatusBar) is added, the old widget will be deleted.
Returns
name under which the widget was added, is empty when the widget couldn't be added
  • Takes the ownership of the passed window

◆ children()

QStringList GuiManager::children ( QString const &  name) const

Access to the names of the children of an registered action or widget.

Parameters
nameName of the action or widget
Returns
List of the names of all children of name

◆ mainWindowIsActive()

bool GuiManager::mainWindowIsActive ( ) const

mainWindowIsActive

Returns
State of the main window

◆ moveWidget()

bool GuiManager::moveWidget ( QString const &  name,
WidgetArea  area 
)

moveWidget change the position of a widget

Parameters
namename of the widget that should be moved
areaarea where the widget will be moved to
Returns
true if the action was successful

◆ parents()

QStringList GuiManager::parents ( QString const &  name)

Access to the names of the parents of an registered action.

Parameters
nameName of the action
Returns
List of the names of all parents of name

◆ postInit()

bool GuiManager::postInit ( )
protectedvirtual

postInit will be called after all components and singletons have been constructed/initialized

Returns
true if post initialization was successfull

Implements AbstractSingleton.

◆ preDestroy()

bool GuiManager::preDestroy ( )
protectedvirtual

preDestroy will be called before any of the components and singletons will be destructed/deinitailized

Returns
true if pre destruction was successfull

Implements AbstractSingleton.

Here is the call graph for this function:

◆ registerCloseHandler()

void GuiManager::registerCloseHandler ( std::function< bool()>  callback)

This callback will be executed by an application close event. If the callback returns true the close process will be continue -> shutdown application. If the callback returns false the close process will be interrupted.

Parameters
std::function<bool>callback
Here is the caller graph for this function:

◆ registeredActions()

QStringList GuiManager::registeredActions ( ) const

Access to all the names of the registered actions.

Returns
List containing all names of the registered actions

◆ registeredWidgets() [1/2]

QStringList GuiManager::registeredWidgets ( ) const

Access to all the names of the registered widgets.

Returns
List containing all names of the registered widgets

◆ registeredWidgets() [2/2]

QStringList GuiManager::registeredWidgets ( WidgetType  type) const

registeredWidgets return all registered widgets of the given type

Parameters
typeType to be returned
Returns
Names of widgets

◆ removeAction()

QAction * GuiManager::removeAction ( QString const &  name,
QString const &  parent = QString() 
)

Removes an action from the gui and returns it.

Parameters
namename of the action
parentparent of the action, will remove all occurences if string is empty. None when parent doesn't exist
Returns
removed action, NULL when name or parent doesn't exist

◆ removeWidget()

QWidget * GuiManager::removeWidget ( QString const &  name)

removeFromLayout removes widget from the GUI. Caller takes ownership of the widget

Parameters
widgetid that is removed
Returns
Pointer to QDockWidget. Null if nothing has been removed.

◆ setMode()

void GuiManager::setMode ( GuiMode  mode)

Sets the GUI mode to mode.

Parameters
modeThe new GUI mode to use
Here is the call graph for this function:

◆ setVisible()

void GuiManager::setVisible ( QString const &  name,
bool  visible 
)

setVisible changes the visibility of a widget

Parameters
namename of the widget
visiblevalue that the visibility is set to

◆ widgetReference()

QWidget * GuiManager::widgetReference ( )

widgetReference method to access the main window

Returns
refrence to the mainwindow

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