Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PyModuleHelper::XmlHandler Class Reference

XML resource files parser. More...

Public Member Functions

 XmlHandler (PyModuleHelper *helper, const QString &fileName)
 Constructor. More...
 
void createActions ()
 Parse XML file and create actions. More...
 
void createPopup (QMenu *menu, const QString &context, const QString &parent, const QString &object)
 Create popup menu. More...
 
void activateMenus (bool)
 Activate/deactivate menus. More...
 

Private Member Functions

LightApp_Modulemodule () const
 Get owner module. More...
 
QIcon loadIcon (const QString &fileName)
 Load an icon from the module resources by the specified file name. More...
 
void createMenu (QDomNode &parentNode, const int parentMenuId=-1, QMenu *parentPopup=0)
 Create main menu item and insert actions to it. More...
 
void createToolBar (QDomNode &parentNode)
 Create a toolbar and insert actions to it. More...
 
void insertPopupItems (QDomNode &parentNode, QMenu *menu)
 Fill popup menu with the items. More...
 

Private Attributes

PyModuleHelpermyHelper
 
QDomDocument myDoc
 
QList< int > myMenuItems
 

Detailed Description

This class is used to provide backward compatibility with existing Python modules in which obsolete menu definition system (via XML files) is used.

Constructor & Destructor Documentation

PyModuleHelper::XmlHandler::XmlHandler ( PyModuleHelper helper,
const QString &  fileName 
)
Parameters
modulepointer to the GUI module
fileNamepath to the XML menu description file

References myDoc.

Member Function Documentation

void PyModuleHelper::XmlHandler::activateMenus ( bool  enable)
Parameters
enableif true menus are activated, otherwise menus are deactivated

References CAM_Module::menuMgr(), PyModuleHelper::module(), and QtxActionMenuMgr::setEmptyEnabled().

void PyModuleHelper::XmlHandler::createActions ( )

Called by PyModuleHelper::initialize() in order to create actions (menus, toolbars).

void PyModuleHelper::XmlHandler::createMenu ( QDomNode &  parentNode,
const int  parentMenuId = -1,
QMenu parentPopup = 0 
)
private
Parameters
parentNodeXML node with menu description
parentMenuIdparent menu ID (-1 for top-level menu)
parentPopupparent popup menu (0 for top-level menu)

References attribute(), checkBool(), checkInt(), CAM_Module::createAction(), CAM_Module::createMenu(), PyModuleHelper::defaultMenuGroup(), PyModuleHelper::module(), CAM_Module::separator(), and tagName().

void PyModuleHelper::XmlHandler::createPopup ( QMenu menu,
const QString &  context,
const QString &  parent,
const QString &  object 
)
Parameters
menupopup menu
contextpopup menu context
contextpopup menu parent object name
contextpopup menu object name

References attribute(), and obj.

void PyModuleHelper::XmlHandler::createToolBar ( QDomNode &  parentNode)
private
void PyModuleHelper::XmlHandler::insertPopupItems ( QDomNode &  parentNode,
QMenu menu 
)
private
QIcon PyModuleHelper::XmlHandler::loadIcon ( const QString &  fileName)
private
Parameters
fileNameicon file name
Returns
icon object

References LightApp_Module::getApp(), QtxResourceMgr::loadPixmap(), PyModuleHelper::module(), and SUIT_Application::resourceMgr().

LightApp_Module * PyModuleHelper::XmlHandler::module ( ) const
private

Member Data Documentation

QDomDocument PyModuleHelper::XmlHandler::myDoc
private
PyModuleHelper* PyModuleHelper::XmlHandler::myHelper
private
QList<int> PyModuleHelper::XmlHandler::myMenuItems
private

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