From: vsr Date: Mon, 9 Jul 2007 11:48:38 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: qt4_porting_delivery_220807~111 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=55506e1061c91cb23bb6cac7fd6fc48df43a6b18;p=modules%2Fgui.git *** empty log message *** --- diff --git a/src/Qtx/Qtx.cxx b/src/Qtx/Qtx.cxx index 56392249a..db5c4d0b7 100755 --- a/src/Qtx/Qtx.cxx +++ b/src/Qtx/Qtx.cxx @@ -40,18 +40,20 @@ /*! \class Qtx - \brief Set of helpful utility functions. - - The class implements set of static functions which can be used for different purpuses: - - define tab order for set of widgets: setTabOrder() - - align one widget to the other widget: alignWidget() - - remove extra separators from menu or toolbar: simplifySeparators() - - retrieve directory, file name and extension parts of the path: dir(), file(), extension() - - get temporary directory name: tmpDir() - - create and remove directory (recursively): mkDir(), rmDir() + \brief A set of helpful utility functions. + + The class implements a set of the static functions which can be used + for the different purposes: + - specify tab order for the set of widgets: setTabOrder() + - align one widget to the coordinates of the another one: alignWidget() + - remove extra separators from the menu or toolbar: simplifySeparators() + - retrieve directory, file name and extension parts of the path: + dir(), file(), extension() + - get the path to the temporary directory: tmpDir() + - create or remove a directory (recursively): mkDir(), rmDir() - convert text file from DOS to UNIX native format: dos2unix() - - convert picture to the gray scale: grayscale() - - and other + - convert a picture to the gray scale: grayscale() + - other */ /*! @@ -541,6 +543,23 @@ bool Qtx::dos2unix( const QString& absName ) return QDir().rename( QString( temp ), absName ); } +/*! + \brief Create path completer which can be used in the widgets + to provide auto completions. + + Create an instance of QCompleter class and returns the pointer on it. + The calling function is responsible to the desstroying of the created + completer object. + + The QCompleter class provides completions based on a item model and can be + used in such as QLineEdit and QComboBox. + When the user starts typing a word, QCompleter suggests possible ways of + completing the word, based on a word list. + + \param type path type (Qtx::PathType) + \param filter file/directory filters (list of wildcards, separated by ";;") + \return a pointer to the created completer +*/ QCompleter* Qtx::pathCompleter( const PathType type, const QString& filter ) { QStringList extList; diff --git a/src/Qtx/Qtx.h b/src/Qtx/Qtx.h index 1c8c004f8..845e28c13 100755 --- a/src/Qtx/Qtx.h +++ b/src/Qtx/Qtx.h @@ -22,18 +22,14 @@ #ifndef QTX_H #define QTX_H -#if defined QTX_EXPORTS #if defined WIN32 -#define QTX_EXPORT _declspec( dllexport ) +# if defined QTX_EXPORTS +# define QTX_EXPORT _declspec( dllexport ) +# else +# define QTX_EXPORT _declspec( dllimport ) +# endif #else -#define QTX_EXPORT -#endif -#else -#if defined WIN32 -#define QTX_EXPORT _declspec( dllimport ) -#else -#define QTX_EXPORT -#endif +# define QTX_EXPORT #endif #if defined SOLARIS @@ -85,7 +81,12 @@ public: AlignOutBottom = AlignOutTop << 2 //!< align top side of one widget to the bottom side of another widget } AlignmentFlags; - typedef enum { PT_OpenFile, PT_SaveFile, PT_Directory } PathType; + //! Path type, indicates required directory/file operation + typedef enum { + PT_OpenFile, //!< the file is opened + PT_SaveFile, //!< the file is saved + PT_Directory //!< the directory path is required + } PathType; static QString toQString( const char*, const int = -1 ); static QString toQString( const short*, const int = -1 ); diff --git a/src/Qtx/QtxAction.cxx b/src/Qtx/QtxAction.cxx index c43f03242..1e46ce16d 100755 --- a/src/Qtx/QtxAction.cxx +++ b/src/Qtx/QtxAction.cxx @@ -25,6 +25,12 @@ #include #include +/*! + \class QtxAction::ActionNotify + \brief Notify event used to signalize about event adding/removing. + \internal +*/ + class QtxAction::ActionNotify : public QEvent { public: @@ -42,16 +48,23 @@ private: /*! \class QtxAction \brief Generic action class. + + The class QtxAction inherits QWidgetAction class and can be used + as base class when implementing any custom menu/toolbar actions. + It is necessary to subclass from QtxAction and redefine virtual + callback methods addedTo(), removedFrom() (which are called automatically + when the action is added to the widget and removed from it) to customize + the action behavior. */ /*! \brief Constructor. - Create an action. + Creates an action owned by \a parent. + Parameter \a toggle can be used to make the action checkable. \param parent parent object - \param name action name (in terms of QObject) - \param toggle if \c true the action is a toggle action + \param toggle if \c true the action will be a toggle action */ QtxAction::QtxAction( QObject* parent, bool toggle ) : QWidgetAction( parent ) @@ -64,15 +77,16 @@ QtxAction::QtxAction( QObject* parent, bool toggle ) /*! \brief Constructor. - Create an action. + Creates an action owned by \a parent. Parameters \a text, + \a icon, \a menuText and \a accel specify the action's attributes. + Parameter \a toggle can be used to make the action checkable. \param text tooltip text \param icon iconset \param menuText menu text \param accel shortcut key sequence \param parent parent object - \param name action name (in terms of QObject) - \param toggle if \c true the action is a toggle action + \param toggle if \c true the action will be a toggle action */ QtxAction::QtxAction( const QString& text, const QIcon& icon, const QString& menuText, int accel, QObject* parent, bool toggle ) @@ -90,13 +104,14 @@ QtxAction::QtxAction( const QString& text, const QIcon& icon, /*! \brief Constructor. - Create an action. + Creates an action owned by \a parent. Parameters \a text, + \a menuText and \a accel specify the action's attributes. + Parameter \a toggle can be used to make the action checkable. \param text tooltip text \param menuText menu text \param accel shortcut key sequence \param parent parent object - \param name action name (in terms of QObject) \param toggle if \c true the action is a toggle action */ QtxAction::QtxAction( const QString& text, const QString& menuText, @@ -113,21 +128,21 @@ QtxAction::QtxAction( const QString& text, const QString& menuText, /*! \brief Destructor. - - Does nothing for the moment. */ QtxAction::~QtxAction() { } /*! - \brief Event filter. + \brief Customize action events. - Redefined from QObject. Calls virtual methods when the action is added to + Sends a notification event to the action when it is added to the widget or removed from it in order to perform custom processing. + \param o object \param e event - \return default implementation + \return \c true if further event processing should be stopped + \sa customEvent(), addedTo(), removedFrom() */ bool QtxAction::eventFilter( QObject* o, QEvent* e ) { @@ -144,27 +159,39 @@ bool QtxAction::eventFilter( QObject* o, QEvent* e ) /*! \brief Called when the action is added to the widget. - Base implementation does nothing. Can be redefined in the successor - class to customize the behavior. + This method can be redefined in the subclasses to customize + the action behavior. Base implementation does nothing. - \param w widget (menu or toolbar) + \param w widget (should be menu or toolbar) + \sa removedFrom() */ -void QtxAction::addedTo( QWidget* ) +void QtxAction::addedTo( QWidget* /*w*/ ) { } /*! \brief Called when the action is removed from the widget. - Base implementation does nothing. Can be redefined in the successor - class to customize the behavior. + This method can be redefined in the subclasses to customize + the action behavior. Base implementation does nothing. - \param w widget (menu or toolbar) + \param w widget (should be menu or toolbar) + \sa addedTo() */ -void QtxAction::removedFrom( QWidget* ) +void QtxAction::removedFrom( QWidget* /*w*/ ) { } +/*! + \brief Process notification events. + + Calls addedTo() method when the action is added to the widget + and removedFrom() when it is removed from the widget + in order to perform custom processing. + + \param e noification event + \sa eventFilter(), addedTo(), removedFrom() +*/ void QtxAction::customEvent( QEvent* e ) { ActionNotify* ae = (ActionNotify*)e; diff --git a/src/Qtx/QtxActionMenuMgr.cxx b/src/Qtx/QtxActionMenuMgr.cxx index 07bbc1100..f3b42a46d 100644 --- a/src/Qtx/QtxActionMenuMgr.cxx +++ b/src/Qtx/QtxActionMenuMgr.cxx @@ -30,11 +30,12 @@ /*! \class QtxActionMenuMgr::MenuNode - \internal \brief Represents a menu item inside main menu structure. + \internal */ -class QtxActionMenuMgr::MenuNode { +class QtxActionMenuMgr::MenuNode +{ public: MenuNode(); MenuNode( MenuNode*, const int, const int, const int ); @@ -50,6 +51,7 @@ public: /*! \brief Default constructor. + \internal */ QtxActionMenuMgr::MenuNode::MenuNode() : parent( 0 ), id( -1 ), idx( -1 ), group( -1 ), visible( true ) @@ -58,6 +60,7 @@ QtxActionMenuMgr::MenuNode::MenuNode() /*! \brief Constructor. + \internal \param p parent menu node \param _id menu node ID \param _idx menu node index @@ -75,6 +78,7 @@ QtxActionMenuMgr::MenuNode::MenuNode( MenuNode* p, /*! \brief Destructor. + \internal */ QtxActionMenuMgr::MenuNode::~MenuNode() { @@ -93,7 +97,7 @@ QtxActionMenuMgr::MenuNode::~MenuNode() Methods show(), hide() allow displaying/erasing of specified menu items. Actions can be grouped with help of group identificator. Inside the popup - or main menu bar menu items are ordered by the group ID (ascending). + or main menu bar menu items are ordered by the group identifier (ascending). Menu manager automatically optimizes the menu by removing extra separators, hiding empty popup menus etc. @@ -143,11 +147,12 @@ QtxActionMenuMgr::~QtxActionMenuMgr() } /*! - \brief Check if an action with given ID \a actId is visible to - the parent action with given ID \a place. + \brief Check if an action with \a actId identifier is visible to + the parent action with \a place identifier. \param actId action ID \param place some parent action ID - \return \c true if an action is visible + \return \c true if an action is visible to the parent + \sa setVisible() */ bool QtxActionMenuMgr::isVisible( const int actId, const int place ) const { @@ -156,10 +161,11 @@ bool QtxActionMenuMgr::isVisible( const int actId, const int place ) const } /*! - \brief Set action visibility flag. + \brief Set action's visibility flag. \param actId action ID \param place some parent action ID - \param on visibility state + \param v new visibility state + \sa isVisible() */ void QtxActionMenuMgr::setVisible( const int actId, const int place, const bool v ) { @@ -172,8 +178,8 @@ void QtxActionMenuMgr::setVisible( const int actId, const int place, const bool \brief Insert action to the menu. Insert an action to the named menu. The \a menus parameter represents - the menu name: it is a sequence of strings, separated by '|' symbol. - For example, "File|Edit" means File->Edit submenu. + the menu name: it can be a sequence of strings, separated by '|' symbol. + For example, "File|Edit" means \c File->Edit submenu. If submenu doesn't exist, it will be created. \param id action ID @@ -191,8 +197,8 @@ int QtxActionMenuMgr::insert( const int id, const QString& menus, const int grou \brief Insert action to the menu. Insert an action to the named menu. The \a menus parameter represents - the menu name: it is a sequence of strings, separated by '|' symbol. - For example, "File|Edit" means File->Edit submenu. + the menu name: it can be a sequence of strings, separated by '|' symbol. + For example, "File|Edit" means \c File->Edit submenu. If submenu doesn't exist, it will be created. \param a action @@ -212,7 +218,7 @@ int QtxActionMenuMgr::insert( QAction* a, const QString& menus, const int group, Insert an action to the named menu. The \a menus parameter represents the menu names list. For example, string list consisting from two items "File" and "Edit" - means File->Edit submenu. + means \c File->Edit submenu. If submenu doesn't exist, it will be created. \param id action ID @@ -236,7 +242,7 @@ int QtxActionMenuMgr::insert( const int id, const QStringList& menus, const int Insert an action to the named menu. The \a menus parameter represents the menu names list. For example, string list consisting from two items "File" and "Edit" - means File->Edit submenu. + means \c File->Edit submenu. If submenu doesn't exist, it will be created. \param a action @@ -338,8 +344,8 @@ int QtxActionMenuMgr::insert( const QString& title, const int pId, const int gro \brief Create and insert menu item action to the menu. Insert an action to the named menu. The \a menus parameter represents - the menu name: it is a sequence of strings, separated by '|' symbol. - For example, "File|Edit" means File->Edit submenu. + the menu name: it can be a sequence of strings, separated by '|' symbol. + For example, "File|Edit" means \c File->Edit submenu. If submenu doesn't exist, it will be created. \param title menu text @@ -360,7 +366,7 @@ int QtxActionMenuMgr::insert( const QString& title, const QString& menus, const Insert an action to the named menu. The \a menus parameter represents the menu names list. For example, string list consisting from two items "File" and "Edit" - means File->Edit submenu. + means \c File->Edit submenu. If submenu doesn't exist, it will be created. \param title menu text @@ -488,6 +494,7 @@ void QtxActionMenuMgr::remove( const int id, const int pId, const int group ) /*! \brief Show menu item with given \a id. \param id menu action ID + \sa hide() */ void QtxActionMenuMgr::show( const int id ) { @@ -497,6 +504,7 @@ void QtxActionMenuMgr::show( const int id ) /*! \brief Hide menu item with given \a id. \param id menu action ID + \sa show() */ void QtxActionMenuMgr::hide( const int id ) { @@ -507,6 +515,7 @@ void QtxActionMenuMgr::hide( const int id ) \brief Get visibility status for menu item with given \a id. \param id menu action ID \return \c true if an item is shown + \sa setShown() */ bool QtxActionMenuMgr::isShown( const int id ) const { @@ -521,6 +530,7 @@ bool QtxActionMenuMgr::isShown( const int id ) const \brief Set visibility status for menu item with given \a id. \param id menu action ID \param on new visibility status + \sa isShown() */ void QtxActionMenuMgr::setShown( const int id, const bool on ) { @@ -538,7 +548,7 @@ void QtxActionMenuMgr::setShown( const int id, const bool on ) } /*! - \brief Change menu title fot the action with given \a id. + \brief Change menu title for the action with given \a id. \param id menu action ID \param title new menu title */ @@ -586,8 +596,22 @@ void QtxActionMenuMgr::onDestroyed( QObject* obj ) myMenu = 0; } + /*! - \brief Returns the menu widget. + \fn void QtxActionMenuMgr::menuAboutToShow( QMenu* m ) + \brief Emitted when the menu is about to be shown. + \param m menu being shown +*/ + +/*! + \fn void QtxActionMenuMgr::menuAboutToHide( QMenu* m ) + \brief Emitted when the menu is about to be hidden. + \param m menu being hidden +*/ + +/*! + \brief Get the menu widget. + \return menu widget (QMenuBar) */ QWidget* QtxActionMenuMgr::menuWidget() const { @@ -619,7 +643,7 @@ void QtxActionMenuMgr::setMenuWidget( QWidget* mw ) \param id menu action ID \param pId parent menu item ID \param rec if \c true perform recursive search - \return menu node or 0 if not found + \return menu node or 0 if it is not found */ QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int id, const int pId, const bool rec ) const { @@ -631,7 +655,7 @@ QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int id, const int pId, \param id menu action ID \param startNode start menu node (if 0, search from root node) \param rec if \c true perform recursive search - \return menu node or 0 if not found + \return menu node or 0 if it is not found */ QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int id, MenuNode* startNode, const bool rec ) const { @@ -673,7 +697,7 @@ bool QtxActionMenuMgr::find( const int id, NodeList& lst, MenuNode* startNode ) \param title menu item title \param pId parent menu item ID \param rec if \c true perform recursive search - \return menu node or 0 if not found + \return menu node or 0 if it is not found */ QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const QString& title, const int pId, const bool rec ) const { @@ -708,7 +732,7 @@ bool QtxActionMenuMgr::find( const QString& title, NodeList& lst, MenuNode* star \param title menu item title \param startNode start menu node (if 0, search from root node) \param rec if \c true perform recursive search - \return menu node or 0 if not found + \return menu node or 0 if it is not found */ QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const QString& title, MenuNode* startNode, const bool rec ) const { @@ -767,7 +791,7 @@ void QtxActionMenuMgr::removeMenu( const int id, MenuNode* startNode ) /*! \brief Get action by \a id. \param id action ID - \return action or 0 if not found + \return action or 0 if \a id is invalid */ QAction* QtxActionMenuMgr::itemAction( const int id ) const { @@ -777,7 +801,7 @@ QAction* QtxActionMenuMgr::itemAction( const int id ) const /*! \brief Get submenu action by \a id. \param id submenu ID - \return submenu action or 0 if not found + \return submenu action or 0 if action is not found */ QAction* QtxActionMenuMgr::menuAction( const int id ) const { @@ -792,7 +816,7 @@ QAction* QtxActionMenuMgr::menuAction( const int id ) const /*! \brief Get submenu action by \a id. \param id submenu ID - \return submenu action or 0 if not found + \return submenu action or 0 if it is not found */ int QtxActionMenuMgr::menuActionId( QAction* a ) const { @@ -923,9 +947,10 @@ bool QtxActionMenuMgr::checkWidget( QWidget* wid ) const /*! \brief Get menu widget for the given \a node. \param node menu node - \return popup menu or main menu corresponding to the menu node (or 0 if not found) + \return popup menu or main menu corresponding to the menu node + (or 0 if it is not found) */ -QWidget* QtxActionMenuMgr::menuWidget( MenuNode* node) const +QWidget* QtxActionMenuMgr::menuWidget( MenuNode* node ) const { if ( !node || node == myRoot ) return myMenu; @@ -1021,7 +1046,7 @@ bool QtxActionMenuMgr::containsMenu( const int id, const int pid ) const /*! \brief Get menu by the specified identifier. \param id menu item ID - \return \c menu poiter or 0 if menu is not found + \return menu pointer or 0 if menu is not found */ QMenu* QtxActionMenuMgr::findMenu( const int id ) const { @@ -1086,14 +1111,12 @@ void QtxActionMenuMgr::updateContent() */ QtxActionMenuMgr::MenuCreator::MenuCreator( QtxActionMgr::Reader* r, QtxActionMenuMgr* mgr ) : QtxActionMgr::Creator( r ), -myMgr( mgr ) + myMgr( mgr ) { } /*! - \brief Creator destructor. - - Does nothing for the moment. + \brief Destructor. */ QtxActionMenuMgr::MenuCreator::~MenuCreator() { @@ -1153,15 +1176,3 @@ int QtxActionMenuMgr::MenuCreator::append( const QString& tag, const bool subMen return res; } - -/*! - \fn void QtxActionMenuMgr::menuAboutToShow( QMenu* m ) - \brief Emitted when the menu is about to be shown. - \param m menu being shown -*/ - -/*! - \fn void QtxActionMenuMgr::menuAboutToHide( QMenu* m ) - \brief Emitted when the menu is about to be hidden. - \param m menu being hidden -*/ diff --git a/src/Qtx/QtxActionMgr.cxx b/src/Qtx/QtxActionMgr.cxx index bd0236422..366dd24e8 100644 --- a/src/Qtx/QtxActionMgr.cxx +++ b/src/Qtx/QtxActionMgr.cxx @@ -34,9 +34,9 @@ typedef QList< QPointer > qtx_actionlist; static qtx_actionlist qtx_separator_actions; /*! - \internal \brief Clean all cashed separator actions. - */ + \internal +*/ void qtxSeparatorActionCleanup() { for ( qtx_actionlist::iterator it = qtx_separator_actions.begin(); it != qtx_separator_actions.end(); ++it ) @@ -45,8 +45,8 @@ void qtxSeparatorActionCleanup() /*! \class QtxActionMgr::SeparatorAction - \internal \brief Separator action class. + \internal */ class QtxActionMgr::SeparatorAction : public QtxAction @@ -57,7 +57,8 @@ public: }; /*! - \brief Separator action constructor. + \brief Constructor. + \internal \param parent parent object */ QtxActionMgr::SeparatorAction::SeparatorAction( QObject* parent ) @@ -67,24 +68,38 @@ QtxActionMgr::SeparatorAction::SeparatorAction( QObject* parent ) } /*! - \brief Separator action destructor. - - Does nothing for the moment. + \brief Destructor. */ QtxActionMgr::SeparatorAction::~SeparatorAction() { } - /*! \class QtxActionMgr - \brief Manages a set of actions accessible by unique ID. + \brief Manages a set of actions accessible by unique identifier. - Base class for menu, toolbar action containers and popup menu creators. + Base class for menu, toolbar actions containers and popup menu creators. + + Actions are registered in the manager with the registerAction() method + and unregistered from it with the unRegisterAction() method. + + Functions action() and actionId() allow getting action by its identifier + and vice versa. Method contains() returns \c true if the action with + the specified identifier is already registered. + + To get total number of the registered actions can be retrieved by + the method count(). Function isEmpty() returns \c true if manager does not + contains any actions. The list of all actions identifiers can be retrieved + with the idList() function. + + The method separator() allows creating a separator action which can be + used in the menus or toolbars to separate logical groups of actions. + + To enable/disable any action by its identifier, use setEnabled() method. */ /*! - \brief Action manager constructor. + \brief Constructor. \param parent parent object */ QtxActionMgr::QtxActionMgr( QObject* parent ) @@ -95,23 +110,23 @@ QtxActionMgr::QtxActionMgr( QObject* parent ) } /*! - \brief Action manager destructor. - - Does nothing for the moment. + \brief Destructor. */ QtxActionMgr::~QtxActionMgr() { } /*! - \brief Register action in the internal map. + \brief Register an action in the internal map. - If \a userId is less than 0, the ID for the action is generated automatically. - If action with given \a userId is already registered, it will be re-registered. + If \a userId is less than 0, the identifier for the action + is generated automatically. If action with given \a userId + is already registered, it will be re-registered. \param a action to be registered \param userId action ID \return action ID (the same as userId or generated one) + \sa unRegisterAction() */ int QtxActionMgr::registerAction( QAction* a, const int userId ) { @@ -140,6 +155,7 @@ int QtxActionMgr::registerAction( QAction* a, const int userId ) /*! \brief Unregister action from internal map. \param id action ID + \sa registerAction() */ void QtxActionMgr::unRegisterAction( const int id ) { @@ -148,9 +164,10 @@ void QtxActionMgr::unRegisterAction( const int id ) } /*! - \brief Get action by \a id. + \brief Get action by specified identifier. \param id action ID - \return action (0 if action is not found) + \return action (or 0 if \a id is invalid) + \sa actionId() */ QAction* QtxActionMgr::action( const int id ) const { @@ -161,9 +178,10 @@ QAction* QtxActionMgr::action( const int id ) const } /*! - \brief Get action ID. + \brief Get action identifier. \param a action - \return action ID (-1 if action is not found) + \return action ID (or -1 if action is not found) + \sa action() */ int QtxActionMgr::actionId( const QAction* a ) const { @@ -183,7 +201,7 @@ int QtxActionMgr::actionId( const QAction* a ) const /*! \brief Check if an action with given \a id is registered in the action manager. \param id action ID - \return \c true if internal map contains action with such ID + \return \c true if internal map contains action with such identifier */ bool QtxActionMgr::contains( const int id ) const { @@ -191,8 +209,9 @@ bool QtxActionMgr::contains( const int id ) const } /*! - \brief Get number of registered actions. + \brief Get total number of registered actions. \return number of actions in the internal map + \sa isEmpty() */ int QtxActionMgr::count() const { @@ -202,6 +221,7 @@ int QtxActionMgr::count() const /*! \brief Check if there are no actions registered in the action manager. \return \c true if internal map is empty + \sa count() */ bool QtxActionMgr::isEmpty() const { @@ -209,17 +229,18 @@ bool QtxActionMgr::isEmpty() const } /*! - \brief Get all registered actions IDs. - \param list of actions IDs to be fiiled in + \brief Get all registered actions identifiers. + \return list of actions identifiers */ -void QtxActionMgr::idList( QIntList& lst ) const +QIntList QtxActionMgr::idList() const { - lst = myActions.keys(); + return myActions.keys(); } /*! \brief Check if update is enabled. \return \c true if update is enabled + \sa setUpdatesEnabled(), update() */ bool QtxActionMgr::isUpdatesEnabled() const { @@ -229,6 +250,7 @@ bool QtxActionMgr::isUpdatesEnabled() const /*! \brief Enable/disable update operation. \param upd new state + \sa isUpdatesEnabled(), update() */ void QtxActionMgr::setUpdatesEnabled( const bool upd ) { @@ -236,14 +258,16 @@ void QtxActionMgr::setUpdatesEnabled( const bool upd ) } /*! - \brief Check if an action with given ID \a actId is visible to - the parent action with given ID \a place. + \brief Check if an action with \a actId identifier is visible to + the parent action with \a place identifier. + This method can be redefined in subclasses. Base implementatin always returns \c true. \param actId action ID \param place some parent action ID - \return \c true if an action is visible + \return \c true if an action is visible to the parent + \sa setVisible() */ bool QtxActionMgr::isVisible( const int /*actId*/, const int /*place*/ ) const { @@ -251,24 +275,27 @@ bool QtxActionMgr::isVisible( const int /*actId*/, const int /*place*/ ) const } /*! - \brief Set action visibility flag. + \brief Set action's visibility flag. + This method can be redefined in subclasses. Base implementatin does nothing. \param actId action ID \param place some parent action ID - \param on visibility state + \param v new visibility state + \sa isVisible() */ -void QtxActionMgr::setVisible( const int /*actId*/, const int /*place*/, const bool /*on*/ ) +void QtxActionMgr::setVisible( const int /*actId*/, const int /*place*/, const bool /*v*/ ) { } /*! \brief Update actions. + Calls virtual function internalUpdate to update the contents. Does nothing if update is disabled. - \sa isUpdatesEnabled(), internalUpdate() + \sa setUpdatesEnabled(), isUpdatesEnabled(), internalUpdate() */ void QtxActionMgr::update() { @@ -283,14 +310,16 @@ void QtxActionMgr::update() /*! \brief Internal update. - This method is called by update() function and should be redefined in successors. + This method is called by update() function and can be redefined + in subclasses to customize update operation. Base implementation + does nothing. */ void QtxActionMgr::internalUpdate() { } /*! - \brief Generate unique action ID. + \brief Generate unique action identifier. \return new ID */ int QtxActionMgr::generateId() const @@ -328,9 +357,9 @@ void QtxActionMgr::setEnabled( const int id, const bool enable ) /*! \brief Create new separator action. - If \a own is \c true, that the caller is responsible for the action - deleting. If \a own is \c false, new separator action is owned by the - action manager which destroys it on application exit. + If \a own is \c true, then the caller is responsible for the action + destroying. If \a own is \c false, new separator action will be owned by the + action manager which will destroy it on application exit. \param own ownership flag \return new separator action @@ -353,6 +382,7 @@ QAction* QtxActionMgr::separator( const bool own ) \brief Perform delayed update. Does nothing if update is disabled. + \sa isUpdatesEnabled(), setUpdatesEnabled(), update() */ void QtxActionMgr::triggerUpdate() { @@ -374,18 +404,19 @@ void QtxActionMgr::triggerUpdate() \brief Internal content update operation. Called automatically by onUpdateContent() when the delayed update - id triggered. Default implementation does nothing. + is triggered. Base implementation does nothing. \sa triggerUpdate(), onUpdateContent() */ void QtxActionMgr::updateContent() -{} +{ +} /*! \brief Called when delayed update is performed (via timer event). - Calls virtual method updateContent() which can customize the - content update operation. + Calls virtual method updateContent() which can be redefined in the + subclasses to customize the content update operation. */ void QtxActionMgr::onUpdateContent() { @@ -397,29 +428,25 @@ void QtxActionMgr::onUpdateContent() \brief Generic actions description files reader class. This class is used to read files of some format to create actions - and fill an action manager with actions automatically. + and fill an action manager with the actions automatically. */ /*! - \brief Reader constructor. - - Does nothing for the moment. + \brief Constructor. */ QtxActionMgr::Reader::Reader() { } /*! - \brief Reader destructor - - Does nothing for the moment. + \brief Destructor */ QtxActionMgr::Reader::~Reader() { } /*! - \brief Get list of options. + \brief Get the list of options. \return options list */ QStringList QtxActionMgr::Reader::options() const @@ -430,7 +457,7 @@ QStringList QtxActionMgr::Reader::options() const /*! \brief Get option value. - If there is no such option the default value is returned. + If there is no such option the default value (\a def) is returned. \param name option name \param def default option value @@ -459,11 +486,11 @@ void QtxActionMgr::Reader::setOption( const QString& name, const QString& value \brief Read the file and fill and action manager with actions by using help actions creator. - Default implementation is pure virtual. + This method should be redefined in the subclasses. \param fname XML file name \param cr actions creator - \return \c true in success and \c false in case of error + \return \c true on success and \c false in case of error */ /*! @@ -471,12 +498,11 @@ void QtxActionMgr::Reader::setOption( const QString& name, const QString& value \brief XML file reader. This class is used to read files of XML format to create - actions and fill an action manager with actions automatically. + actions and fill an action manager with actions automatically. */ /*! - \brief XML reader constructor. - + \brief Constructor. \param root root XML tag name \param item menu item XML tag name \param dir resources directory (containing icons, etc) @@ -501,9 +527,7 @@ QtxActionMgr::XMLReader::XMLReader( const QString& root, } /*! - \brief XML reader destructor. - - Does nothing for the moment. + \brief Destructor. */ QtxActionMgr::XMLReader::~XMLReader() { @@ -511,10 +535,10 @@ QtxActionMgr::XMLReader::~XMLReader() /*! \brief Read the file and fill and action manager with actions - by using help actions creator. + by using actions creator. \param fname XML file name \param cr actions creator - \return \c true in success and \c false in case of error + \return \c true on success and \c false in case of error */ bool QtxActionMgr::XMLReader::read( const QString& fname, Creator& cr ) const { @@ -636,7 +660,7 @@ bool QtxActionMgr::XMLReader::isNodeSimilar( const QDomNode& node, /*! \brief Get integer attribute value from the attribute map. - Returns default value if the attribute is not found. + Returns default value (\a def) if the attribute is not found. \param attrs attributes map \param name attribute name @@ -659,7 +683,7 @@ int QtxActionMgr::Creator::intValue( const ItemAttributes& attrs, /*! \brief Get string attribute value from the attribute map. - Returns default value if the attribute is not found. + Returns default value (\a def) if the attribute is not found. \param attrs attributes map \param name attribute name @@ -677,7 +701,7 @@ QString QtxActionMgr::Creator::strValue( const ItemAttributes& attrs, } /*! - \brief Creator constructor. + \brief Constructor. \param r action reader */ QtxActionMgr::Creator::Creator( QtxActionMgr::Reader* r ) @@ -686,9 +710,7 @@ QtxActionMgr::Creator::Creator( QtxActionMgr::Reader* r ) } /*! - \brief Creator destructor. - - Does nothing for the moment. + \brief Destructor. */ QtxActionMgr::Creator::~Creator() { @@ -704,9 +726,10 @@ QtxActionMgr::Reader* QtxActionMgr::Creator::reader() const } /*! - \brief Connect action to some specific slot(s) + \brief Connect action to some specific slot(s). - Default implementation does nothing. + This method can be redefined in subclasses. + Base implementation does nothing. \param a action */ @@ -717,7 +740,7 @@ void QtxActionMgr::Creator::connect( QAction* /*a*/ ) const /*! \brief Load pixmap from the file. \param fname file name - \param pix uaed to return pixmap + \param pix used to return pixmap \return \c true if pixmap is loaded successfully and \c false in case of error */ bool QtxActionMgr::Creator::loadPixmap( const QString& fname, QPixmap& pix ) const @@ -742,7 +765,7 @@ bool QtxActionMgr::Creator::loadPixmap( const QString& fname, QPixmap& pix ) con const int pId ) \brief Create (and probably append to the action manager) new action. - Default implementation is pure virtual. + This method should be redefined in the subclasses. \param tag item tag name \param subMenu \c true if this item is submenu diff --git a/src/Qtx/QtxActionMgr.h b/src/Qtx/QtxActionMgr.h index 2cd2cc9fa..98d99e3c6 100644 --- a/src/Qtx/QtxActionMgr.h +++ b/src/Qtx/QtxActionMgr.h @@ -63,7 +63,7 @@ public: int count() const; bool isEmpty() const; - void idList( QIntList& ) const; + QIntList idList() const; bool isUpdatesEnabled() const; virtual void setUpdatesEnabled( const bool ); diff --git a/src/Qtx/QtxActionSet.cxx b/src/Qtx/QtxActionSet.cxx index 7cfa6a63a..b25caad93 100644 --- a/src/Qtx/QtxActionSet.cxx +++ b/src/Qtx/QtxActionSet.cxx @@ -58,7 +58,7 @@ QtxActionSet::~QtxActionSet() /*! \brief Get list of child actions. - \return list of assigned actions. + \return list of assigned actions */ QList QtxActionSet::actions() const { @@ -227,7 +227,7 @@ void QtxActionSet::onChanged() \brief Called when some action is activated by the user. \param on toggled state (not used) */ -void QtxActionSet::onActionTriggered( bool ) +void QtxActionSet::onActionTriggered( bool /*on*/ ) { QAction* a = ::qobject_cast( sender() ); if ( !a ) @@ -264,7 +264,7 @@ void QtxActionSet::removedFrom( QWidget* w ) /*! \brief Get action by specified identifier. \param id action ID - \return action or 0 if not found + \return action or 0 if it is not found */ QAction* QtxActionSet::action( int id ) const { @@ -280,7 +280,7 @@ QAction* QtxActionSet::action( int id ) const /*! \brief Get action identifier for the action. \param a action - \return action ID or -1 if not found + \return action ID or -1 if it is not found */ int QtxActionSet::actionId( QAction* a ) const { diff --git a/src/Qtx/QtxActionToolMgr.cxx b/src/Qtx/QtxActionToolMgr.cxx index 73ac80a5f..a13c60e3c 100644 --- a/src/Qtx/QtxActionToolMgr.cxx +++ b/src/Qtx/QtxActionToolMgr.cxx @@ -28,22 +28,23 @@ /*! \class QtxActionToolMgr::ToolNode - \internal \brief Represents a toolbutton inside toolbar structure. + \internal */ /*! \fn QtxActionToolMgr::ToolNode::ToolNode() + \internal \brief Default constructor. */ /*! \fn QtxActionToolMgr::ToolNode::ToolNode( const int _id ) \brief Constructor. + \internal \param _id toolbar node ID */ - /*! \class QtxActionToolMgr \brief Toolbar actions manager. @@ -86,7 +87,7 @@ QMainWindow* QtxActionToolMgr::mainWindow() const /*! \brief Create toolbar and assign \a id to it. - If \a tid is less than 0, the ID is generated automatically. + If \a tid is less than 0, the identifier is generated automatically. If toolbar with given \a tid is already registered, the toolbar will not be created. \param title toolbar title @@ -132,7 +133,7 @@ int QtxActionToolMgr::createToolBar( const QString& title, const int tid ) \brief Search toolbar with given \a title owned by main window \mw. \param title toolbar title \param mw main window - \return toolbar or 0 if not found + \return toolbar or 0 if it is not found */ QToolBar* QtxActionToolMgr::find( const QString& title, QMainWindow* mw ) const { @@ -317,9 +318,9 @@ int QtxActionToolMgr::prepend( const int id, const QString& title ) \param title toolbar title \return action ID */ -int QtxActionToolMgr::prepend( QAction* a, const QString& tname ) +int QtxActionToolMgr::prepend( QAction* a, const QString& title ) { - return insert( a, tname, 0 ); + return insert( a, title, 0 ); } /*! @@ -358,7 +359,7 @@ void QtxActionToolMgr::remove( const int id, const QString& title ) /*! \brief Get toolbar by given \a tid. \param tid toolbar ID - \return toolbar or 0 if not found + \return toolbar or 0 if it is not found */ QToolBar* QtxActionToolMgr::toolBar( const int tid ) const { @@ -371,7 +372,7 @@ QToolBar* QtxActionToolMgr::toolBar( const int tid ) const /*! \brief Get toolbar by given \a title. \param title toolbar title - \return toolbar or 0 if not found + \return toolbar or 0 if it is not found */ QToolBar* QtxActionToolMgr::toolBar( const QString& title ) const { @@ -432,7 +433,7 @@ void QtxActionToolMgr::onToolBarDestroyed() /*! \brief Search toolbar by given \a name. \param title toolbar title - \return toolbar ID or -1 if not found + \return toolbar ID or -1 if it is not found */ int QtxActionToolMgr::find( const QString& title ) const { @@ -446,7 +447,7 @@ int QtxActionToolMgr::find( const QString& title ) const } /*! - \brief Get toolbar ID. + \brief Get toolbar identifier. \param tb toolbar \return toolbar ID or -1 if toolbar is not registered */ @@ -515,7 +516,7 @@ void QtxActionToolMgr::internalUpdate() } /*! - \brief Remove extra separators from toolbar. + \brief Remove extra separators from the toolbar. \param tb toolbar */ void QtxActionToolMgr::simplifySeparators( QToolBar* tb ) @@ -524,7 +525,7 @@ void QtxActionToolMgr::simplifySeparators( QToolBar* tb ) } /*! - \brief Show action (in all toolbars) + \brief Show action (in all toolbars). \param id action ID */ void QtxActionToolMgr::show( const int id ) @@ -533,7 +534,7 @@ void QtxActionToolMgr::show( const int id ) } /*! - \brief Hide action (in all toolbars) + \brief Hide action (in all toolbars). \param id action ID */ void QtxActionToolMgr::hide( const int id ) @@ -690,9 +691,7 @@ QtxActionToolMgr::ToolCreator::ToolCreator( QtxActionMgr::Reader* r, } /*! - \brief Creator destructor. - - Does nothing for the moment. + \brief Destructor. */ QtxActionToolMgr::ToolCreator::~ToolCreator() {