From: vsr Date: Tue, 29 May 2007 10:55:36 +0000 (+0000) Subject: Convert DOS coding to UNIX X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d9690a5d11295cdee1e30e5530cc9545c2ad4734;p=modules%2Fgui.git Convert DOS coding to UNIX --- diff --git a/src/Qtx/Makefile.am b/src/Qtx/Makefile.am index 9604493d1..970eb6b10 100755 --- a/src/Qtx/Makefile.am +++ b/src/Qtx/Makefile.am @@ -44,6 +44,7 @@ salomeinclude_HEADERS= \ QtxMainWindow.h \ QtxMap.h \ QtxMRUAction.h \ + QtxPopupMgr.h \ QtxResourceMgr.h \ QtxToolBar.h \ QtxValidator.h \ @@ -64,7 +65,6 @@ salomeinclude_HEADERS= \ QtxMenuButton.h \ QtxPathDialog.h \ QtxPopupMenu.h \ - QtxPopupMgr.h \ QtxResourceEdit.h \ QtxSplash.h \ QtxTable.h \ @@ -92,6 +92,7 @@ dist_libqtx_la_SOURCES= \ QtxLogoMgr.cxx \ QtxMainWindow.cxx \ QtxMRUAction.cxx \ + QtxPopupMgr.cxx \ QtxResourceMgr.cxx \ QtxToolBar.cxx \ QtxValidator.cxx \ @@ -112,7 +113,6 @@ dist_libqtx_la_SOURCES= \ QtxMenuButton.cxx \ QtxPathDialog.cxx \ QtxPopupMenu.cxx \ - QtxPopupMgr.cxx \ QtxResourceEdit.cxx \ QtxSplash.cxx \ QtxTable.cxx \ @@ -134,6 +134,7 @@ MOC_FILES= \ QtxLogoMgr_moc.cxx \ QtxMainWindow_moc.cxx \ QtxMRUAction_moc.cxx \ + QtxPopupMgr_moc.cxx \ QtxToolBar_moc.cxx \ QtxValidator_moc.cxx \ QtxWorkspace_moc.cxx \ @@ -154,7 +155,6 @@ MOC_FILES= \ QtxMenuButton_moc.cxx \ QtxPathDialog_moc.cxx \ QtxPopupMenu_moc.cxx \ - QtxPopupMgr_moc.cxx \ QtxSplash_moc.cxx \ QtxTable_moc.cxx \ QtxToolTip_moc.cxx diff --git a/src/Qtx/Qtx.pro b/src/Qtx/Qtx.pro index 1e9547484..8bc844e32 100644 --- a/src/Qtx/Qtx.pro +++ b/src/Qtx/Qtx.pro @@ -28,6 +28,7 @@ HEADERS += QtxLogoMgr.h HEADERS += QtxMainWindow.h HEADERS += QtxMap.h HEADERS += QtxMRUAction.h +HEADERS += QtxPopupMgr.h HEADERS += QtxResourceMgr.h HEADERS += QtxToolBar.h HEADERS += QtxValidator.h @@ -45,7 +46,6 @@ HEADERS += QtxWorkstackAction.h #HEADERS += QtxMenuButton.h #HEADERS += QtxPathDialog.h #HEADERS += QtxPopupMenu.h -#HEADERS += QtxPopupMgr.h #HEADERS += QtxResourceEdit.h #HEADERS += QtxSplash.h #HEADERS += QtxTable.h @@ -67,6 +67,7 @@ SOURCES += QtxListAction.cxx SOURCES += QtxLogoMgr.cxx SOURCES += QtxMainWindow.cxx SOURCES += QtxMRUAction.cxx +SOURCES += QtxPopupMgr.cxx SOURCES += QtxResourceMgr.cxx SOURCES += QtxToolBar.cxx SOURCES += QtxValidator.cxx @@ -84,7 +85,6 @@ SOURCES += QtxWorkstackAction.cxx #SOURCES += QtxMenuButton.cxx #SOURCES += QtxPathDialog.cxx #SOURCES += QtxPopupMenu.cxx -#SOURCES += QtxPopupMgr.cxx #SOURCES += QtxResourceEdit.cxx #SOURCES += QtxSplash.cxx #SOURCES += QtxTable.cxx diff --git a/src/Qtx/QtxComboBox.cxx b/src/Qtx/QtxComboBox.cxx index 0bbe2ce60..8ffc1c073 100755 --- a/src/Qtx/QtxComboBox.cxx +++ b/src/Qtx/QtxComboBox.cxx @@ -26,14 +26,11 @@ /*! \class QtxComboBox \brief Enhanced version of Qt combo box class. - \warning The implementation is not yet finished! In addition to the QComboBox class, QtxComboBox supports adding/removing the items with the associated unique identifiers. It also provides a way to set "cleared" state to the combo box - when no item is selected. - - \todo Finalize the implementation: support adding/removing items by ID. */ /*! diff --git a/src/Qtx/QtxPopupMgr.cxx b/src/Qtx/QtxPopupMgr.cxx index 33813d4ae..bd4e6f061 100644 --- a/src/Qtx/QtxPopupMgr.cxx +++ b/src/Qtx/QtxPopupMgr.cxx @@ -19,12 +19,14 @@ #include "QtxPopupMgr.h" #include "QtxAction.h" - +#include "QtxEvalExpr.h" #include /*! - \return true if 'v1'<'v2' - This function can work with many types of values + \brief Used for comparing of two QVariant values. + \param v1 first argument for comparison + \param v2 second argument for comparison + \return \c true if \a v1 less than \a v2 */ bool operator<( const QVariant& v1, const QVariant& v2 ) { @@ -47,11 +49,11 @@ bool operator<( const QVariant& v1, const QVariant& v2 ) { const QList& aList1 = v1.toList(), aList2 = v2.toList(); QList::const_iterator anIt1 = aList1.begin(), aLast1 = aList1.end(), - anIt2 = aList2.begin(), aLast2 = aList2.end(); + anIt2 = aList2.begin(), aLast2 = aList2.end(); for ( ; anIt1 != aLast1 && anIt2 != aLast2; anIt1++, anIt2++ ) { - if ( (*anIt1) != (*anIt2) ) - return (*anIt1)<(*anIt2); + if ( (*anIt1) != (*anIt2) ) + return (*anIt1)<(*anIt2); } return anIt1 == aLast1 && anIt2 != aLast2; break; @@ -67,7 +69,13 @@ bool operator<( const QVariant& v1, const QVariant& v2 ) /*! \class QtxPopupMgr::PopupCreator + \internal + \brief Popup menu actions creator. + + Used by Reader to create actions by reading descriptions from the file + and fill in the action manager with the actions. */ + class QtxPopupMgr::PopupCreator : public QtxActionMgr::Creator { public: @@ -77,17 +85,17 @@ public: virtual int append( const QString&, const bool, const ItemAttributes&, const int ); - virtual QString visibleRule( const ItemAttributes& ) const; - virtual QString toggleRule( const ItemAttributes& ) const; + virtual QString rule( const ItemAttributes&, + const QtxPopupMgr::RuleType = VisibleRule ) const; private: QtxPopupMgr* myMgr; }; /*! - Constructor - \param r - menu reader - \param mgr - menu manager + \brief Constructor. + \param r menu action reader + \param mgr popup menu manager */ QtxPopupMgr::PopupCreator::PopupCreator( QtxActionMgr::Reader* r, QtxPopupMgr* mgr ) @@ -97,18 +105,19 @@ QtxPopupMgr::PopupCreator::PopupCreator( QtxActionMgr::Reader* r, } /*! - Destructor -*/QtxPopupMgr::PopupCreator::~PopupCreator() + \brief Destructor. +*/ +QtxPopupMgr::PopupCreator::~PopupCreator() { } - /*! - Appends new menu items - \param tag - tag of item - \param subMenu - it has submenu - \param attr - list of attributes - \param pId - id of action corresponding to parent item + \brief Create and append new action to the action manager. + \param tag item tag name + \param subMenu \c true if this item is submenu + \param attr attributes map + \param pId parent action ID + \return menu action ID */ int QtxPopupMgr::PopupCreator::append( const QString& tag, const bool subMenu, const ItemAttributes& attr, const int pId ) @@ -155,9 +164,16 @@ int QtxPopupMgr::PopupCreator::append( const QString& tag, const bool subMenu, newAct->setChecked( toggleact.toLower() == "true" ); connect( newAct ); - int aid = mgr->registerAction( newAct, actId ); - myMgr->setRule( newAct, visibleRule( attr ), QtxPopupMgr::VisibleRule ); - myMgr->setRule( newAct, isToggle ? toggleRule( attr ) : QString(), QtxPopupMgr::ToggleRule ); + int aid = mgr->registerAction( newAct, actId ); + QString arule = rule( attr, QtxPopupMgr::VisibleRule ); + if ( !arule.isEmpty() ) + myMgr->setRule( newAct, arule, QtxPopupMgr::VisibleRule ); + arule = rule( attr, QtxPopupMgr::EnableRule ); + if ( !arule.isEmpty() ) + myMgr->setRule( newAct, arule, QtxPopupMgr::EnableRule ); + arule = rule( attr, QtxPopupMgr::ToggleRule ); + if ( isToggle && !arule.isEmpty() ) + myMgr->setRule( newAct, arule, QtxPopupMgr::ToggleRule ); res = mgr->insert( aid, pId, intValue( attr, group, 0 ), intValue( attr, pos, -1 ) ); } @@ -165,29 +181,46 @@ int QtxPopupMgr::PopupCreator::append( const QString& tag, const bool subMenu, } /*! - \return visibility rule by attributes - Default implementation is empty -*/ -QString QtxPopupMgr::PopupCreator::visibleRule( const ItemAttributes& ) const -{ - return QString::null; -} + \brief Get the rule for the menu item. -/*! - \return toggle rule by attributes - Default implementation is empty + Default implementation returns empty rule. + + \param attr attributes map + \param ruleType rule type (QtxPopupMgr::RuleType) + \return rule for the menu item corresponding to the rule type */ -QString QtxPopupMgr::PopupCreator::toggleRule( const ItemAttributes& ) const +QString QtxPopupMgr::PopupCreator::rule( const ItemAttributes& /*attr*/, + const QtxPopupMgr::RuleType /*ruleType*/ ) const { - return QString::null; + return QString(); } /*! \class QPopupMgr + \brief Popup menu manager. + + Menu manager allows using of set of action for automatic generating of + application context popup menu by reuquest and dynamic update of its + contents. + + Use insert() methods to add menu items to the popup menu. + + The visibility, enable and toggle state of the menu item is controlled + by the syntaxic rules, which can be set with setRule() methods. + The rules are parsed automatically with help of QtxEvalParser class. + + QtxPopupSelection class is used as back-end for getting value of each + parameter found in the rule by the expression parser. + Use setSelection() and selection() to set/get the selection instance + for the popup menu manager. + + Popup menu manager automatically optimizes the menu by removing + extra separators, hiding empty popup submenus etc. */ /*! - Constructor + \brief Constructor. + \param object parent object */ QtxPopupMgr::QtxPopupMgr( QObject* parent ) : QtxActionMenuMgr( 0, parent ), @@ -196,7 +229,9 @@ QtxPopupMgr::QtxPopupMgr( QObject* parent ) } /*! - Constructor + \brief Constructor. + \param popup popup menu + \param object parent object */ QtxPopupMgr::QtxPopupMgr( QMenu* popup, QObject* parent ) : QtxActionMenuMgr( popup, parent ), @@ -205,27 +240,43 @@ QtxPopupMgr::QtxPopupMgr( QMenu* popup, QObject* parent ) } /*! - Destructor + \brief Destructor. */ QtxPopupMgr::~QtxPopupMgr() { } +/*! + \brief Get popup menu. + \return popup menu +*/ QMenu* QtxPopupMgr::menu() const { return ::qobject_cast( menuWidget() ); } +/*! + \brief Get popup menu. + \param menu popup menu +*/ void QtxPopupMgr::setMenu( QMenu* menu ) { setMenuWidget( menu ); } +/*! + \brief Get selection. + \return current selection object +*/ QtxPopupSelection* QtxPopupMgr::selection() const { return mySelection; } +/*! + \brief Set selection. + \param sel new selection object +*/ void QtxPopupMgr::setSelection( QtxPopupSelection* sel ) { if ( mySelection == sel ) @@ -237,22 +288,29 @@ void QtxPopupMgr::setSelection( QtxPopupSelection* sel ) } /*! - Additional version of registerAction - \param act - action to be registered - \param visible - rule for visibility state - \param toggle - rule for toggle on state - \param id - proposed id (if it is less than 0, then id will be generated automatically) + \brief Register an action and return its identifier. + + If \a id is less than 0, the identifier for the action is generated automatically. + If action with given \a id is already registered, it will be re-registered. + If required \a id is already in use, new identifier is generatied; in this case + returning value will different from required one. + + \param act action to be registered + \param id action ID + \param rule syntax rule + \param ruleType rule type (QtxPopupMgr::RuleType) + \return action ID (the same as \a id or generated one) */ -int QtxPopupMgr::registerAction( QAction* act, const int id, const QString& rule, const QtxPopupMgr::RuleType type ) +int QtxPopupMgr::registerAction( QAction* act, const int id, const QString& rule, const QtxPopupMgr::RuleType ruleType ) { int _id = QtxActionMenuMgr::registerAction( act, id ); - setRule( act, rule, type ); + setRule( act, rule, ruleType ); return _id; } /*! - Removes action from internal map - \param id - action id + \brief Unregister action from internal map. + \param id action ID */ void QtxPopupMgr::unRegisterAction( const int id ) { @@ -270,9 +328,12 @@ void QtxPopupMgr::unRegisterAction( const int id ) } /*! - \return true if manager has rule for action - \param act - action - \param visibility - if it is true, then rule for "visibility" is checked, otherwise - for "toggle" + \brief Insert action to the popup menu manager. + \param id action ID + \param pId parent menu action ID + \param rule syntax rule + \param ruleType rule type (QtxPopupMgr::RuleType) + \return action ID */ int QtxPopupMgr::insert( const int id, const int pId, const QString& rule, const RuleType ruleType ) { @@ -281,6 +342,14 @@ int QtxPopupMgr::insert( const int id, const int pId, const QString& rule, const return res; } +/*! + \brief Insert action to the popup menu manager. + \param a action + \param pId parent menu action ID + \param rule syntax rule + \param ruleType rule type (QtxPopupMgr::RuleType) + \return action ID +*/ int QtxPopupMgr::insert( QAction* a, const int pId, const QString& rule, const RuleType ruleType ) { int res = QtxActionMenuMgr::insert( a, pId, -1 ); @@ -289,61 +358,65 @@ int QtxPopupMgr::insert( QAction* a, const int pId, const QString& rule, const R } /*! - \return Rule of a specified action - \param a - action - \param type - type of rule + \brief Get rule of type \a type for the action \a a. + \param a action + \param ruleType rule type (QtxPopupMgr::RuleType) + \return rule of required type */ -QString QtxPopupMgr::rule( QAction* a, const RuleType type ) const +QString QtxPopupMgr::rule( QAction* a, const RuleType ruleType ) const { QString rule; - QtxEvalExpr* expr = expression( a, type ); + QtxEvalExpr* expr = expression( a, ruleType ); if ( expr ) rule = expr->expression(); return rule; } /*! - \return Rule of action with a specified id - \param id - action id - \param type - type of rule + \brief Get rule of type \a type for the action \a id. + \param id action ID + \param ruleType rule type (QtxPopupMgr::RuleType) + \return rule of required type */ -QString QtxPopupMgr::rule( const int id, const RuleType type ) const +QString QtxPopupMgr::rule( const int id, const RuleType ruleType ) const { - return rule( action( id ), type ); + return rule( action( id ), ruleType ); } /*! - Sets new rule for action - \param act - action - \param rule - string expression of rule - \param type - type of rule + \brief Set rule of type \a type for the action \a a. + \param a action + \param rule rule + \param ruleType rule type (QtxPopupMgr::RuleType) + \return rule of required type */ -void QtxPopupMgr::setRule( QAction* act, const QString& rule, const RuleType type ) +void QtxPopupMgr::setRule( QAction* a, const QString& rule, const RuleType ruleType ) { - if ( !act ) + if ( !a ) return; - QtxEvalExpr* expr = expression( act, type, true ); + QtxEvalExpr* expr = expression( a, ruleType, true ); expr->setExpression( rule ); } /*! - Sets new rule for action - \param id - action id - \param rule - string expression of rule - \param type - type of rule + \brief Set rule of type \a type for the action \a id. + \param id action ID + \param rule rule + \param ruleType rule type (QtxPopupMgr::RuleType) + \return rule of required type */ -void QtxPopupMgr::setRule( const int id, const QString& rule, const RuleType type ) +void QtxPopupMgr::setRule( const int id, const QString& rule, const RuleType ruleType ) { - setRule( action( id ), rule, type ); + setRule( action( id ), rule, ruleType ); } /*! - \return true if parser has finished work without errors - \param p - parser + \brief Calculate an expression. + \param p expression parser + \return \c true if parser has finished work without errors */ - bool QtxPopupMgr::result( QtxEvalParser* p ) const { bool res = false; @@ -358,9 +431,14 @@ bool QtxPopupMgr::result( QtxEvalParser* p ) const } /*! - Fills parser parameters with help of Selection::globalParam() method - \param p - parser - \param specific - list will be filled with names of parameters depending on selection objects (not global) + \brief Fill the parser with parameters of the expression. + + The values of the parameters are given from the selection object + (QtxPopupSelection). + + \param p expression parser + \param returning list of parameters names which are not retrieved from the selection + \sa selection() */ void QtxPopupMgr::setParameters( QtxEvalParser* p, QStringList& specific ) const { @@ -372,23 +450,24 @@ void QtxPopupMgr::setParameters( QtxEvalParser* p, QStringList& specific ) const { QVariant v = parameter( *it ); if ( v.isValid() ) - p->setParameter( *it, v ); + p->setParameter( *it, v ); else specific.append( *it ); } } /*! - \return true if rule of action is satisfied on current selection - \param act - action - \param visibility - what rule is checked: for visibility(true) or for toggle(false) + \brief Check the rule for the action. + \param act action + \param ruleType rule type (QtxPopupMgr::RuleType) + \return \c true if current selection satisfies the action rule */ -bool QtxPopupMgr::isSatisfied( QAction* act, const RuleType type ) const +bool QtxPopupMgr::isSatisfied( QAction* act, const RuleType ruleType ) const { if ( !act ) return false; - QtxEvalExpr* exp = expression( act, type ); + QtxEvalExpr* exp = expression( act, ruleType ); if ( !exp ) return true; @@ -405,26 +484,26 @@ bool QtxPopupMgr::isSatisfied( QAction* act, const RuleType type ) const { if ( mySelection ) { - res = false; + res = false; for ( int i = 0; i < mySelection->count() && !res; i++ ) { QList c; - for ( QStringList::const_iterator anIt1 = specific.begin(); anIt1 != specific.end(); ++anIt1 ) + for ( QStringList::const_iterator anIt1 = specific.begin(); anIt1 != specific.end(); ++anIt1 ) c.append( parameter( *anIt1, i ) ); aCorteges.insert( c, 0 ); - } - for ( QMap, int>::const_iterator anIt = aCorteges.begin(); anIt != aCorteges.end(); ++anIt ) - { - const QList& aCortege = anIt.key(); - QStringList::const_iterator anIt1 = specific.begin(), aLast1 = specific.end(); - QList::const_iterator anIt2 = aCortege.begin(); - for ( ; anIt1 != aLast1; anIt1++, anIt2++ ) - p->setParameter( *anIt1, *anIt2 ); - res = res || result( p ); - } + } + for ( QMap, int>::const_iterator anIt = aCorteges.begin(); anIt != aCorteges.end(); ++anIt ) + { + const QList& aCortege = anIt.key(); + QStringList::const_iterator anIt1 = specific.begin(), aLast1 = specific.end(); + QList::const_iterator anIt2 = aCortege.begin(); + for ( ; anIt1 != aLast1; anIt1++, anIt2++ ) + p->setParameter( *anIt1, *anIt2 ); + res = res || result( p ); + } } else - res = false; + res = false; } else res = result( p ); @@ -433,19 +512,19 @@ bool QtxPopupMgr::isSatisfied( QAction* act, const RuleType type ) const } /*! - \return true if item corresponding to action is visible - \param actId - action id - \param place - index of place + \brief Check if the menu item is visible. + \param id action ID + \param place some parent action ID + \return \c true if the action is visible */ -bool QtxPopupMgr::isVisible( const int actId, const int place ) const +bool QtxPopupMgr::isVisible( const int id, const int place ) const { - return QtxActionMenuMgr::isVisible( actId, place ) && isSatisfied( action( actId ) ); + return QtxActionMenuMgr::isVisible( id, place ) && isSatisfied( action( id ) ); } /*! - Updates popup according to selection - \param p - popup menu - \param sel - selection + \brief Perform internal update of the popup menu according + to the current selection. */ void QtxPopupMgr::internalUpdate() { @@ -465,9 +544,7 @@ void QtxPopupMgr::internalUpdate() } /*! - Updates popup according to selection - \param p - popup menu - \param sel - selection + \brief Update popup according to the current selection. */ void QtxPopupMgr::updateMenu() { @@ -475,12 +552,13 @@ void QtxPopupMgr::updateMenu() } /*! - \return reference to eval expression - \param a - action - \param type - rule type - \param create - create eval expression if it doesn't exist + \brief Get an syntax expression for the action according to the specified rule type. + \param a action + \param ruleType rule type (QtxPopupMgr::RuleType) + \param create if \c true an expression does not exist, create it + \return syntax expression */ -QtxEvalExpr* QtxPopupMgr::expression( QAction* a, const RuleType type, const bool create ) const +QtxEvalExpr* QtxPopupMgr::expression( QAction* a, const RuleType ruleType, const bool create ) const { QtxEvalExpr* res = 0; @@ -492,20 +570,20 @@ QtxEvalExpr* QtxPopupMgr::expression( QAction* a, const RuleType type, const boo if ( ruleMap.contains( a ) ) { ExprMap& exprMap = ruleMap[a]; - if ( exprMap.contains( type ) ) - res = exprMap[type]; + if ( exprMap.contains( ruleType ) ) + res = exprMap[ruleType]; else if ( create ) - exprMap.insert( type, res = new QtxEvalExpr() ); + exprMap.insert( ruleType, res = new QtxEvalExpr() ); } return res; } /*! - Loads actions description from file - \param fname - name of file - \param r - reader of file - \return true on success + \brief Load actions description from the file. + \param fname file name + \param r action reader + \return \c true on success and \c false on error */ bool QtxPopupMgr::load( const QString& fname, QtxActionMgr::Reader& r ) { @@ -513,6 +591,13 @@ bool QtxPopupMgr::load( const QString& fname, QtxActionMgr::Reader& r ) return r.read( fname, cr ); } +/* + \brief Get the specified parameter value. + \param name parameter name + \param idx additional index used when used parameters with same names + \return parameter value + \sa selection() +*/ QVariant QtxPopupMgr::parameter( const QString& name, const int idx ) const { QVariant val; @@ -535,8 +620,36 @@ QVariant QtxPopupMgr::parameter( const QString& name, const int idx ) const /*! \class QtxPopupSelection + \brief This class is a part of the popup menu management system. + + The QtxPopupSelection class is used as back-end for getting value + of each parameter found in the rule by the expression parser. + + For example, it can be used for the analyzing of the currently + selected objects and defining the values of the parameters used + in the rules syntax expression. Rules, in their turn, define + each action state - visibility, enabled and toggled state. */ +/*! + \brief Constructor. +*/ +QtxPopupSelection::QtxPopupSelection() +{ +} + +/*! + \brief Destructor. +*/ +QtxPopupSelection::~QtxPopupSelection() +{ +} + +/*! + \brief Get an option value. + \param optName option name + \return option value or empty string if option is not found +*/ QString QtxPopupSelection::option( const QString& optName ) const { QString opt; @@ -545,17 +658,20 @@ QString QtxPopupSelection::option( const QString& optName ) const return opt; } +/*! + \brief Set an option value. + \param optName option name + \param opt option value +*/ void QtxPopupSelection::setOption( const QString& optName, const QString& opt ) { myOptions.insert( optName, opt ); } /*! - \return value of global parameter (depending on whole selection, but not - dependending on one object of selection) - \param str - name of parameter - - By default, it returns count of selected objects ("selcount") and list of parameters ("$") + \brief Get the parameter value. + \param str parameter name + \return parameter value */ QVariant QtxPopupSelection::parameter( const QString& str ) const { @@ -569,9 +685,9 @@ QVariant QtxPopupSelection::parameter( const QString& str ) const { QVariant v = parameter( i, par ); if ( v.isValid() ) - QtxEvalSetSets::add( set, v ); + QtxEvalSetSets::add( set, v ); else - return QVariant(); + return QVariant(); } return set; } @@ -580,7 +696,8 @@ QVariant QtxPopupSelection::parameter( const QString& str ) const } /*! - \return symbole to detect name of parameter list + \brief Get symbol which detects the name of the parameter list. + \return equality symbol (by default, "$") */ QString QtxPopupSelection::equalityParam() const { @@ -591,7 +708,8 @@ QString QtxPopupSelection::equalityParam() const } /*! - \return name of parameter for count of selected objects + \brief Get name of the parameter, specifing number of selected objects + \return parameter name (by default, "selcount") */ QString QtxPopupSelection::selCountParam() const { @@ -600,3 +718,17 @@ QString QtxPopupSelection::selCountParam() const str = "selcount"; return str; } + +/* + \fn int QtxPopupSelection::count() const; + \brief Get number of the selected objects. + \return nb of selected objects +*/ + +/* + \fn QVariant QtxPopupSelection::parameter( const int idx, const QString& name ) const; + \brief Get number of the selected objects. + \param idx parameter index + \param name parameter name + \return parameter value +*/ diff --git a/src/Qtx/QtxPopupMgr.h b/src/Qtx/QtxPopupMgr.h index 2ae7f5a28..adcbd7657 100644 --- a/src/Qtx/QtxPopupMgr.h +++ b/src/Qtx/QtxPopupMgr.h @@ -20,25 +20,27 @@ #ifndef QTXPOPUPMGR_H #define QTXPOPUPMGR_H -#include "QtxEvalExpr.h" #include "QtxActionMenuMgr.h" #include class QtxPopupSelection; - -/*! - \class QPopupMgr -*/ +class QtxEvalExpr; +class QtxEvalParser; class QTX_EXPORT QtxPopupMgr : public QtxActionMenuMgr { - Q_OBJECT + Q_OBJECT public: - typedef enum { VisibleRule, EnableRule, ToggleRule } RuleType; + //! Menu item rule type + typedef enum { + VisibleRule, //!< menu item visibility state + EnableRule, //!< menu item enable state + ToggleRule //!< menu item toggle state + } RuleType; -protected: +private: class PopupCreator; public: @@ -92,26 +94,28 @@ private: QtxPopupSelection* mySelection; }; -/*! - \class QtxPopupSelection -*/ - class QTX_EXPORT QtxPopupSelection { public: + QtxPopupSelection(); + virtual ~QtxPopupSelection(); + virtual int count() const = 0; - virtual QVariant parameter( const QString& ) const; + virtual QVariant parameter( const QString& ) const; virtual QVariant parameter( const int, const QString& ) const = 0; QString option( const QString& ) const; void setOption( const QString&, const QString& ); private: - QString equalityParam() const; - QString selCountParam() const; + QString equalityParam() const; + QString selCountParam() const; + +private: + typedef QMap OptionsMap; private: - QMap myOptions; + OptionsMap myOptions; }; #endif