Back to index

salome-gui  6.5.0
Public Member Functions | Private Attributes
QtxActionMenuMgr::MenuCreator Class Reference

Menu actions creator. More...

#include <QtxActionMenuMgr.h>

Inheritance diagram for QtxActionMenuMgr::MenuCreator:
Inheritance graph
[legend]
Collaboration diagram for QtxActionMenuMgr::MenuCreator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MenuCreator (QtxActionMgr::Reader *, QtxActionMenuMgr *)
 Constructor.
virtual ~MenuCreator ()
 Destructor.
virtual int append (const QString &, const bool, const ItemAttributes &, const int)
 Create and append to the action manager a new action.

Private Attributes

QtxActionMenuMgrmyMgr
 menu manager

Detailed Description

Menu actions creator.

Used by Reader to create actions by reading descriptions from the file and fill in the action manager with the actions.

Definition at line 156 of file QtxActionMenuMgr.h.


Constructor & Destructor Documentation

Constructor.

Parameters:
rmenu actions reader
mgrmenu manager

Definition at line 1235 of file QtxActionMenuMgr.cxx.

: QtxActionMgr::Creator( r ),
  myMgr( mgr )
{
}

Destructor.

Definition at line 1244 of file QtxActionMenuMgr.cxx.

{
}

Member Function Documentation

int QtxActionMenuMgr::MenuCreator::append ( const QString &  tag,
const bool  subMenu,
const ItemAttributes attr,
const int  pId 
) [virtual]

Create and append to the action manager a new action.

Parameters:
tagitem tag name
subMenutrue if this item is submenu
attrattributes map
pIdparent action ID
Returns:
menu action ID

Definition at line 1256 of file QtxActionMenuMgr.cxx.

{
  if( !myMgr || !reader() )
    return -1;

  QString label   = reader()->option( "label",     "label"     ),
          id      = reader()->option( "id",        "id"        ),
          pos     = reader()->option( "pos",       "pos"       ),
          group   = reader()->option( "group",     "group"     ),
          tooltip = reader()->option( "tooltip",   "tooltip"   ),
          sep     = reader()->option( "separator", "separator" ),
          accel   = reader()->option( "accel",     "accel"     ),
          icon    = reader()->option( "icon",      "icon"      ),
          toggle  = reader()->option( "toggle",    "toggle"    );

  int res = -1, actId = intValue( attr, id, -1 );

  if( subMenu )
    res = myMgr->insert( strValue( attr, label ), pId, intValue( attr, group, 0 ), intValue( attr, pos, -1 ) );
  else if( tag==sep )
    res = myMgr->insert( separator(), pId, intValue( attr, group, 0 ), intValue( attr, pos, -1 ) );
  else
  {
    QIcon set;
    QPixmap pix;
    QString name = strValue( attr, icon );
    if( !name.isEmpty() && loadPixmap( name, pix ) )
      set = QIcon( pix );

    QtxAction* newAct = new QtxAction( strValue( attr, tooltip ), set,
                                       strValue( attr, label ),
                                       QKeySequence( strValue( attr, accel ) ),
                                       myMgr );
    newAct->setToolTip( strValue( attr, tooltip ) );
    QString toggleact = strValue( attr, toggle );
    newAct->setCheckable( !toggleact.isEmpty() );
    newAct->setChecked( toggleact.toLower() == "true" );

    connect( newAct );
    int aid = myMgr->registerAction( newAct, actId );
    res = myMgr->insert( aid, pId, intValue( attr, group, 0 ), intValue( attr, pos, -1 ) );
  }

  return res;
}

Member Data Documentation

menu manager

Definition at line 166 of file QtxActionMenuMgr.h.


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